created model, DTO,(Data Transfer Object) VM(View Model) for Work Category master table and added migration for adding table to database and seeding system-defined categoryies in table for first tenant
This commit is contained in:
parent
d95f61cba9
commit
7a3d0c8c60
@ -6,8 +6,9 @@ using Marco.Pms.Model.DocumentManager;
|
|||||||
using Marco.Pms.Model.Employees;
|
using Marco.Pms.Model.Employees;
|
||||||
using Marco.Pms.Model.Entitlements;
|
using Marco.Pms.Model.Entitlements;
|
||||||
using Marco.Pms.Model.Forum;
|
using Marco.Pms.Model.Forum;
|
||||||
using Marco.Pms.Model.Industries;
|
using Marco.Pms.Model.Master;
|
||||||
using Marco.Pms.Model.Projects;
|
using Marco.Pms.Model.Projects;
|
||||||
|
using Marco.Pms.Model.Roles;
|
||||||
using Marco.Pms.Model.Utilities;
|
using Marco.Pms.Model.Utilities;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
@ -87,6 +88,7 @@ namespace Marco.Pms.DataAccess.Data
|
|||||||
public DbSet<TicketTagMaster> TicketTagMasters { get; set; }
|
public DbSet<TicketTagMaster> TicketTagMasters { get; set; }
|
||||||
public DbSet<Document> Documents { get; set; }
|
public DbSet<Document> Documents { get; set; }
|
||||||
public DbSet<TicketTag> TicketTags { get; set; }
|
public DbSet<TicketTag> TicketTags { get; set; }
|
||||||
|
public DbSet<WorkCategoryMaster> WorkCategoryMasters { get; set; }
|
||||||
|
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
@ -402,6 +404,33 @@ namespace Marco.Pms.DataAccess.Data
|
|||||||
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
|
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
modelBuilder.Entity<WorkCategoryMaster>().HasData(
|
||||||
|
new WorkCategoryMaster
|
||||||
|
{
|
||||||
|
Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"),
|
||||||
|
Name = "Fresh Work",
|
||||||
|
Description = "Created new task in a professional or creative context",
|
||||||
|
IsSystem = true,
|
||||||
|
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
|
||||||
|
},
|
||||||
|
new WorkCategoryMaster
|
||||||
|
{
|
||||||
|
Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"),
|
||||||
|
Name = "Rework",
|
||||||
|
Description = "Revising, modifying, or correcting a task to improve its quality or fix issues",
|
||||||
|
IsSystem = true,
|
||||||
|
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
|
||||||
|
},
|
||||||
|
new WorkCategoryMaster
|
||||||
|
{
|
||||||
|
Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"),
|
||||||
|
Name = "Quality Issue",
|
||||||
|
Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.",
|
||||||
|
IsSystem = true,
|
||||||
|
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ManageApplicationStructure(ModelBuilder modelBuilder)
|
private static void ManageApplicationStructure(ModelBuilder modelBuilder)
|
||||||
|
2500
Marco.Pms.DataAccess/Migrations/20250510074238_Added_WorkCategory_Master_Table.Designer.cs
generated
Normal file
2500
Marco.Pms.DataAccess/Migrations/20250510074238_Added_WorkCategory_Master_Table.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,63 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||||
|
|
||||||
|
namespace Marco.Pms.DataAccess.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Added_WorkCategory_Master_Table : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "WorkCategoryMasters",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
IsSystem = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||||
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_WorkCategoryMasters", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_WorkCategoryMasters_Tenants_TenantId",
|
||||||
|
column: x => x.TenantId,
|
||||||
|
principalTable: "Tenants",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "WorkCategoryMasters",
|
||||||
|
columns: new[] { "Id", "Description", "IsSystem", "Name", "TenantId" },
|
||||||
|
values: new object[,]
|
||||||
|
{
|
||||||
|
{ new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", true, "Quality Issue", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||||
|
{ new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), "Created new task in a professional or creative context", true, "Fresh Work", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||||
|
{ new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), "Revising, modifying, or correcting a task to improve its quality or fix issues", true, "Rework", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_WorkCategoryMasters_TenantId",
|
||||||
|
table: "WorkCategoryMasters",
|
||||||
|
column: "TenantId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "WorkCategoryMasters");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
9
Marco.Pms.Model/Dtos/Master/WorkCategoryMasterDto.cs
Normal file
9
Marco.Pms.Model/Dtos/Master/WorkCategoryMasterDto.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace Marco.Pms.Model.Dtos.Master
|
||||||
|
{
|
||||||
|
public class WorkCategoryMasterDto
|
||||||
|
{
|
||||||
|
public Guid? Id { get; set; }
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
public string? Description { get; set; }
|
||||||
|
}
|
||||||
|
}
|
31
Marco.Pms.Model/Mapper/MasterMapper.cs
Normal file
31
Marco.Pms.Model/Mapper/MasterMapper.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using Marco.Pms.Model.Dtos.Master;
|
||||||
|
using Marco.Pms.Model.Master;
|
||||||
|
using Marco.Pms.Model.ViewModels.Master;
|
||||||
|
|
||||||
|
namespace Marco.Pms.Model.Mapper
|
||||||
|
{
|
||||||
|
public static class MasterMapper
|
||||||
|
{
|
||||||
|
// -------------------------------- Work Category --------------------------------
|
||||||
|
public static WorkCategoryMaster ToWorkCategoryMasterFromWorkCategoryMasterDto(this WorkCategoryMasterDto categoryMasterDto, Guid tenantId)
|
||||||
|
{
|
||||||
|
return new WorkCategoryMaster
|
||||||
|
{
|
||||||
|
Id = categoryMasterDto.Id ?? Guid.Empty,
|
||||||
|
Name = categoryMasterDto.Name,
|
||||||
|
Description = categoryMasterDto.Description ?? "",
|
||||||
|
TenantId = tenantId
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public static WorkCategoryMasterVM ToWorkCategoryMasterVMFromWorkCategoryMaster(this WorkCategoryMaster categoryMaster)
|
||||||
|
{
|
||||||
|
return new WorkCategoryMasterVM
|
||||||
|
{
|
||||||
|
Id = categoryMaster.Id,
|
||||||
|
Name = categoryMaster.Name,
|
||||||
|
Description = categoryMaster.Description ?? "",
|
||||||
|
IsSystem = categoryMaster.IsSystem
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
12
Marco.Pms.Model/Master/WorkCategoryMaster.cs
Normal file
12
Marco.Pms.Model/Master/WorkCategoryMaster.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using Marco.Pms.Model.Utilities;
|
||||||
|
|
||||||
|
namespace Marco.Pms.Model.Master
|
||||||
|
{
|
||||||
|
public class WorkCategoryMaster : TenantRelation
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
public string Description { get; set; } = string.Empty;
|
||||||
|
public bool IsSystem { get; set; } = false;
|
||||||
|
}
|
||||||
|
}
|
11
Marco.Pms.Model/ViewModels/Master/WorkCategoryMasterVM.cs
Normal file
11
Marco.Pms.Model/ViewModels/Master/WorkCategoryMasterVM.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
namespace Marco.Pms.Model.ViewModels.Master
|
||||||
|
{
|
||||||
|
public class WorkCategoryMasterVM
|
||||||
|
{
|
||||||
|
public Guid? Id { get; set; }
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
public string? Description { get; set; }
|
||||||
|
public bool IsSystem { get; set; }
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user