From 43875b9af8d6e360a2b77d75e4d34621773fbcf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96ZT=C3=9CRK?= <76204082+iamsedatozturk@users.noreply.github.com> Date: Thu, 27 Nov 2025 09:34:20 +0300 Subject: [PATCH] Project List --- .../Seeds/ListFormSeeder_Project.cs | 19 +- .../Seeds/MenusData.json | 132 ++++--------- .../Enums/TableNameEnum.cs | 2 +- .../TableNameResolver.cs | 2 +- .../Erp.Platform.Domain/Data/SeedConsts.cs | 2 +- .../Tenant/{RD => Project}/Project.cs | 4 +- .../Tenant/{RD => Project}/ProjectStatus.cs | 0 .../Tenant/{RD => Project}/ProjectType.cs | 0 .../EntityFrameworkCore/PlatformDbContext.cs | 2 +- ....cs => 20251127061452_Initial.Designer.cs} | 22 ++- ...0_Initial.cs => 20251127061452_Initial.cs} | 180 ++++++++++-------- .../PlatformDbContextModelSnapshot.cs | 20 +- .../Tenants/Seeds/TenantData.json | 95 +++++++-- .../Tenants/TenantDataSeeder.cs | 38 +++- .../Tenants/TenantSeederDto.cs | 26 +++ 15 files changed, 333 insertions(+), 211 deletions(-) rename api/src/Erp.Platform.Domain/Entities/Tenant/{RD => Project}/Project.cs (92%) rename api/src/Erp.Platform.Domain/Entities/Tenant/{RD => Project}/ProjectStatus.cs (100%) rename api/src/Erp.Platform.Domain/Entities/Tenant/{RD => Project}/ProjectType.cs (100%) rename api/src/Erp.Platform.EntityFrameworkCore/Migrations/{20251126210300_Initial.Designer.cs => 20251127061452_Initial.Designer.cs} (99%) rename api/src/Erp.Platform.EntityFrameworkCore/Migrations/{20251126210300_Initial.cs => 20251127061452_Initial.cs} (99%) diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Project.cs b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Project.cs index 3b4e6575..3b5e0d2c 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Project.cs +++ b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Project.cs @@ -312,7 +312,7 @@ public class ListFormSeeder_Project : IDataSeedContributor, ITransientDependency IsOrganizationUnit = false, Description = listFormName, SelectCommandType = SelectCommandTypeEnum.Table, - SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.ProjectStatus)), + SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Projects)), KeyFieldName = "Id", KeyFieldDbSourceType = DbType.Guid, DefaultFilter = DefaultFilterJson, @@ -324,10 +324,10 @@ public class ListFormSeeder_Project : IDataSeedContributor, ITransientDependency SelectionJson = DefaultSelectionSingleJson, ColumnOptionJson = DefaultColumnOptionJson, PermissionJson = DefaultPermissionJson(listFormName), - DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.ProjectStatus)), + DeleteCommand = DefaultDeleteCommand(nameof(TableNameEnum.Projects)), DeleteFieldsDefaultValueJson = DefaultDeleteFieldsDefaultValueJson, PagerOptionJson = DefaultPagerOptionJson, - EditingOptionJson = DefaultEditingOptionJson(listFormName, 900, 700, true, true, true, true, false), + EditingOptionJson = DefaultEditingOptionJson(listFormName, 900, 550, true, true, true, true, false), InsertFieldsDefaultValueJson = DefaultInsertFieldsDefaultValueJson, EditingFormJson = JsonSerializer.Serialize(new List() { @@ -348,7 +348,7 @@ public class ListFormSeeder_Project : IDataSeedContributor, ITransientDependency new EditingFormItemDto { Order = 1, DataField="StartDate", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, new EditingFormItemDto { Order = 2, DataField="EndDate", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxDateBox }, new EditingFormItemDto { Order = 3, DataField="Budget", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat }, - new EditingFormItemDto { Order = 4, DataField="Currency", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 4, DataField="Currency", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox }, ]}, new() { Order=3, ColCount=2, ColSpan=1, Caption="Actual", ItemType="group", Items = @@ -363,6 +363,11 @@ public class ListFormSeeder_Project : IDataSeedContributor, ITransientDependency ]} }), FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { + new() { FieldName = "StartDate", FieldDbType = DbType.DateTime , Value = "@DATE", CustomValueType = FieldCustomValueTypeEnum.CustomKey }, + new() { FieldName = "Progress", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Currency", FieldDbType = DbType.String, Value = "TRY", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "Budget", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, + new() { FieldName = "ActualCost", FieldDbType = DbType.Decimal, Value = "0", CustomValueType = FieldCustomValueTypeEnum.Value }, new() { FieldName = "IsActive", FieldDbType = DbType.Boolean, Value = "true", CustomValueType = FieldCustomValueTypeEnum.Value } }), } @@ -464,7 +469,7 @@ public class ListFormSeeder_Project : IDataSeedContributor, ITransientDependency IsActive = true, IsDeleted = false, AllowSearch = true, - LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Employee), "Id", "Name"), + LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Employee), "Id", "FullName"), ValidationRuleJson = DefaultValidationRuleRequiredJson, ColumnCustomizationJson = DefaultColumnCustomizationJson, PermissionJson = DefaultFieldPermissionJson(listForm.Name), @@ -591,7 +596,6 @@ public class ListFormSeeder_Project : IDataSeedContributor, ITransientDependency IsActive = true, IsDeleted = false, AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, ColumnCustomizationJson = DefaultColumnCustomizationJson, PermissionJson = DefaultFieldPermissionJson(listForm.Name), PivotSettingsJson = DefaultPivotSettingsJson @@ -607,7 +611,6 @@ public class ListFormSeeder_Project : IDataSeedContributor, ITransientDependency IsActive = true, IsDeleted = false, AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, ColumnCustomizationJson = DefaultColumnCustomizationJson, PermissionJson = DefaultFieldPermissionJson(listForm.Name), PivotSettingsJson = DefaultPivotSettingsJson @@ -625,7 +628,6 @@ public class ListFormSeeder_Project : IDataSeedContributor, ITransientDependency IsActive = true, IsDeleted = false, AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, ColumnCustomizationJson = DefaultColumnCustomizationJson, PermissionJson = DefaultFieldPermissionJson(listForm.Name), PivotSettingsJson = DefaultPivotSettingsJson @@ -648,7 +650,6 @@ public class ListFormSeeder_Project : IDataSeedContributor, ITransientDependency ValueExpr = "Key", LookupQuery = LookupQueryValues.CustomerValues, }), - ValidationRuleJson = DefaultValidationRuleRequiredJson, ColumnCustomizationJson = DefaultColumnCustomizationJson, PermissionJson = DefaultFieldPermissionJson(listForm.Name), PivotSettingsJson = DefaultPivotSettingsJson diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json b/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json index 7199b199..00144530 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json @@ -152,18 +152,14 @@ "path": "/admin/menuManager", "componentPath": "@/views/menu/MenuManager", "routeType": "protected", - "authority": [ - "App.Menus.Manager" - ] + "authority": ["App.Menus.Manager"] }, { "key": "admin.listFormManagement.wizard", "path": "/admin/listform/wizard", "componentPath": "@/views/admin/listForm/Wizard", "routeType": "protected", - "authority": [ - "App.Listforms.Wizard" - ] + "authority": ["App.Listforms.Wizard"] }, { "key": "admin.listFormManagement.edit", @@ -177,18 +173,14 @@ "path": "/admin/forumManagement", "componentPath": "@/views/forum/Management", "routeType": "protected", - "authority": [ - "App.ForumManagement" - ] + "authority": ["App.ForumManagement"] }, { "key": "admin.ai", "path": "/admin/ai", "componentPath": "@/views/ai/Assistant", "routeType": "protected", - "authority": [ - "Abp.Identity.Ai" - ] + "authority": ["Abp.Identity.Ai"] }, { "key": "admin.profile.general", @@ -230,36 +222,28 @@ "path": "/admin/settings", "componentPath": "@/views/settings/Settings", "routeType": "protected", - "authority": [ - "App.Setting" - ] + "authority": ["App.Setting"] }, { "key": "admin.identity.user.detail", "path": "/admin/users/detail/:userId", "componentPath": "@/views/admin/user-management/Details", "routeType": "protected", - "authority": [ - "AbpIdentity.Users.Update" - ] + "authority": ["AbpIdentity.Users.Update"] }, { "key": "admin.identity.ous", "path": "/admin/ous", "componentPath": "@/views/admin/organization-unit/OrganizationUnits", "routeType": "protected", - "authority": [ - "Abp.Identity.OrganizationUnits" - ] + "authority": ["Abp.Identity.OrganizationUnits"] }, { "key": "admin.forum", "path": "/admin/forum", "componentPath": "@/views/forum/Forum", "routeType": "protected", - "authority": [ - "App.ForumManagement.Publish" - ] + "authority": ["App.ForumManagement.Publish"] }, { "key": "admin.list", @@ -301,216 +285,168 @@ "path": "/admin/developerkit", "componentPath": "@/views/developerKit/DashboardPage", "routeType": "protected", - "authority": [ - "App.DeveloperKit" - ] + "authority": ["App.DeveloperKit"] }, { "key": "admin.developerkit.entities", "path": "/admin/developerkit/entities", "componentPath": "@/views/developerKit/EntityPage", "routeType": "protected", - "authority": [ - "App.DeveloperKit.Entity" - ] + "authority": ["App.DeveloperKit.Entity"] }, { "key": "admin.developerkit.entities.new", "path": "/admin/developerkit/entities/new", "componentPath": "@/views/developerKit/EntityDetailPage", "routeType": "protected", - "authority": [ - "App.DeveloperKit.Entity" - ] + "authority": ["App.DeveloperKit.Entity"] }, { "key": "admin.developerkit.entities.edit", "path": "/admin/developerkit/entities/edit/:id", "componentPath": "@/views/developerKit/EntityDetailPage", "routeType": "protected", - "authority": [ - "App.DeveloperKit.Entity" - ] + "authority": ["App.DeveloperKit.Entity"] }, { "key": "admin.developerkit.migrations", "path": "/admin/developerkit/migrations", "componentPath": "@/views/developerKit/MigrationPage", "routeType": "protected", - "authority": [ - "App.DeveloperKit.Migrations" - ] + "authority": ["App.DeveloperKit.Migrations"] }, { "key": "admin.developerkit.endpoints", "path": "/admin/developerkit/endpoints", "componentPath": "@/views/developerKit/CrudEndpointPage", "routeType": "protected", - "authority": [ - "App.DeveloperKit.CrudEndpoints" - ] + "authority": ["App.DeveloperKit.CrudEndpoints"] }, { "key": "admin.developerkit.dynamic-services", "path": "/admin/developerkit/dynamic-services", "componentPath": "@/views/developerKit/DynamicServicePage", "routeType": "protected", - "authority": [ - "App.DeveloperKit.DynamicServices" - ] + "authority": ["App.DeveloperKit.DynamicServices"] }, { "key": "admin.developerkit.components", "path": "/admin/developerkit/components", "componentPath": "@/views/developerKit/ComponentPage", "routeType": "protected", - "authority": [ - "App.DeveloperKit.Components" - ] + "authority": ["App.DeveloperKit.Components"] }, { "key": "admin.developerkit.components.new", "path": "/admin/developerkit/components/new", "componentPath": "@/views/developerKit/ComponentDetailPage", "routeType": "protected", - "authority": [ - "App.DeveloperKit.Components" - ] + "authority": ["App.DeveloperKit.Components"] }, { "key": "admin.developerkit.components.view", "path": "/admin/developerkit/components/view/:id", "componentPath": "@/views/developerKit/ComponentDetailPage", "routeType": "protected", - "authority": [ - "App.DeveloperKit.Components" - ] + "authority": ["App.DeveloperKit.Components"] }, { "key": "admin.developerkit.components.edit", "path": "/admin/developerkit/components/edit/:id", "componentPath": "@/views/developerKit/CodePage", "routeType": "protected", - "authority": [ - "App.DeveloperKit.Components" - ] + "authority": ["App.DeveloperKit.Components"] }, { "key": "admin.reportManagement", "path": "/admin/reports/management", "componentPath": "@/views/report/DashboardPage", "routeType": "protected", - "authority": [ - "App.Reports.Management" - ] + "authority": ["App.Reports.Management"] }, { "key": "admin.reports.view", "path": "/admin/reports/:id", "componentPath": "@/views/report/ReportViewerPage", "routeType": "protected", - "authority": [ - "App.Reports.Categories" - ] + "authority": ["App.Reports.Categories"] }, { "key": "admin.fileManagement", "path": "/admin/files", "componentPath": "@/views/admin/files/FileManager", "routeType": "protected", - "authority": [ - "App.Files" - ] + "authority": ["App.Files"] }, { "key": "admin.coordinator.classroom.dashboard", "path": "/admin/coordinator/classroom/dashboard", "componentPath": "@/views/coordinator/Classroom/Dashboard", "routeType": "protected", - "authority": [ - "App.Coordinator.Classroom.Dashboard" - ] + "authority": ["App.Coordinator.Classroom.Dashboard"] }, { "key": "admin.coordinator.classroom.classes", "path": "/admin/coordinator/classroom/classes", "componentPath": "@/views/coordinator/Classroom/ClassList", "routeType": "protected", - "authority": [ - "App.Coordinator.Classroom.List" - ] + "authority": ["App.Coordinator.Classroom.List"] }, { "key": "admin.coordinator.classroom.classroom", "path": "/admin/coordinator/classroom/room/:id", "componentPath": "@/views/coordinator/Classroom/RoomDetail", "routeType": "protected", - "authority": [ - "App.Coordinator.Classroom.RoomDetail" - ] + "authority": ["App.Coordinator.Classroom.RoomDetail"] }, { "key": "admin.coordinator.classroom.planning", "path": "/admin/coordinator/classroom/planning/:id", "componentPath": "@/views/coordinator/Classroom/PlanningPage", "routeType": "protected", - "authority": [ - "App.Coordinator.Classroom.Planning" - ] + "authority": ["App.Coordinator.Classroom.Planning"] }, { "key": "admin.coordinator.exams", "path": "/admin/coordinator/exams", "componentPath": "@/views/coordinator/Exams", "routeType": "protected", - "authority": [ - "App.Coordinator.Exams" - ] + "authority": ["App.Coordinator.Exams"] }, { "key": "admin.coordinator.examDetail", "path": "/admin/coordinator/exam/:id", "componentPath": "@/views/coordinator/ExamInterface/ExamInterface", "routeType": "protected", - "authority": [ - "App.Coordinator.Exams" - ] + "authority": ["App.Coordinator.Exams"] }, { "key": "admin.coordinator.assignments", "path": "/admin/coordinator/assignments", "componentPath": "@/views/coordinator/Assignments", "routeType": "protected", - "authority": [ - "App.Coordinator.Assignments" - ] + "authority": ["App.Coordinator.Assignments"] }, { "key": "admin.coordinator.assignmentDetail", "path": "/admin/coordinator/assignment/:id", "componentPath": "@/views/coordinator/ExamInterface/ExamInterface", "routeType": "protected", - "authority": [ - "App.Coordinator.Assignments" - ] + "authority": ["App.Coordinator.Assignments"] }, { "key": "admin.coordinator.tests", "path": "/admin/coordinator/tests", "componentPath": "@/views/coordinator/Tests", "routeType": "protected", - "authority": [ - "App.Coordinator.Tests" - ] + "authority": ["App.Coordinator.Tests"] }, { "key": "admin.coordinator.testDetail", "path": "/admin/coordinator/test/:id", "componentPath": "@/views/coordinator/ExamInterface/PDFTestInterface", "routeType": "protected", - "authority": [ - "App.Coordinator.Tests" - ] + "authority": ["App.Coordinator.Tests"] }, { "key": "admin.supplychain.requests", @@ -2663,7 +2599,7 @@ "Code": "App.Project.Projects", "DisplayName": "App.Project.Projects", "Order": 3, - "Url": "/admin/projects", + "Url": "/admin/list/App.Project.Projects", "Icon": "FcTodoList", "RequiredPermissionName": "App.Project.Projects", "IsDisabled": false @@ -3079,4 +3015,4 @@ "IsDisabled": false } ] -} \ No newline at end of file +} diff --git a/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs b/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs index 9ed15b5b..a8c23ad9 100644 --- a/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs +++ b/api/src/Erp.Platform.Domain.Shared/Enums/TableNameEnum.cs @@ -188,7 +188,7 @@ public enum TableNameEnum Bom, BomOperation, BomComponent, - Project, + Projects, ProjectType, ProjectStatus } diff --git a/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs b/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs index 14e89372..13ffb7ac 100644 --- a/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs +++ b/api/src/Erp.Platform.Domain.Shared/TableNameResolver.cs @@ -229,7 +229,7 @@ public static class TableNameResolver // 🔹 R&D { nameof(TableNameEnum.ProjectType), (TablePrefix.TenantByName, MenuPrefix.Project) }, { nameof(TableNameEnum.ProjectStatus), (TablePrefix.TenantByName, MenuPrefix.Project) }, - { nameof(TableNameEnum.Project), (TablePrefix.TenantByName, MenuPrefix.Project) }, + { nameof(TableNameEnum.Projects), (TablePrefix.TenantByName, MenuPrefix.Project) }, }; public static string GetFullTableName(string tableName) diff --git a/api/src/Erp.Platform.Domain/Data/SeedConsts.cs b/api/src/Erp.Platform.Domain/Data/SeedConsts.cs index f4c9183c..8ac56fda 100644 --- a/api/src/Erp.Platform.Domain/Data/SeedConsts.cs +++ b/api/src/Erp.Platform.Domain/Data/SeedConsts.cs @@ -564,7 +564,7 @@ public static class SeedConsts public const string Default = Prefix.App + ".Project"; public const string ProjectType = Default + ".ProjectType"; public const string ProjectStatus = Default + ".ProjectStatus"; - public const string Projects = Default + ".Project"; + public const string Projects = Default + ".Projects"; } public static class Mrp diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/RD/Project.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Project/Project.cs similarity index 92% rename from api/src/Erp.Platform.Domain/Entities/Tenant/RD/Project.cs rename to api/src/Erp.Platform.Domain/Entities/Tenant/Project/Project.cs index 0532c46d..a7ee6ade 100644 --- a/api/src/Erp.Platform.Domain/Entities/Tenant/RD/Project.cs +++ b/api/src/Erp.Platform.Domain/Entities/Tenant/Project/Project.cs @@ -19,7 +19,8 @@ public class Project : FullAuditedEntity, IMultiTenant public Guid? StatusId { get; set; } //Planlanıyor, Devam Ediyor, Tamamlandı, Beklemede, İptal Edildi public ProjectStatus Status { get; set; } public string Priority { get; set; } //Düşük, Orta, Yüksek, Kritik, Acil - public Guid ManagerId { get; set; } + public Guid? ManagerId { get; set; } + public Employee Manager { get; set; } public DateTime StartDate { get; set; } public DateTime EndDate { get; set; } @@ -27,6 +28,7 @@ public class Project : FullAuditedEntity, IMultiTenant public DateTime? ActualEndDate { get; set; } public Guid? CustomerId { get; set; } + public Partner Customer { get; set; } public decimal Budget { get; set; } public decimal ActualCost { get; set; } diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/RD/ProjectStatus.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Project/ProjectStatus.cs similarity index 100% rename from api/src/Erp.Platform.Domain/Entities/Tenant/RD/ProjectStatus.cs rename to api/src/Erp.Platform.Domain/Entities/Tenant/Project/ProjectStatus.cs diff --git a/api/src/Erp.Platform.Domain/Entities/Tenant/RD/ProjectType.cs b/api/src/Erp.Platform.Domain/Entities/Tenant/Project/ProjectType.cs similarity index 100% rename from api/src/Erp.Platform.Domain/Entities/Tenant/RD/ProjectType.cs rename to api/src/Erp.Platform.Domain/Entities/Tenant/Project/ProjectType.cs diff --git a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index 375ed2dc..68622ef1 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -3228,7 +3228,7 @@ public class PlatformDbContext : builder.Entity(b => { - b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.Project)), Prefix.DbSchema); + b.ToTable(TableNameResolver.GetFullTableName(nameof(TableNameEnum.Projects)), Prefix.DbSchema); b.ConfigureByConvention(); b.Property(x => x.Code).IsRequired().HasMaxLength(100); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251126210300_Initial.Designer.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251127061452_Initial.Designer.cs similarity index 99% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251126210300_Initial.Designer.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251127061452_Initial.Designer.cs index c996efba..4398fb08 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251126210300_Initial.Designer.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251127061452_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Erp.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251126210300_Initial")] + [Migration("20251127061452_Initial")] partial class Initial { /// @@ -9827,7 +9827,7 @@ namespace Erp.Platform.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("LastModifierId"); - b.Property("ManagerId") + b.Property("ManagerId") .HasColumnType("uniqueidentifier"); b.Property("Name") @@ -9860,11 +9860,15 @@ namespace Erp.Platform.Migrations b.HasKey("Id"); + b.HasIndex("CustomerId"); + + b.HasIndex("ManagerId"); + b.HasIndex("ProjectTypeId"); b.HasIndex("StatusId"); - b.ToTable("Prj_T_Project", (string)null); + b.ToTable("Prj_T_Projects", (string)null); }); modelBuilder.Entity("Erp.Platform.Entities.ProjectStatus", b => @@ -17106,6 +17110,14 @@ namespace Erp.Platform.Migrations modelBuilder.Entity("Erp.Platform.Entities.Project", b => { + b.HasOne("Erp.Platform.Entities.Partner", "Customer") + .WithMany() + .HasForeignKey("CustomerId"); + + b.HasOne("Erp.Platform.Entities.Employee", "Manager") + .WithMany() + .HasForeignKey("ManagerId"); + b.HasOne("Erp.Platform.Entities.ProjectType", "ProjectType") .WithMany("Projects") .HasForeignKey("ProjectTypeId") @@ -17118,6 +17130,10 @@ namespace Erp.Platform.Migrations .OnDelete(DeleteBehavior.Restrict) .IsRequired(); + b.Navigation("Customer"); + + b.Navigation("Manager"); + b.Navigation("ProjectType"); b.Navigation("Status"); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251126210300_Initial.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251127061452_Initial.cs similarity index 99% rename from api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251126210300_Initial.cs rename to api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251127061452_Initial.cs index b40aeef9..32c1f422 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251126210300_Initial.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/20251127061452_Initial.cs @@ -3526,54 +3526,6 @@ namespace Erp.Platform.Migrations onDelete: ReferentialAction.Cascade); }); - migrationBuilder.CreateTable( - name: "Prj_T_Project", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - TenantId = table.Column(type: "uniqueidentifier", nullable: true), - Code = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), - Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), - ProjectTypeId = table.Column(type: "uniqueidentifier", nullable: false), - StatusId = table.Column(type: "uniqueidentifier", nullable: false), - Priority = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - ManagerId = table.Column(type: "uniqueidentifier", nullable: false), - StartDate = table.Column(type: "datetime2", nullable: false), - EndDate = table.Column(type: "datetime2", nullable: false), - ActualStartDate = table.Column(type: "datetime2", nullable: true), - ActualEndDate = table.Column(type: "datetime2", nullable: true), - CustomerId = table.Column(type: "uniqueidentifier", nullable: true), - Budget = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), - ActualCost = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), - Currency = table.Column(type: "nvarchar(10)", maxLength: 10, nullable: true), - Progress = table.Column(type: "int", nullable: false, defaultValue: 0), - IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), - CreationTime = table.Column(type: "datetime2", nullable: false), - CreatorId = table.Column(type: "uniqueidentifier", nullable: true), - LastModificationTime = table.Column(type: "datetime2", nullable: true), - LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), - IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), - DeleterId = table.Column(type: "uniqueidentifier", nullable: true), - DeletionTime = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Prj_T_Project", x => x.Id); - table.ForeignKey( - name: "FK_Prj_T_Project_Prj_T_ProjectStatus_StatusId", - column: x => x.StatusId, - principalTable: "Prj_T_ProjectStatus", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Prj_T_Project_Prj_T_ProjectType_ProjectTypeId", - column: x => x.ProjectTypeId, - principalTable: "Prj_T_ProjectType", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - migrationBuilder.CreateTable( name: "Sas_H_Country", columns: table => new @@ -5996,6 +5948,64 @@ namespace Erp.Platform.Migrations onDelete: ReferentialAction.Restrict); }); + migrationBuilder.CreateTable( + name: "Prj_T_Projects", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Code = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + ProjectTypeId = table.Column(type: "uniqueidentifier", nullable: false), + StatusId = table.Column(type: "uniqueidentifier", nullable: false), + Priority = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + ManagerId = table.Column(type: "uniqueidentifier", nullable: true), + StartDate = table.Column(type: "datetime2", nullable: false), + EndDate = table.Column(type: "datetime2", nullable: false), + ActualStartDate = table.Column(type: "datetime2", nullable: true), + ActualEndDate = table.Column(type: "datetime2", nullable: true), + CustomerId = table.Column(type: "uniqueidentifier", nullable: true), + Budget = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + ActualCost = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false, defaultValue: 0m), + Currency = table.Column(type: "nvarchar(10)", maxLength: 10, nullable: true), + Progress = table.Column(type: "int", nullable: false, defaultValue: 0), + IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Prj_T_Projects", x => x.Id); + table.ForeignKey( + name: "FK_Prj_T_Projects_Adm_T_Partner_CustomerId", + column: x => x.CustomerId, + principalTable: "Adm_T_Partner", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Prj_T_Projects_Hr_T_Employee_ManagerId", + column: x => x.ManagerId, + principalTable: "Hr_T_Employee", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Prj_T_Projects_Prj_T_ProjectStatus_StatusId", + column: x => x.StatusId, + principalTable: "Prj_T_ProjectStatus", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Prj_T_Projects_Prj_T_ProjectType_ProjectTypeId", + column: x => x.ProjectTypeId, + principalTable: "Prj_T_ProjectType", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + migrationBuilder.CreateTable( name: "Scp_T_Request", columns: table => new @@ -7655,13 +7665,23 @@ namespace Erp.Platform.Migrations column: "NotificationRuleId"); migrationBuilder.CreateIndex( - name: "IX_Prj_T_Project_ProjectTypeId", - table: "Prj_T_Project", + name: "IX_Prj_T_Projects_CustomerId", + table: "Prj_T_Projects", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_Prj_T_Projects_ManagerId", + table: "Prj_T_Projects", + column: "ManagerId"); + + migrationBuilder.CreateIndex( + name: "IX_Prj_T_Projects_ProjectTypeId", + table: "Prj_T_Projects", column: "ProjectTypeId"); migrationBuilder.CreateIndex( - name: "IX_Prj_T_Project_StatusId", - table: "Prj_T_Project", + name: "IX_Prj_T_Projects_StatusId", + table: "Prj_T_Projects", column: "StatusId"); migrationBuilder.CreateIndex( @@ -8313,7 +8333,7 @@ namespace Erp.Platform.Migrations name: "Plat_H_SettingDefinition"); migrationBuilder.DropTable( - name: "Prj_T_Project"); + name: "Prj_T_Projects"); migrationBuilder.DropTable( name: "Prt_T_Interesting"); @@ -8435,9 +8455,6 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Adm_T_Order"); - migrationBuilder.DropTable( - name: "Adm_T_Partner"); - migrationBuilder.DropTable( name: "Adm_T_SkillType"); @@ -8507,6 +8524,9 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Plat_H_NotificationRule"); + migrationBuilder.DropTable( + name: "Adm_T_Partner"); + migrationBuilder.DropTable( name: "Prj_T_ProjectStatus"); @@ -8549,24 +8569,6 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "AbpAuditLogs"); - migrationBuilder.DropTable( - name: "Crm_T_CustomerSegment"); - - migrationBuilder.DropTable( - name: "Crm_T_CustomerType"); - - migrationBuilder.DropTable( - name: "Sas_T_Sector"); - - migrationBuilder.DropTable( - name: "Scp_T_PaymentTerm"); - - migrationBuilder.DropTable( - name: "Scp_T_SupplyCardType"); - - migrationBuilder.DropTable( - name: "Scp_T_SupplyType"); - migrationBuilder.DropTable( name: "Crd_B_RegistrationType"); @@ -8594,9 +8596,6 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Mrp_T_BomType"); - migrationBuilder.DropTable( - name: "Scp_T_Material"); - migrationBuilder.DropTable( name: "Mrp_T_OperationType"); @@ -8615,6 +8614,27 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Plat_H_BackgroundWorker_MailQueueTableFormat"); + migrationBuilder.DropTable( + name: "Crm_T_CustomerSegment"); + + migrationBuilder.DropTable( + name: "Crm_T_CustomerType"); + + migrationBuilder.DropTable( + name: "Sas_T_Sector"); + + migrationBuilder.DropTable( + name: "Scp_T_Material"); + + migrationBuilder.DropTable( + name: "Scp_T_PaymentTerm"); + + migrationBuilder.DropTable( + name: "Scp_T_SupplyCardType"); + + migrationBuilder.DropTable( + name: "Scp_T_SupplyType"); + migrationBuilder.DropTable( name: "Sas_H_Country"); @@ -8645,15 +8665,15 @@ namespace Erp.Platform.Migrations migrationBuilder.DropTable( name: "Mnt_T_Workcenter"); + migrationBuilder.DropTable( + name: "Mrp_T_OperationCategory"); + migrationBuilder.DropTable( name: "Scp_T_MaterialGroup"); migrationBuilder.DropTable( name: "Scp_T_MaterialType"); - migrationBuilder.DropTable( - name: "Mrp_T_OperationCategory"); - migrationBuilder.DropTable( name: "Sas_H_CountryGroup"); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index 2fc7c7a4..1ef74c42 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -9824,7 +9824,7 @@ namespace Erp.Platform.Migrations .HasColumnType("uniqueidentifier") .HasColumnName("LastModifierId"); - b.Property("ManagerId") + b.Property("ManagerId") .HasColumnType("uniqueidentifier"); b.Property("Name") @@ -9857,11 +9857,15 @@ namespace Erp.Platform.Migrations b.HasKey("Id"); + b.HasIndex("CustomerId"); + + b.HasIndex("ManagerId"); + b.HasIndex("ProjectTypeId"); b.HasIndex("StatusId"); - b.ToTable("Prj_T_Project", (string)null); + b.ToTable("Prj_T_Projects", (string)null); }); modelBuilder.Entity("Erp.Platform.Entities.ProjectStatus", b => @@ -17103,6 +17107,14 @@ namespace Erp.Platform.Migrations modelBuilder.Entity("Erp.Platform.Entities.Project", b => { + b.HasOne("Erp.Platform.Entities.Partner", "Customer") + .WithMany() + .HasForeignKey("CustomerId"); + + b.HasOne("Erp.Platform.Entities.Employee", "Manager") + .WithMany() + .HasForeignKey("ManagerId"); + b.HasOne("Erp.Platform.Entities.ProjectType", "ProjectType") .WithMany("Projects") .HasForeignKey("ProjectTypeId") @@ -17115,6 +17127,10 @@ namespace Erp.Platform.Migrations .OnDelete(DeleteBehavior.Restrict) .IsRequired(); + b.Navigation("Customer"); + + b.Navigation("Manager"); + b.Navigation("ProjectType"); b.Navigation("Status"); diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json index e8a27054..db59fb7b 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/Seeds/TenantData.json @@ -100,9 +100,7 @@ "props": null, "description": null, "isActive": true, - "dependencies": [ - "DynamicEntityComponent" - ] + "dependencies": ["DynamicEntityComponent"] } ], "ReportCategories": [ @@ -2431,12 +2429,7 @@ "minSalary": 80000, "maxSalary": 120000, "currency": "USD", - "requiredSkills": [ - "JavaScript", - "TypeScript", - "React", - "Node.js" - ], + "requiredSkills": ["JavaScript", "TypeScript", "React", "Node.js"], "responsibilities": [ "Develop frontend and backend applications", "Write clean and maintainable code", @@ -4131,9 +4124,7 @@ { "postContent": "CI/CD pipeline güncellememiz tamamlandı! Deployment süremiz %40 azaldı. Otomasyonun gücü 💪", "type": "video", - "urls": [ - "https://www.w3schools.com/html/mov_bbb.mp4" - ] + "urls": ["https://www.w3schools.com/html/mov_bbb.mp4"] } ], "SocialPollOptions": [ @@ -5869,5 +5860,83 @@ "description": "Projenin iptal edildiğini ifade eder", "isActive": true } + ], + "Projects": [ + { + "code": "PRJ-2024-001", + "name": "Erp Sistemi Geliştirme", + "description": "Kurumsal kaynak planlama sistemi geliştirilmesi", + "projectTypeName": "Dahili", + "statusName": "Aktif", + "priority": "High", + "customerCode": "CUST-001", + "managerCode": "EMP-001", + "startDate": "2024-01-15T00:00:00.000Z", + "endDate": "2024-12-31T00:00:00.000Z", + "actualStartDate": "2024-01-20T00:00:00.000Z", + "actualEndDate": null, + "budget": 500000, + "actualCost": 250000, + "currency": "TRY", + "progress": 65, + "isActive": true + }, + { + "code": "PRJ-2024-002", + "name": "Mobil Uygulama Geliştirme", + "description": "iOS ve Android mobil uygulama geliştirilmesi", + "projectTypeName": "Müşteri", + "statusName": "Planlama", + "priority": "Medium", + "customerCode": "CUST-002", + "managerCode": "EMP-002", + "startDate": "2024-03-01T00:00:00.000Z", + "endDate": "2024-08-31T00:00:00.000Z", + "actualStartDate": null, + "actualEndDate": null, + "budget": 300000, + "actualCost": 50000, + "currency": "TRY", + "progress": 15, + "isActive": true + }, + { + "code": "PRJ-2024-003", + "name": "Veri Merkezi Kurulumu", + "description": "Yeni veri merkezi altyapısının kurulması", + "projectTypeName": "Dahili", + "statusName": "Tamamlandı", + "priority": "High", + "customerCode": null, + "managerCode": "EMP-003", + "startDate": "2024-06-01T00:00:00.000Z", + "endDate": "2024-10-31T00:00:00.000Z", + "actualStartDate": "2024-06-05T00:00:00.000Z", + "actualEndDate": "2024-10-28T00:00:00.000Z", + "budget": 800000, + "actualCost": 750000, + "currency": "TRY", + "progress": 100, + "isActive": true + }, + { + "code": "PRJ-2024-004", + "name": "E-ticaret Platform Entegrasyonu", + "description": "Mevcut sisteme e-ticaret platformu entegrasyonu", + "projectTypeName": "Müşteri", + "statusName": "Beklemede", + "priority": "Low", + "customerCode": "CUST-001", + "managerCode": "EMP-001", + "startDate": "2024-09-01T00:00:00.000Z", + "endDate": "2024-12-15T00:00:00.000Z", + "actualStartDate": null, + "actualEndDate": null, + "budget": 200000, + "actualCost": 25000, + "currency": "TRY", + "progress": 10, + "isActive": true + } ] -} \ No newline at end of file +} diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs index de0c567f..b446c3cd 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantDataSeeder.cs @@ -130,6 +130,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency private readonly IRepository _bomOperationRepository; private readonly IRepository _projectTypeRepository; private readonly IRepository _projectStatusRepository; + private readonly IRepository _projectRepository; public TenantDataSeeder( IClock clock, @@ -242,7 +243,8 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency IRepository bomComponentRepository, IRepository bomOperationRepository, IRepository projectTypeRepository, - IRepository projectStatusRepository + IRepository projectStatusRepository, + IRepository projectRepository ) { _clock = clock; @@ -357,6 +359,7 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency _bomOperationRepository = bomOperationRepository; _projectTypeRepository = projectTypeRepository; _projectStatusRepository = projectStatusRepository; + _projectRepository = projectRepository; } private static IConfigurationRoot BuildConfiguration() @@ -2480,6 +2483,39 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency IsActive = item.IsActive }, autoSave: true); } + + foreach (var item in items.Projects) + { + var exists = await _projectRepository.AnyAsync(x => x.Code == item.Code); + if (exists) + continue; + + var projectType = await _projectTypeRepository.FirstOrDefaultAsync(x => x.Name == item.ProjectTypeName); + var projectStatus = await _projectStatusRepository.FirstOrDefaultAsync(x => x.Name == item.StatusName); + var customer = await _partnerRepository.FirstOrDefaultAsync(x => x.Code == item.CustomerCode); + var employee = await _employeeRepository.FirstOrDefaultAsync(x => x.Code == item.ManagerCode); + + await _projectRepository.InsertAsync(new Project + { + Code = item.Code, + Name = item.Name, + Description = item.Description, + ProjectTypeId = projectType?.Id, + StatusId = projectStatus?.Id, + Priority = item.Priority, + CustomerId = customer?.Id, + ManagerId = employee?.Id, + StartDate = item.StartDate, + EndDate = item.EndDate, + ActualStartDate = item.ActualStartDate, + ActualEndDate = item.ActualEndDate, + Budget = item.Budget, + ActualCost = item.ActualCost, + Currency = item.Currency, + Progress = item.Progress, + IsActive = item.IsActive + }, autoSave: true); + } } } diff --git a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs index 332ed87d..a177f392 100644 --- a/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs +++ b/api/src/Erp.Platform.EntityFrameworkCore/Tenants/TenantSeederDto.cs @@ -130,6 +130,32 @@ public class TenantSeederDto //Project public List ProjectTypes { get; set; } public List ProjectStatuses { get; set; } + public List Projects { get; set; } +} + +public class ProjectSeedDto +{ + public string Code { get; set; } + public string Name { get; set; } + public string Description { get; set; } + + public string ProjectTypeName { get; set; } + public string StatusName { get; set; } + public string Priority { get; set; } + public string CustomerCode { get; set; } + public string ManagerCode { get; set; } + + public DateTime StartDate { get; set; } + public DateTime EndDate { get; set; } + public DateTime? ActualStartDate { get; set; } + public DateTime? ActualEndDate { get; set; } + + public decimal Budget { get; set; } + public decimal ActualCost { get; set; } + public string Currency { get; set; } + public int Progress { get; set; } + + public bool IsActive { get; set; } } public class ProjectStatusSeedDto