правки по ревью

This commit is contained in:
gorbenko.pavel
2026-07-22 18:06:23 +05:00
parent 30a70c208d
commit db566529f1
7 changed files with 48 additions and 19 deletions
@@ -11,7 +11,7 @@ public class Route
// Внешние справочники (1С/ZUP) — хранятся как ссылки без FK в этой БД. // Внешние справочники (1С/ZUP) — хранятся как ссылки без FK в этой БД.
public Guid DepartmentId { get; set; } public Guid DepartmentId { get; set; }
public Guid CompanyId { get; set; } public Guid CompanyId { get; set; }
public Guid ProjectId { get; set; } public bool ByProject { get; set; }
public bool RequiresControl { get; set; } public bool RequiresControl { get; set; }
@@ -8,8 +8,9 @@ public class RouteStep
public int OrderNo { get; set; } public int OrderNo { get; set; }
// Внешняя ссылка на пользователя (1С/ZUP) — без локальной таблицы Users. // Внешняя ссылка на пользователя (1С/ZUP) — без локальной таблицы Users.
public Guid ExecutorUserId { get; set; } public string ExecutorEmail { get; set; } = string.Empty;
public string Position { 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 RouteStepStatus Status { get; set; } = RouteStepStatus.Draft;
public Guid RouteId { get; set; } public Guid RouteId { get; set; }
@@ -0,0 +1,9 @@
namespace Tnsu.ApprovalRoute.Domain.Enums;
public enum ProjectRole
{
None,
Manager,
Engineer,
Observer
}
@@ -28,7 +28,9 @@ public class ApprovalRouteDbContext(DbContextOptions<ApprovalRouteDbContext> opt
modelBuilder.Entity<RouteStep>(e => modelBuilder.Entity<RouteStep>(e =>
{ {
e.HasKey(x => x.Id); 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.Position).HasMaxLength(128).IsRequired();
e.Property(x => x.ProjectRole).HasConversion<string>().HasMaxLength(32).IsRequired();
e.Property(x => x.Status).HasConversion<string>().HasMaxLength(32).IsRequired(); e.Property(x => x.Status).HasConversion<string>().HasMaxLength(32).IsRequired();
e.HasOne(x => x.Route).WithMany(x => x.Steps).HasForeignKey(x => x.RouteId); e.HasOne(x => x.Route).WithMany(x => x.Steps).HasForeignKey(x => x.RouteId);
e.HasIndex(x => new { x.RouteId, x.OrderNo }); e.HasIndex(x => new { x.RouteId, x.OrderNo });
@@ -12,7 +12,7 @@ using Tnsu.ApprovalRoute.Infrastructure.Persistence;
namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations
{ {
[DbContext(typeof(ApprovalRouteDbContext))] [DbContext(typeof(ApprovalRouteDbContext))]
[Migration("20260722112539_InitialCreate")] [Migration("20260722130455_InitialCreate")]
partial class InitialCreate partial class InitialCreate
{ {
/// <inheritdoc /> /// <inheritdoc />
@@ -57,6 +57,10 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<bool>("ByProject")
.HasColumnType("boolean")
.HasColumnName("by_project");
b.Property<Guid>("CompanyId") b.Property<Guid>("CompanyId")
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("company_id"); .HasColumnName("company_id");
@@ -65,10 +69,6 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("department_id"); .HasColumnName("department_id");
b.Property<Guid>("ProjectId")
.HasColumnType("uuid")
.HasColumnName("project_id");
b.Property<Guid>("RequestTypeId") b.Property<Guid>("RequestTypeId")
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("request_type_id"); .HasColumnName("request_type_id");
@@ -103,9 +103,11 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations
.HasColumnType("boolean") .HasColumnType("boolean")
.HasColumnName("allow_reassign_to_other_approvers"); .HasColumnName("allow_reassign_to_other_approvers");
b.Property<Guid>("ExecutorUserId") b.Property<string>("ExecutorEmail")
.HasColumnType("uuid") .IsRequired()
.HasColumnName("executor_user_id"); .HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasColumnName("executor_email");
b.Property<int>("OrderNo") b.Property<int>("OrderNo")
.HasColumnType("integer") .HasColumnType("integer")
@@ -117,6 +119,12 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations
.HasColumnType("character varying(128)") .HasColumnType("character varying(128)")
.HasColumnName("position"); .HasColumnName("position");
b.Property<string>("ProjectRole")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasColumnName("project_role");
b.Property<Guid>("RouteId") b.Property<Guid>("RouteId")
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("route_id"); .HasColumnName("route_id");
@@ -33,7 +33,7 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations
request_type_id = table.Column<Guid>(type: "uuid", nullable: false), request_type_id = table.Column<Guid>(type: "uuid", nullable: false),
department_id = table.Column<Guid>(type: "uuid", nullable: false), department_id = table.Column<Guid>(type: "uuid", nullable: false),
company_id = table.Column<Guid>(type: "uuid", nullable: false), company_id = table.Column<Guid>(type: "uuid", nullable: false),
project_id = table.Column<Guid>(type: "uuid", nullable: false), by_project = table.Column<bool>(type: "boolean", nullable: false),
requires_control = table.Column<bool>(type: "boolean", nullable: false) requires_control = table.Column<bool>(type: "boolean", nullable: false)
}, },
constraints: table => constraints: table =>
@@ -53,8 +53,9 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations
{ {
id = table.Column<Guid>(type: "uuid", nullable: false), id = table.Column<Guid>(type: "uuid", nullable: false),
order_no = table.Column<int>(type: "integer", nullable: false), order_no = table.Column<int>(type: "integer", nullable: false),
executor_user_id = table.Column<Guid>(type: "uuid", nullable: false), executor_email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
position = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false), position = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
project_role = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
status = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false), status = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false),
route_id = table.Column<Guid>(type: "uuid", nullable: false), route_id = table.Column<Guid>(type: "uuid", nullable: false),
allow_reassign_to_other_approvers = table.Column<bool>(type: "boolean", nullable: false) allow_reassign_to_other_approvers = table.Column<bool>(type: "boolean", nullable: false)
@@ -54,6 +54,10 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("id"); .HasColumnName("id");
b.Property<bool>("ByProject")
.HasColumnType("boolean")
.HasColumnName("by_project");
b.Property<Guid>("CompanyId") b.Property<Guid>("CompanyId")
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("company_id"); .HasColumnName("company_id");
@@ -62,10 +66,6 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("department_id"); .HasColumnName("department_id");
b.Property<Guid>("ProjectId")
.HasColumnType("uuid")
.HasColumnName("project_id");
b.Property<Guid>("RequestTypeId") b.Property<Guid>("RequestTypeId")
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("request_type_id"); .HasColumnName("request_type_id");
@@ -100,9 +100,11 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations
.HasColumnType("boolean") .HasColumnType("boolean")
.HasColumnName("allow_reassign_to_other_approvers"); .HasColumnName("allow_reassign_to_other_approvers");
b.Property<Guid>("ExecutorUserId") b.Property<string>("ExecutorEmail")
.HasColumnType("uuid") .IsRequired()
.HasColumnName("executor_user_id"); .HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasColumnName("executor_email");
b.Property<int>("OrderNo") b.Property<int>("OrderNo")
.HasColumnType("integer") .HasColumnType("integer")
@@ -114,6 +116,12 @@ namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations
.HasColumnType("character varying(128)") .HasColumnType("character varying(128)")
.HasColumnName("position"); .HasColumnName("position");
b.Property<string>("ProjectRole")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasColumnName("project_role");
b.Property<Guid>("RouteId") b.Property<Guid>("RouteId")
.HasColumnType("uuid") .HasColumnType("uuid")
.HasColumnName("route_id"); .HasColumnName("route_id");