From db566529f10c31dc97bc3d039290788369be9119 Mon Sep 17 00:00:00 2001 From: "gorbenko.pavel" Date: Wed, 22 Jul 2026 18:06:23 +0500 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D1=80=D0=B5=D0=B2=D1=8C=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/Route.cs | 2 +- .../Entities/RouteStep.cs | 3 ++- .../Enums/ProjectRole.cs | 9 +++++++ .../Persistence/ApprovalRouteDbContext.cs | 2 ++ ... 20260722130455_InitialCreate.Designer.cs} | 24 ++++++++++++------- ...ate.cs => 20260722130455_InitialCreate.cs} | 5 ++-- .../ApprovalRouteDbContextModelSnapshot.cs | 22 +++++++++++------ 7 files changed, 48 insertions(+), 19 deletions(-) create mode 100644 backend/src/Tnsu.ApprovalRoute.Domain/Enums/ProjectRole.cs rename backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/Migrations/{20260722112539_InitialCreate.Designer.cs => 20260722130455_InitialCreate.Designer.cs} (89%) rename backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/Migrations/{20260722112539_InitialCreate.cs => 20260722130455_InitialCreate.cs} (92%) diff --git a/backend/src/Tnsu.ApprovalRoute.Domain/Entities/Route.cs b/backend/src/Tnsu.ApprovalRoute.Domain/Entities/Route.cs index 8e531aa..2df9be2 100644 --- a/backend/src/Tnsu.ApprovalRoute.Domain/Entities/Route.cs +++ b/backend/src/Tnsu.ApprovalRoute.Domain/Entities/Route.cs @@ -11,7 +11,7 @@ public class Route // Внешние справочники (1С/ZUP) — хранятся как ссылки без FK в этой БД. public Guid DepartmentId { get; set; } public Guid CompanyId { get; set; } - public Guid ProjectId { get; set; } + public bool ByProject { get; set; } public bool RequiresControl { get; set; } diff --git a/backend/src/Tnsu.ApprovalRoute.Domain/Entities/RouteStep.cs b/backend/src/Tnsu.ApprovalRoute.Domain/Entities/RouteStep.cs index bf01d87..a70ef8c 100644 --- a/backend/src/Tnsu.ApprovalRoute.Domain/Entities/RouteStep.cs +++ b/backend/src/Tnsu.ApprovalRoute.Domain/Entities/RouteStep.cs @@ -8,8 +8,9 @@ public class RouteStep public int OrderNo { get; set; } // Внешняя ссылка на пользователя (1С/ZUP) — без локальной таблицы Users. - public Guid ExecutorUserId { get; set; } + public string ExecutorEmail { get; set; } = string.Empty; public string Position { get; set; } = string.Empty; + public ProjectRole ProjectRole { get; set; } = ProjectRole.None; public RouteStepStatus Status { get; set; } = RouteStepStatus.Draft; public Guid RouteId { get; set; } diff --git a/backend/src/Tnsu.ApprovalRoute.Domain/Enums/ProjectRole.cs b/backend/src/Tnsu.ApprovalRoute.Domain/Enums/ProjectRole.cs new file mode 100644 index 0000000..f27fc56 --- /dev/null +++ b/backend/src/Tnsu.ApprovalRoute.Domain/Enums/ProjectRole.cs @@ -0,0 +1,9 @@ +namespace Tnsu.ApprovalRoute.Domain.Enums; + +public enum ProjectRole +{ + None, + Manager, + Engineer, + Observer +} diff --git a/backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/ApprovalRouteDbContext.cs b/backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/ApprovalRouteDbContext.cs index 1dba8f5..080ae1f 100644 --- a/backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/ApprovalRouteDbContext.cs +++ b/backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/ApprovalRouteDbContext.cs @@ -28,7 +28,9 @@ public class ApprovalRouteDbContext(DbContextOptions opt modelBuilder.Entity(e => { e.HasKey(x => x.Id); + e.Property(x => x.ExecutorEmail).HasMaxLength(256).IsRequired(); e.Property(x => x.Position).HasMaxLength(128).IsRequired(); + e.Property(x => x.ProjectRole).HasConversion().HasMaxLength(32).IsRequired(); e.Property(x => x.Status).HasConversion().HasMaxLength(32).IsRequired(); e.HasOne(x => x.Route).WithMany(x => x.Steps).HasForeignKey(x => x.RouteId); e.HasIndex(x => new { x.RouteId, x.OrderNo }); diff --git a/backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/Migrations/20260722112539_InitialCreate.Designer.cs b/backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/Migrations/20260722130455_InitialCreate.Designer.cs similarity index 89% rename from backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/Migrations/20260722112539_InitialCreate.Designer.cs rename to backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/Migrations/20260722130455_InitialCreate.Designer.cs index 25f2078..475d855 100644 --- a/backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/Migrations/20260722112539_InitialCreate.Designer.cs +++ b/backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/Migrations/20260722130455_InitialCreate.Designer.cs @@ -12,7 +12,7 @@ using Tnsu.ApprovalRoute.Infrastructure.Persistence; namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations { [DbContext(typeof(ApprovalRouteDbContext))] - [Migration("20260722112539_InitialCreate")] + [Migration("20260722130455_InitialCreate")] partial class InitialCreate { /// @@ -57,6 +57,10 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations .HasColumnType("uuid") .HasColumnName("id"); + b.Property("ByProject") + .HasColumnType("boolean") + .HasColumnName("by_project"); + b.Property("CompanyId") .HasColumnType("uuid") .HasColumnName("company_id"); @@ -65,10 +69,6 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations .HasColumnType("uuid") .HasColumnName("department_id"); - b.Property("ProjectId") - .HasColumnType("uuid") - .HasColumnName("project_id"); - b.Property("RequestTypeId") .HasColumnType("uuid") .HasColumnName("request_type_id"); @@ -103,9 +103,11 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations .HasColumnType("boolean") .HasColumnName("allow_reassign_to_other_approvers"); - b.Property("ExecutorUserId") - .HasColumnType("uuid") - .HasColumnName("executor_user_id"); + b.Property("ExecutorEmail") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("executor_email"); b.Property("OrderNo") .HasColumnType("integer") @@ -117,6 +119,12 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations .HasColumnType("character varying(128)") .HasColumnName("position"); + b.Property("ProjectRole") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("character varying(32)") + .HasColumnName("project_role"); + b.Property("RouteId") .HasColumnType("uuid") .HasColumnName("route_id"); diff --git a/backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/Migrations/20260722112539_InitialCreate.cs b/backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/Migrations/20260722130455_InitialCreate.cs similarity index 92% rename from backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/Migrations/20260722112539_InitialCreate.cs rename to backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/Migrations/20260722130455_InitialCreate.cs index 9d893ca..772cbab 100644 --- a/backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/Migrations/20260722112539_InitialCreate.cs +++ b/backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/Migrations/20260722130455_InitialCreate.cs @@ -33,7 +33,7 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations request_type_id = table.Column(type: "uuid", nullable: false), department_id = table.Column(type: "uuid", nullable: false), company_id = table.Column(type: "uuid", nullable: false), - project_id = table.Column(type: "uuid", nullable: false), + by_project = table.Column(type: "boolean", nullable: false), requires_control = table.Column(type: "boolean", nullable: false) }, constraints: table => @@ -53,8 +53,9 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations { id = table.Column(type: "uuid", nullable: false), order_no = table.Column(type: "integer", nullable: false), - executor_user_id = table.Column(type: "uuid", nullable: false), + executor_email = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), position = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), + project_role = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), status = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), route_id = table.Column(type: "uuid", nullable: false), allow_reassign_to_other_approvers = table.Column(type: "boolean", nullable: false) diff --git a/backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/Migrations/ApprovalRouteDbContextModelSnapshot.cs b/backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/Migrations/ApprovalRouteDbContextModelSnapshot.cs index bc98f9b..26f31c4 100644 --- a/backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/Migrations/ApprovalRouteDbContextModelSnapshot.cs +++ b/backend/src/Tnsu.ApprovalRoute.Infrastructure/Persistence/Migrations/ApprovalRouteDbContextModelSnapshot.cs @@ -54,6 +54,10 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations .HasColumnType("uuid") .HasColumnName("id"); + b.Property("ByProject") + .HasColumnType("boolean") + .HasColumnName("by_project"); + b.Property("CompanyId") .HasColumnType("uuid") .HasColumnName("company_id"); @@ -62,10 +66,6 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations .HasColumnType("uuid") .HasColumnName("department_id"); - b.Property("ProjectId") - .HasColumnType("uuid") - .HasColumnName("project_id"); - b.Property("RequestTypeId") .HasColumnType("uuid") .HasColumnName("request_type_id"); @@ -100,9 +100,11 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations .HasColumnType("boolean") .HasColumnName("allow_reassign_to_other_approvers"); - b.Property("ExecutorUserId") - .HasColumnType("uuid") - .HasColumnName("executor_user_id"); + b.Property("ExecutorEmail") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("executor_email"); b.Property("OrderNo") .HasColumnType("integer") @@ -114,6 +116,12 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations .HasColumnType("character varying(128)") .HasColumnName("position"); + b.Property("ProjectRole") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("character varying(32)") + .HasColumnName("project_role"); + b.Property("RouteId") .HasColumnType("uuid") .HasColumnName("route_id");