Seprated the subscrption plan and subscription details and commented add-subscription and update-subscription

This commit is contained in:
ashutosh.nehete 2025-08-06 09:36:40 +05:30
parent 60a3b3ab22
commit 54bf49a005
27 changed files with 5229 additions and 348 deletions

View File

@ -36,6 +36,7 @@ namespace Marco.Pms.DataAccess.Data
public DbSet<SubscriptionStatus> SubscriptionStatus { get; set; } public DbSet<SubscriptionStatus> SubscriptionStatus { get; set; }
public DbSet<Tenant> Tenants { get; set; } public DbSet<Tenant> Tenants { get; set; }
public DbSet<SubscriptionPlan> SubscriptionPlans { get; set; } public DbSet<SubscriptionPlan> SubscriptionPlans { get; set; }
public DbSet<SubscriptionPlanDetails> SubscriptionPlanDetails { get; set; }
public DbSet<TenantSubscriptions> TenantSubscriptions { get; set; } public DbSet<TenantSubscriptions> TenantSubscriptions { get; set; }
public DbSet<ApplicationUser> ApplicationUsers { get; set; } public DbSet<ApplicationUser> ApplicationUsers { get; set; }
public DbSet<ActivityMaster> ActivityMasters { get; set; } public DbSet<ActivityMaster> ActivityMasters { get; set; }
@ -157,31 +158,26 @@ namespace Marco.Pms.DataAccess.Data
new StatusMaster new StatusMaster
{ {
Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"),
Status = "Active", Status = "Active"
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
}, },
new StatusMaster new StatusMaster
{ {
Id = new Guid("cdad86aa-8a56-4ff4-b633-9c629057dfef"), Id = new Guid("cdad86aa-8a56-4ff4-b633-9c629057dfef"),
Status = "In Progress", Status = "In Progress"
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
}, new StatusMaster }, new StatusMaster
{ {
Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"),
Status = "On Hold", Status = "On Hold"
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
}, },
new StatusMaster new StatusMaster
{ {
Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"),
Status = "In Active", Status = "In Active"
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
}, },
new StatusMaster new StatusMaster
{ {
Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"),
Status = "Completed", Status = "Completed"
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
} }
); );
modelBuilder.Entity<Project>().HasData( modelBuilder.Entity<Project>().HasData(

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,411 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Seprated_SubscriptionPlan_And_SubscriptionPlanDetails : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_StatusMasters_Tenants_TenantId",
table: "StatusMasters");
migrationBuilder.DropForeignKey(
name: "FK_SubscriptionPlans_CurrencyMaster_CurrencyId",
table: "SubscriptionPlans");
migrationBuilder.DropForeignKey(
name: "FK_SubscriptionPlans_Employees_CreatedById",
table: "SubscriptionPlans");
migrationBuilder.DropForeignKey(
name: "FK_SubscriptionPlans_Employees_UpdatedById",
table: "SubscriptionPlans");
migrationBuilder.DropForeignKey(
name: "FK_TenantSubscriptions_SubscriptionPlans_PlanId",
table: "TenantSubscriptions");
migrationBuilder.DropIndex(
name: "IX_SubscriptionPlans_CreatedById",
table: "SubscriptionPlans");
migrationBuilder.DropIndex(
name: "IX_SubscriptionPlans_CurrencyId",
table: "SubscriptionPlans");
migrationBuilder.DropIndex(
name: "IX_SubscriptionPlans_UpdatedById",
table: "SubscriptionPlans");
migrationBuilder.DropIndex(
name: "IX_StatusMasters_TenantId",
table: "StatusMasters");
migrationBuilder.DropColumn(
name: "CreateAt",
table: "SubscriptionPlans");
migrationBuilder.DropColumn(
name: "CreatedById",
table: "SubscriptionPlans");
migrationBuilder.DropColumn(
name: "CurrencyId",
table: "SubscriptionPlans");
migrationBuilder.DropColumn(
name: "FeaturesId",
table: "SubscriptionPlans");
migrationBuilder.DropColumn(
name: "MaxStorage",
table: "SubscriptionPlans");
migrationBuilder.DropColumn(
name: "MaxUser",
table: "SubscriptionPlans");
migrationBuilder.DropColumn(
name: "PriceHalfYearly",
table: "SubscriptionPlans");
migrationBuilder.DropColumn(
name: "PriceMonthly",
table: "SubscriptionPlans");
migrationBuilder.DropColumn(
name: "PriceQuarterly",
table: "SubscriptionPlans");
migrationBuilder.DropColumn(
name: "PriceYearly",
table: "SubscriptionPlans");
migrationBuilder.DropColumn(
name: "TrialDays",
table: "SubscriptionPlans");
migrationBuilder.DropColumn(
name: "UpdateAt",
table: "SubscriptionPlans");
migrationBuilder.DropColumn(
name: "UpdatedById",
table: "SubscriptionPlans");
migrationBuilder.DropColumn(
name: "TenantId",
table: "StatusMasters");
migrationBuilder.AddColumn<bool>(
name: "IsCancelled",
table: "TenantSubscriptions",
type: "tinyint(1)",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<double>(
name: "MaxUsers",
table: "TenantSubscriptions",
type: "double",
nullable: false,
defaultValue: 0.0);
migrationBuilder.CreateTable(
name: "SubscriptionPlanDetails",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Price = table.Column<double>(type: "double", nullable: false),
Frequency = table.Column<int>(type: "int", nullable: false),
TrialDays = table.Column<int>(type: "int", nullable: false),
MaxUser = table.Column<double>(type: "double", nullable: false),
MaxStorage = table.Column<double>(type: "double", nullable: false),
FeaturesId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
CreateAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
UpdateAt = table.Column<DateTime>(type: "datetime(6)", nullable: true),
PlanId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
CurrencyId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
CreatedById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
UpdatedById = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SubscriptionPlanDetails", x => x.Id);
table.ForeignKey(
name: "FK_SubscriptionPlanDetails_CurrencyMaster_CurrencyId",
column: x => x.CurrencyId,
principalTable: "CurrencyMaster",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_SubscriptionPlanDetails_Employees_CreatedById",
column: x => x.CreatedById,
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_SubscriptionPlanDetails_Employees_UpdatedById",
column: x => x.UpdatedById,
principalTable: "Employees",
principalColumn: "Id");
table.ForeignKey(
name: "FK_SubscriptionPlanDetails_SubscriptionPlans_PlanId",
column: x => x.PlanId,
principalTable: "SubscriptionPlans",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_SubscriptionPlanDetails_CreatedById",
table: "SubscriptionPlanDetails",
column: "CreatedById");
migrationBuilder.CreateIndex(
name: "IX_SubscriptionPlanDetails_CurrencyId",
table: "SubscriptionPlanDetails",
column: "CurrencyId");
migrationBuilder.CreateIndex(
name: "IX_SubscriptionPlanDetails_PlanId",
table: "SubscriptionPlanDetails",
column: "PlanId");
migrationBuilder.CreateIndex(
name: "IX_SubscriptionPlanDetails_UpdatedById",
table: "SubscriptionPlanDetails",
column: "UpdatedById");
migrationBuilder.AddForeignKey(
name: "FK_TenantSubscriptions_SubscriptionPlanDetails_PlanId",
table: "TenantSubscriptions",
column: "PlanId",
principalTable: "SubscriptionPlanDetails",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_TenantSubscriptions_SubscriptionPlanDetails_PlanId",
table: "TenantSubscriptions");
migrationBuilder.DropTable(
name: "SubscriptionPlanDetails");
migrationBuilder.DropColumn(
name: "IsCancelled",
table: "TenantSubscriptions");
migrationBuilder.DropColumn(
name: "MaxUsers",
table: "TenantSubscriptions");
migrationBuilder.AddColumn<DateTime>(
name: "CreateAt",
table: "SubscriptionPlans",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<Guid>(
name: "CreatedById",
table: "SubscriptionPlans",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "CurrencyId",
table: "SubscriptionPlans",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "FeaturesId",
table: "SubscriptionPlans",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
collation: "ascii_general_ci");
migrationBuilder.AddColumn<double>(
name: "MaxStorage",
table: "SubscriptionPlans",
type: "double",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "MaxUser",
table: "SubscriptionPlans",
type: "double",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "PriceHalfYearly",
table: "SubscriptionPlans",
type: "double",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "PriceMonthly",
table: "SubscriptionPlans",
type: "double",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "PriceQuarterly",
table: "SubscriptionPlans",
type: "double",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "PriceYearly",
table: "SubscriptionPlans",
type: "double",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<int>(
name: "TrialDays",
table: "SubscriptionPlans",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<DateTime>(
name: "UpdateAt",
table: "SubscriptionPlans",
type: "datetime(6)",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "UpdatedById",
table: "SubscriptionPlans",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "TenantId",
table: "StatusMasters",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
collation: "ascii_general_ci");
migrationBuilder.UpdateData(
table: "StatusMasters",
keyColumn: "Id",
keyValue: new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"),
column: "TenantId",
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
migrationBuilder.UpdateData(
table: "StatusMasters",
keyColumn: "Id",
keyValue: new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"),
column: "TenantId",
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
migrationBuilder.UpdateData(
table: "StatusMasters",
keyColumn: "Id",
keyValue: new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"),
column: "TenantId",
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
migrationBuilder.UpdateData(
table: "StatusMasters",
keyColumn: "Id",
keyValue: new Guid("cdad86aa-8a56-4ff4-b633-9c629057dfef"),
column: "TenantId",
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
migrationBuilder.UpdateData(
table: "StatusMasters",
keyColumn: "Id",
keyValue: new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"),
column: "TenantId",
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
migrationBuilder.CreateIndex(
name: "IX_SubscriptionPlans_CreatedById",
table: "SubscriptionPlans",
column: "CreatedById");
migrationBuilder.CreateIndex(
name: "IX_SubscriptionPlans_CurrencyId",
table: "SubscriptionPlans",
column: "CurrencyId");
migrationBuilder.CreateIndex(
name: "IX_SubscriptionPlans_UpdatedById",
table: "SubscriptionPlans",
column: "UpdatedById");
migrationBuilder.CreateIndex(
name: "IX_StatusMasters_TenantId",
table: "StatusMasters",
column: "TenantId");
migrationBuilder.AddForeignKey(
name: "FK_StatusMasters_Tenants_TenantId",
table: "StatusMasters",
column: "TenantId",
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_SubscriptionPlans_CurrencyMaster_CurrencyId",
table: "SubscriptionPlans",
column: "CurrencyId",
principalTable: "CurrencyMaster",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_SubscriptionPlans_Employees_CreatedById",
table: "SubscriptionPlans",
column: "CreatedById",
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_SubscriptionPlans_Employees_UpdatedById",
table: "SubscriptionPlans",
column: "UpdatedById",
principalTable: "Employees",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_TenantSubscriptions_SubscriptionPlans_PlanId",
table: "TenantSubscriptions",
column: "PlanId",
principalTable: "SubscriptionPlans",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -1758,45 +1758,35 @@ namespace Marco.Pms.DataAccess.Migrations
b.Property<string>("Status") b.Property<string>("Status")
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<Guid>("TenantId")
.HasColumnType("char(36)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("TenantId");
b.ToTable("StatusMasters"); b.ToTable("StatusMasters");
b.HasData( b.HasData(
new new
{ {
Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"),
Status = "Active", Status = "Active"
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
}, },
new new
{ {
Id = new Guid("cdad86aa-8a56-4ff4-b633-9c629057dfef"), Id = new Guid("cdad86aa-8a56-4ff4-b633-9c629057dfef"),
Status = "In Progress", Status = "In Progress"
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
}, },
new new
{ {
Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"),
Status = "On Hold", Status = "On Hold"
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
}, },
new new
{ {
Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"),
Status = "In Active", Status = "In Active"
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
}, },
new new
{ {
Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"),
Status = "Completed", Status = "Completed"
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
}); });
}); });
@ -2517,6 +2507,28 @@ namespace Marco.Pms.DataAccess.Migrations
}); });
modelBuilder.Entity("Marco.Pms.Model.TenantModels.SubscriptionPlan", b => modelBuilder.Entity("Marco.Pms.Model.TenantModels.SubscriptionPlan", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<string>("PlanName")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("SubscriptionPlans");
});
modelBuilder.Entity("Marco.Pms.Model.TenantModels.SubscriptionPlanDetails", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -2531,13 +2543,12 @@ namespace Marco.Pms.DataAccess.Migrations
b.Property<Guid>("CurrencyId") b.Property<Guid>("CurrencyId")
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid>("FeaturesId") b.Property<Guid>("FeaturesId")
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<int>("Frequency")
.HasColumnType("int");
b.Property<bool>("IsActive") b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)"); .HasColumnType("tinyint(1)");
@ -2547,20 +2558,10 @@ namespace Marco.Pms.DataAccess.Migrations
b.Property<double>("MaxUser") b.Property<double>("MaxUser")
.HasColumnType("double"); .HasColumnType("double");
b.Property<string>("PlanName") b.Property<Guid>("PlanId")
.IsRequired() .HasColumnType("char(36)");
.HasColumnType("longtext");
b.Property<double>("PriceHalfYearly") b.Property<double>("Price")
.HasColumnType("double");
b.Property<double>("PriceMonthly")
.HasColumnType("double");
b.Property<double>("PriceQuarterly")
.HasColumnType("double");
b.Property<double>("PriceYearly")
.HasColumnType("double"); .HasColumnType("double");
b.Property<int>("TrialDays") b.Property<int>("TrialDays")
@ -2578,9 +2579,11 @@ namespace Marco.Pms.DataAccess.Migrations
b.HasIndex("CurrencyId"); b.HasIndex("CurrencyId");
b.HasIndex("PlanId");
b.HasIndex("UpdatedById"); b.HasIndex("UpdatedById");
b.ToTable("SubscriptionPlans"); b.ToTable("SubscriptionPlanDetails");
}); });
modelBuilder.Entity("Marco.Pms.Model.TenantModels.TenantSubscriptions", b => modelBuilder.Entity("Marco.Pms.Model.TenantModels.TenantSubscriptions", b =>
@ -2607,9 +2610,15 @@ namespace Marco.Pms.DataAccess.Migrations
b.Property<DateTime>("EndDate") b.Property<DateTime>("EndDate")
.HasColumnType("datetime(6)"); .HasColumnType("datetime(6)");
b.Property<bool>("IsCancelled")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsTrial") b.Property<bool>("IsTrial")
.HasColumnType("tinyint(1)"); .HasColumnType("tinyint(1)");
b.Property<double>("MaxUsers")
.HasColumnType("double");
b.Property<DateTime>("NextBillingDate") b.Property<DateTime>("NextBillingDate")
.HasColumnType("datetime(6)"); .HasColumnType("datetime(6)");
@ -3531,17 +3540,6 @@ namespace Marco.Pms.DataAccess.Migrations
b.Navigation("Module"); b.Navigation("Module");
}); });
modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b =>
{
b.HasOne("Marco.Pms.Model.TenantModel.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b =>
{ {
b.HasOne("Marco.Pms.Model.TenantModel.Tenant", "Tenant") b.HasOne("Marco.Pms.Model.TenantModel.Tenant", "Tenant")
@ -3729,7 +3727,7 @@ namespace Marco.Pms.DataAccess.Migrations
b.Navigation("TenantStatus"); b.Navigation("TenantStatus");
}); });
modelBuilder.Entity("Marco.Pms.Model.TenantModels.SubscriptionPlan", b => modelBuilder.Entity("Marco.Pms.Model.TenantModels.SubscriptionPlanDetails", b =>
{ {
b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy")
.WithMany() .WithMany()
@ -3743,6 +3741,12 @@ namespace Marco.Pms.DataAccess.Migrations
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("Marco.Pms.Model.TenantModels.SubscriptionPlan", "Plan")
.WithMany()
.HasForeignKey("PlanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.Employees.Employee", "UpdatedBy") b.HasOne("Marco.Pms.Model.Employees.Employee", "UpdatedBy")
.WithMany() .WithMany()
.HasForeignKey("UpdatedById"); .HasForeignKey("UpdatedById");
@ -3751,6 +3755,8 @@ namespace Marco.Pms.DataAccess.Migrations
b.Navigation("Currency"); b.Navigation("Currency");
b.Navigation("Plan");
b.Navigation("UpdatedBy"); b.Navigation("UpdatedBy");
}); });
@ -3768,7 +3774,7 @@ namespace Marco.Pms.DataAccess.Migrations
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("Marco.Pms.Model.TenantModels.SubscriptionPlan", "Plan") b.HasOne("Marco.Pms.Model.TenantModels.SubscriptionPlanDetails", "Plan")
.WithMany() .WithMany()
.HasForeignKey("PlanId") .HasForeignKey("PlanId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)

View File

@ -7,7 +7,7 @@ namespace Marco.Pms.Model.Dtos.Tenant
public Guid TenantId { get; set; } public Guid TenantId { get; set; }
public Guid PlanId { get; set; } public Guid PlanId { get; set; }
public Guid CurrencyId { get; set; } public Guid CurrencyId { get; set; }
public int MaxUsers { get; set; } public double MaxUsers { get; set; }
public PLAN_FREQUENCY Frequency { get; set; } public PLAN_FREQUENCY Frequency { get; set; }
public bool IsTrial { get; set; } = false; public bool IsTrial { get; set; } = false;
public bool AutoRenew { get; set; } = true; public bool AutoRenew { get; set; } = true;

View File

@ -3,6 +3,7 @@
public class AttendanceDetailsDto public class AttendanceDetailsDto
{ {
public List<Guid>? FeatureId { get; set; } public List<Guid>? FeatureId { get; set; }
public string Name { get; set; } = "Attendance Management";
public bool Enabled { get; set; } = false; public bool Enabled { get; set; } = false;
public bool ManualEntry { get; set; } = true; public bool ManualEntry { get; set; } = true;
public bool LocationTracking { get; set; } = true; public bool LocationTracking { get; set; } = true;

View File

@ -3,6 +3,7 @@
public class DirectoryDetailsDto public class DirectoryDetailsDto
{ {
public List<Guid>? FeatureId { get; set; } public List<Guid>? FeatureId { get; set; }
public string Name { get; set; } = "Directory Management";
public bool Enabled { get; set; } = false; public bool Enabled { get; set; } = false;
public int BucketLimit { get; set; } = 25; public int BucketLimit { get; set; } = 25;
public bool OrganizationChart { get; set; } = false; public bool OrganizationChart { get; set; } = false;

View File

@ -3,6 +3,7 @@
public class ExpenseModuleDetailsDto public class ExpenseModuleDetailsDto
{ {
public List<Guid>? FeatureId { get; set; } public List<Guid>? FeatureId { get; set; }
public string Name { get; set; } = "Expense Management";
public bool Enabled { get; set; } = false; public bool Enabled { get; set; } = false;
} }
} }

View File

@ -3,9 +3,10 @@
public class ProjectManagementDetailsDto public class ProjectManagementDetailsDto
{ {
public List<Guid>? FeatureId { get; set; } public List<Guid>? FeatureId { get; set; }
public string Name { get; set; } = "Project Management";
public bool Enabled { get; set; } = false; public bool Enabled { get; set; } = false;
public int MaxProject { get; set; } = 10; public int MaxProject { get; set; } = 10;
public double MaxTaskPerProject { get; set; } = 100000000; public double MaxTaskPerProject { get; set; } = 100000;
public bool GanttChart { get; set; } = false; public bool GanttChart { get; set; } = false;
public bool ResourceAllocation { get; set; } = false; public bool ResourceAllocation { get; set; } = false;
} }

View File

@ -0,0 +1,13 @@
namespace Marco.Pms.Model.Dtos.Tenant
{
public class SubscriptionPlanDetailsDto
{
public Guid? Id { get; set; }
public double Price { get; set; }
public required int TrialDays { get; set; }
public required double MaxUser { get; set; }
public double MaxStorage { get; set; }
public required FeatureDetailsDto Features { get; set; }
public Guid CurrencyId { get; set; }
}
}

View File

@ -5,15 +5,9 @@
public Guid? Id { get; set; } public Guid? Id { get; set; }
public required string PlanName { get; set; } public required string PlanName { get; set; }
public required string Description { get; set; } public required string Description { get; set; }
public double PriceQuarterly { get; set; } public SubscriptionPlanDetailsDto? MonthlyPlan { get; set; }
public double PriceMonthly { get; set; } public SubscriptionPlanDetailsDto? QuarterlyPlan { get; set; }
public double PriceHalfYearly { get; set; } public SubscriptionPlanDetailsDto? HalfYearlyPlan { get; set; }
public double PriceYearly { get; set; } public SubscriptionPlanDetailsDto? YearlyPlan { get; set; }
public required int TrialDays { get; set; }
public required double MaxUser { get; set; }
public double MaxStorage { get; set; }
public required FeatureDetailsDto Features { get; set; }
public Guid CurrencyId { get; set; }
} }
} }

View File

@ -0,0 +1,13 @@
using Marco.Pms.Model.TenantModels;
namespace Marco.Pms.Model.Dtos.Tenant
{
public class UpdateSubscriptionDto
{
public Guid TenantId { get; set; }
public Guid PlanId { get; set; }
public Guid CurrencyId { get; set; }
public double? MaxUsers { get; set; }
public PLAN_FREQUENCY Frequency { get; set; }
}
}

View File

@ -1,8 +1,6 @@
using Marco.Pms.Model.Utilities; namespace Marco.Pms.Model.Master
namespace Marco.Pms.Model.Master
{ {
public class StatusMaster : TenantRelation public class StatusMaster
{ {
public Guid Id { get; set; } public Guid Id { get; set; }
public string? Status { get; set; } public string? Status { get; set; }

View File

@ -8,6 +8,7 @@ namespace Marco.Pms.Model.TenantModels.MongoDBModel
[BsonId] [BsonId]
[BsonRepresentation(BsonType.String)] [BsonRepresentation(BsonType.String)]
public Guid Id { get; set; } = Guid.NewGuid(); public Guid Id { get; set; } = Guid.NewGuid();
public string? Name { get; set; }
[BsonRepresentation(BsonType.String)] [BsonRepresentation(BsonType.String)]
public List<Guid> FeatureId { get; set; } = new List<Guid>(); public List<Guid> FeatureId { get; set; } = new List<Guid>();

View File

@ -8,6 +8,7 @@ namespace Marco.Pms.Model.TenantModels.MongoDBModel
[BsonId] [BsonId]
[BsonRepresentation(BsonType.String)] [BsonRepresentation(BsonType.String)]
public Guid Id { get; set; } = Guid.NewGuid(); public Guid Id { get; set; } = Guid.NewGuid();
public string? Name { get; set; }
[BsonRepresentation(BsonType.String)] [BsonRepresentation(BsonType.String)]
public List<Guid> FeatureId { get; set; } = new List<Guid>(); public List<Guid> FeatureId { get; set; } = new List<Guid>();

View File

@ -8,6 +8,7 @@ namespace Marco.Pms.Model.TenantModels.MongoDBModel
[BsonId] [BsonId]
[BsonRepresentation(BsonType.String)] [BsonRepresentation(BsonType.String)]
public Guid Id { get; set; } = Guid.NewGuid(); public Guid Id { get; set; } = Guid.NewGuid();
public string? Name { get; set; }
[BsonRepresentation(BsonType.String)] [BsonRepresentation(BsonType.String)]
public List<Guid> FeatureId { get; set; } = new List<Guid>(); public List<Guid> FeatureId { get; set; } = new List<Guid>();

View File

@ -8,6 +8,7 @@ namespace Marco.Pms.Model.TenantModels.MongoDBModel
[BsonId] [BsonId]
[BsonRepresentation(BsonType.String)] [BsonRepresentation(BsonType.String)]
public Guid Id { get; set; } = Guid.NewGuid(); public Guid Id { get; set; } = Guid.NewGuid();
public string? Name { get; set; }
[BsonRepresentation(BsonType.String)] [BsonRepresentation(BsonType.String)]
public List<Guid> FeatureId { get; set; } = new List<Guid>(); public List<Guid> FeatureId { get; set; } = new List<Guid>();

View File

@ -1,40 +1,10 @@
using Marco.Pms.Model.Employees; namespace Marco.Pms.Model.TenantModels
using Marco.Pms.Model.Master;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.TenantModels
{ {
public class SubscriptionPlan public class SubscriptionPlan
{ {
public Guid Id { get; set; } public Guid Id { get; set; }
public string PlanName { get; set; } = string.Empty; public string PlanName { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty; public string Description { get; set; } = string.Empty;
public double PriceQuarterly { get; set; }
public double PriceMonthly { get; set; }
public double PriceHalfYearly { get; set; }
public double PriceYearly { get; set; }
public int TrialDays { get; set; } = 30;
public double MaxUser { get; set; } = 10;
public double MaxStorage { get; set; }
public Guid FeaturesId { get; set; }
public DateTime CreateAt { get; set; }
public DateTime? UpdateAt { get; set; }
public Guid CurrencyId { get; set; }
[ForeignKey("CurrencyId")]
[ValidateNever]
public CurrencyMaster? Currency { get; set; }
public Guid CreatedById { get; set; }
[ForeignKey("CreatedById")]
[ValidateNever]
public Employee? CreatedBy { get; set; }
public Guid? UpdatedById { get; set; }
[ForeignKey("UpdatedById")]
[ValidateNever]
public Employee? UpdatedBy { get; set; }
public bool IsActive { get; set; } = true; public bool IsActive { get; set; } = true;
} }

View File

@ -0,0 +1,41 @@
using Marco.Pms.Model.Employees;
using Marco.Pms.Model.Master;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.TenantModels
{
public class SubscriptionPlanDetails
{
public Guid Id { get; set; }
public double Price { get; set; }
public PLAN_FREQUENCY Frequency { get; set; }
public int TrialDays { get; set; } = 30;
public double MaxUser { get; set; } = 10;
public double MaxStorage { get; set; }
public Guid FeaturesId { get; set; }
public DateTime CreateAt { get; set; }
public DateTime? UpdateAt { get; set; }
public Guid PlanId { get; set; }
[ForeignKey("PlanId")]
[ValidateNever]
public SubscriptionPlan? Plan { get; set; }
public Guid CurrencyId { get; set; }
[ForeignKey("CurrencyId")]
[ValidateNever]
public CurrencyMaster? Currency { get; set; }
public Guid CreatedById { get; set; }
[ForeignKey("CreatedById")]
[ValidateNever]
public Employee? CreatedBy { get; set; }
public Guid? UpdatedById { get; set; }
[ForeignKey("UpdatedById")]
[ValidateNever]
public Employee? UpdatedBy { get; set; }
public bool IsActive { get; set; } = true;
}
}

View File

@ -13,10 +13,11 @@ namespace Marco.Pms.Model.TenantModels
[ForeignKey("PlanId")] [ForeignKey("PlanId")]
[ValidateNever] [ValidateNever]
public SubscriptionPlan? Plan { get; set; } public SubscriptionPlanDetails? Plan { get; set; }
public DateTime StartDate { get; set; } public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; } public DateTime EndDate { get; set; }
public bool IsTrial { get; set; } public bool IsTrial { get; set; }
public double MaxUsers { get; set; }
public Guid StatusId { get; set; } public Guid StatusId { get; set; }
[ForeignKey("StatusId")] [ForeignKey("StatusId")]
@ -30,6 +31,7 @@ namespace Marco.Pms.Model.TenantModels
public DateTime NextBillingDate { get; set; } public DateTime NextBillingDate { get; set; }
public DateTime? CancellationDate { get; set; } public DateTime? CancellationDate { get; set; }
public bool AutoRenew { get; set; } = true; public bool AutoRenew { get; set; } = true;
public bool IsCancelled { get; set; } = false;
public DateTime CreatedAt { get; set; } public DateTime CreatedAt { get; set; }
public DateTime? UpdateAt { get; set; } public DateTime? UpdateAt { get; set; }
public Guid CreatedById { get; set; } public Guid CreatedById { get; set; }

View File

@ -1,4 +1,5 @@
using Marco.Pms.Model.Master; using Marco.Pms.Model.Master;
using Marco.Pms.Model.TenantModels;
using Marco.Pms.Model.TenantModels.MongoDBModel; using Marco.Pms.Model.TenantModels.MongoDBModel;
namespace Marco.Pms.Model.ViewModels.Tenant namespace Marco.Pms.Model.ViewModels.Tenant
@ -9,6 +10,7 @@ namespace Marco.Pms.Model.ViewModels.Tenant
public string? PlanName { get; set; } public string? PlanName { get; set; }
public string? Description { get; set; } public string? Description { get; set; }
public double? Price { get; set; } public double? Price { get; set; }
public PLAN_FREQUENCY? Frequency { get; set; }
public int TrialDays { get; set; } public int TrialDays { get; set; }
public double MaxUser { get; set; } public double MaxUser { get; set; }
public double MaxStorage { get; set; } public double MaxStorage { get; set; }

View File

@ -0,0 +1,33 @@
using Marco.Pms.Model.Master;
using Marco.Pms.Model.ViewModels.Activities;
namespace Marco.Pms.Model.ViewModels.Tenant
{
public class TenantDetailsVM
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public string? Description { get; set; }
public string? DomainName { get; set; }
public string ContactName { get; set; } = string.Empty;
public string ContactNumber { get; set; } = string.Empty;
public string? OfficeNumber { get; set; }
public string BillingAddress { get; set; } = string.Empty;
public string? TaxId { get; set; }
public string? logoImage { get; set; } // Base64
public DateTime OnBoardingDate { get; set; }
public string? OrganizationSize { get; set; }
public Industry? Industry { get; set; }
public TenantStatus? TenantStatus { get; set; }
public string Reference { get; set; } = string.Empty;
public bool IsActive { get; set; } = true;
public bool IsSuperTenant { get; set; } = false;
public int ActiveEmployees { get; set; }
public int InActiveEmployees { get; set; }
public object? Projects { get; set; }
public DateTime? ExpiryDate { get; set; }
public DateTime? NextBillingDate { get; set; }
public BasicEmployeeVM? CreatedBy { get; set; }
}
}

File diff suppressed because it is too large Load Diff

View File

@ -19,9 +19,11 @@ namespace Marco.Pms.Services.MappingProfiles
{ {
public MappingProfile() public MappingProfile()
{ {
#region ======================================================= Employees ======================================================= #region ======================================================= Tenant =======================================================
CreateMap<Tenant, TenantVM>(); CreateMap<Tenant, TenantVM>();
CreateMap<Tenant, TenantListVM>(); CreateMap<Tenant, TenantListVM>();
CreateMap<Tenant, TenantDetailsVM>();
CreateMap<CreateTenantDto, Tenant>() CreateMap<CreateTenantDto, Tenant>()
.ForMember( .ForMember(
dest => dest.ContactName, dest => dest.ContactName,
@ -32,9 +34,18 @@ namespace Marco.Pms.Services.MappingProfiles
opt => opt.MapFrom(src => src.OrganizationName) opt => opt.MapFrom(src => src.OrganizationName)
); );
CreateMap<SubscriptionPlan, SubscriptionPlanVM>(); CreateMap<SubscriptionPlanDetails, SubscriptionPlanVM>()
CreateMap<SubscriptionPlan, SubscriptionPlanDetailsVM>(); .ForMember(
dest => dest.PlanName,
opt => opt.MapFrom(src => src.Plan != null ? src.Plan.PlanName : "")
)
.ForMember(
dest => dest.Description,
opt => opt.MapFrom(src => src.Plan != null ? src.Plan.Description : "")
);
CreateMap<SubscriptionPlanDetailsDto, SubscriptionPlanDetails>();
CreateMap<SubscriptionPlanDto, SubscriptionPlan>(); CreateMap<SubscriptionPlanDto, SubscriptionPlan>();
CreateMap<FeatureDetailsDto, FeatureDetails>(); CreateMap<FeatureDetailsDto, FeatureDetails>();
CreateMap<SubscriptionCheckListDto, SubscriptionCheckList>(); CreateMap<SubscriptionCheckListDto, SubscriptionCheckList>();
CreateMap<SupportDetailsDto, SupportDetails>(); CreateMap<SupportDetailsDto, SupportDetails>();

View File

@ -81,12 +81,10 @@ string? connString = builder.Configuration.GetConnectionString("DefaultConnectio
// This single call correctly registers BOTH the DbContext (scoped) AND the IDbContextFactory (singleton). // This single call correctly registers BOTH the DbContext (scoped) AND the IDbContextFactory (singleton).
builder.Services.AddDbContextFactory<ApplicationDbContext>(options => builder.Services.AddDbContextFactory<ApplicationDbContext>(options =>
options.UseMySql(connString, ServerVersion.AutoDetect(connString)) options.UseMySql(connString, ServerVersion.AutoDetect(connString)));
.EnableSensitiveDataLogging());
builder.Services.AddDbContext<ApplicationDbContext>(options => builder.Services.AddDbContext<ApplicationDbContext>(options =>
options.UseMySql(connString, ServerVersion.AutoDetect(connString)) options.UseMySql(connString, ServerVersion.AutoDetect(connString)));
.EnableSensitiveDataLogging());
builder.Services.AddIdentity<ApplicationUser, IdentityRole>() builder.Services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>() .AddEntityFrameworkStores<ApplicationDbContext>()

View File

@ -228,10 +228,6 @@ namespace Marco.Pms.Services.Service
else else
{ {
projectVM = _mapper.Map<ProjectVM>(projectDetails); projectVM = _mapper.Map<ProjectVM>(projectDetails);
if (projectVM.ProjectStatus != null)
{
projectVM.ProjectStatus.TenantId = tenantId;
}
} }
if (projectVM == null) if (projectVM == null)

View File

@ -49,6 +49,6 @@
"MongoDB": { "MongoDB": {
"SerilogDatabaseUrl": "mongodb://localhost:27017/DotNetLogs", "SerilogDatabaseUrl": "mongodb://localhost:27017/DotNetLogs",
"ConnectionString": "mongodb://localhost:27017/MarcoBMS_Caches?socketTimeoutMS=500&serverSelectionTimeoutMS=500&connectTimeoutMS=500", "ConnectionString": "mongodb://localhost:27017/MarcoBMS_Caches?socketTimeoutMS=500&serverSelectionTimeoutMS=500&connectTimeoutMS=500",
"ModificationConnectionString": "mongodb://localhost:27017/ModificationLog?socketTimeoutMS=500&serverSelectionTimeoutMS=500&connectTimeoutMS=500" "ModificationConnectionString": "mongodb://devuser:DevPass123@147.93.98.152:27017/MarcoBMSLocalDev?authSource=admin&socketTimeoutMS=500&serverSelectionTimeoutMS=500&connectTimeoutMS=500"
} }
} }