БД, таблицы для ЕСПП, связь с app, обновлена Template

This commit is contained in:
Mikhail Trubnikov
2023-09-19 10:01:50 +10:00
parent 791b73cb21
commit 7a88a7c198
11 changed files with 1944 additions and 14 deletions

View File

@@ -11,27 +11,36 @@ namespace PARR.DAL.Context
{ {
public DataContext(DbContextOptions<DataContext> options) : base(options) { } public DataContext(DbContextOptions<DataContext> options) : base(options) { }
#region v1
public DbSet<V1_JobType> JobTypes { get; set; } public DbSet<V1_JobType> JobTypes { get; set; }
public DbSet<V1_JobCategory> JobCategories { get; set; } public DbSet<V1_JobCategory> JobCategories { get; set; }
public DbSet<V1_JobMode> JobModes { get; set; } public DbSet<V1_JobMode> JobModes { get; set; }
public DbSet<V1_JobStatus> JobStatuses { get; set; } public DbSet<V1_JobStatus> JobStatuses { get; set; }
public DbSet<V1_Host> V1_Hosts { get; set; } public DbSet<V1_Host> V1_Hosts { get; set; }
public DbSet<Host> Hosts { get; set; }
public DbSet<V1_Job> Jobs { get; set; } public DbSet<V1_Job> Jobs { get; set; }
public DbSet<V1_JobJournal> JobJournals { get; set; } public DbSet<V1_JobJournal> JobJournals { get; set; }
public DbSet<Application> Applications { get; set; }
public DbSet<ApplicationType> ApplicationTypes { get; set; }
public DbSet<ApplicationInHost> ApplicationsInHosts { get; set; }
public DbSet<V1_Application> V1_Applications { get; set; } public DbSet<V1_Application> V1_Applications { get; set; }
public DbSet<V1_ApplicationType> V1_ApplicationTypes { get; set; } public DbSet<V1_ApplicationType> V1_ApplicationTypes { get; set; }
public DbSet<V1_ApplicationInHost> V1_ApplicationsInHosts { get; set; } public DbSet<V1_ApplicationInHost> V1_ApplicationsInHosts { get; set; }
#endregion
public DbSet<Host> Hosts { get; set; }
public DbSet<Application> Applications { get; set; }
public DbSet<ApplicationType> ApplicationTypes { get; set; }
public DbSet<ApplicationInHost> ApplicationsInHosts { get; set; }
public DbSet<Setting> Settings { get; set; } public DbSet<Setting> Settings { get; set; }
public DbSet<RawDataEK> RawDataEKs { get; set; } public DbSet<RawDataEK> RawDataEKs { get; set; }
public DbSet<Template> Templates { get; set; } public DbSet<Template> Templates { get; set; }
public DbSet<StatusTemplate> StatusTemplates { get; set; } public DbSet<StatusTemplate> StatusTemplates { get; set; }
//public DbSet<Scheduler> Schedulers { get; set; }
//todo init application type+check migrations public DbSet<Process> Processes { get; set; }
public DbSet<Subprocess> Subprocesses { get; set; }
public DbSet<Tnk> Tnks { get; set; }
public DbSet<Work> Works { get; set; }
public DbSet<ApplicationsInWork> ApplicationsInWorks { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,210 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class TblsEsppWorksAndAppsAndTEmpl : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "ApplicationInWorkId",
table: "Templates",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.CreateTable(
name: "Processes",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
EsppId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Processes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Subprocesses",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
EsppId = table.Column<int>(type: "integer", nullable: false),
ProcessId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Subprocesses", x => x.Id);
table.ForeignKey(
name: "FK_Subprocesses_Processes_ProcessId",
column: x => x.ProcessId,
principalTable: "Processes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Tnks",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
EsppId = table.Column<int>(type: "integer", nullable: false),
SubprocessId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Tnks", x => x.Id);
table.ForeignKey(
name: "FK_Tnks_Subprocesses_SubprocessId",
column: x => x.SubprocessId,
principalTable: "Subprocesses",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Works",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
Name = table.Column<string>(type: "text", nullable: false),
EsppId = table.Column<int>(type: "integer", nullable: false),
TnkId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Works", x => x.Id);
table.ForeignKey(
name: "FK_Works_Tnks_TnkId",
column: x => x.TnkId,
principalTable: "Tnks",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ApplicationsInWorks",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
DateModified = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
WorkId = table.Column<Guid>(type: "uuid", nullable: false),
ApplicationId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApplicationsInWorks", x => x.Id);
table.ForeignKey(
name: "FK_ApplicationsInWorks_Applications_ApplicationId",
column: x => x.ApplicationId,
principalTable: "Applications",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ApplicationsInWorks_Works_WorkId",
column: x => x.WorkId,
principalTable: "Works",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Templates_ApplicationInWorkId",
table: "Templates",
column: "ApplicationInWorkId");
migrationBuilder.CreateIndex(
name: "IX_Templates_Name",
table: "Templates",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ApplicationsInWorks_ApplicationId",
table: "ApplicationsInWorks",
column: "ApplicationId");
migrationBuilder.CreateIndex(
name: "IX_ApplicationsInWorks_WorkId_ApplicationId",
table: "ApplicationsInWorks",
columns: new[] { "WorkId", "ApplicationId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Subprocesses_ProcessId",
table: "Subprocesses",
column: "ProcessId");
migrationBuilder.CreateIndex(
name: "IX_Tnks_SubprocessId",
table: "Tnks",
column: "SubprocessId");
migrationBuilder.CreateIndex(
name: "IX_Works_TnkId",
table: "Works",
column: "TnkId");
migrationBuilder.AddForeignKey(
name: "FK_Templates_ApplicationsInWorks_ApplicationInWorkId",
table: "Templates",
column: "ApplicationInWorkId",
principalTable: "ApplicationsInWorks",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Templates_ApplicationsInWorks_ApplicationInWorkId",
table: "Templates");
migrationBuilder.DropTable(
name: "ApplicationsInWorks");
migrationBuilder.DropTable(
name: "Works");
migrationBuilder.DropTable(
name: "Tnks");
migrationBuilder.DropTable(
name: "Subprocesses");
migrationBuilder.DropTable(
name: "Processes");
migrationBuilder.DropIndex(
name: "IX_Templates_ApplicationInWorkId",
table: "Templates");
migrationBuilder.DropIndex(
name: "IX_Templates_Name",
table: "Templates");
migrationBuilder.DropColumn(
name: "ApplicationInWorkId",
table: "Templates");
}
}
}

View File

@@ -347,6 +347,34 @@ namespace PARR.DAL.Migrations
}); });
}); });
modelBuilder.Entity("PARR.DAL.Models.ApplicationsInWork", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("ApplicationId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("WorkId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ApplicationId");
b.HasIndex("WorkId", "ApplicationId")
.IsUnique();
b.ToTable("ApplicationsInWorks");
});
modelBuilder.Entity("PARR.DAL.Models.Host", b => modelBuilder.Entity("PARR.DAL.Models.Host", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@@ -377,6 +405,30 @@ namespace PARR.DAL.Migrations
b.ToTable("Hosts"); b.ToTable("Hosts");
}); });
modelBuilder.Entity("PARR.DAL.Models.Process", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<int>("EsppId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Processes");
});
modelBuilder.Entity("PARR.DAL.Models.StatusTemplate", b => modelBuilder.Entity("PARR.DAL.Models.StatusTemplate", b =>
{ {
b.Property<int>("Code") b.Property<int>("Code")
@@ -418,12 +470,44 @@ namespace PARR.DAL.Migrations
}); });
}); });
modelBuilder.Entity("PARR.DAL.Models.Subprocess", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<int>("EsppId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("ProcessId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("ProcessId");
b.ToTable("Subprocesses");
});
modelBuilder.Entity("PARR.DAL.Models.Template", b => modelBuilder.Entity("PARR.DAL.Models.Template", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<Guid>("ApplicationInWorkId")
.HasColumnType("uuid");
b.Property<string>("Category") b.Property<string>("Category")
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
@@ -502,11 +586,45 @@ namespace PARR.DAL.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ApplicationInWorkId");
b.HasIndex("Name")
.IsUnique();
b.HasIndex("StatusCode"); b.HasIndex("StatusCode");
b.ToTable("Templates"); b.ToTable("Templates");
}); });
modelBuilder.Entity("PARR.DAL.Models.Tnk", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<int>("EsppId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("SubprocessId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("SubprocessId");
b.ToTable("Tnks");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b => modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@@ -854,6 +972,35 @@ namespace PARR.DAL.Migrations
b.ToTable("V1_JobTypes"); b.ToTable("V1_JobTypes");
}); });
modelBuilder.Entity("PARR.DAL.Models.Work", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<DateTimeOffset?>("DateModified")
.HasColumnType("timestamp with time zone");
b.Property<int>("EsppId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("TnkId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TnkId");
b.ToTable("Works");
});
modelBuilder.Entity("PARR.DAL.Models.Application", b => modelBuilder.Entity("PARR.DAL.Models.Application", b =>
{ {
b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType") b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType")
@@ -891,17 +1038,66 @@ namespace PARR.DAL.Migrations
.HasForeignKey("ApplicationTypeId"); .HasForeignKey("ApplicationTypeId");
}); });
modelBuilder.Entity("PARR.DAL.Models.ApplicationsInWork", b =>
{
b.HasOne("PARR.DAL.Models.Application", "Application")
.WithMany("ApplicationsInWorks")
.HasForeignKey("ApplicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.Work", "Work")
.WithMany("ApplicationsInWorks")
.HasForeignKey("WorkId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Application");
b.Navigation("Work");
});
modelBuilder.Entity("PARR.DAL.Models.Subprocess", b =>
{
b.HasOne("PARR.DAL.Models.Process", "Process")
.WithMany("Subprocesses")
.HasForeignKey("ProcessId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Process");
});
modelBuilder.Entity("PARR.DAL.Models.Template", b => modelBuilder.Entity("PARR.DAL.Models.Template", b =>
{ {
b.HasOne("PARR.DAL.Models.ApplicationsInWork", "ApplicationsInWork")
.WithMany("Templates")
.HasForeignKey("ApplicationInWorkId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.DAL.Models.StatusTemplate", "StatusTemplate") b.HasOne("PARR.DAL.Models.StatusTemplate", "StatusTemplate")
.WithMany("Templates") .WithMany("Templates")
.HasForeignKey("StatusCode") .HasForeignKey("StatusCode")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("ApplicationsInWork");
b.Navigation("StatusTemplate"); b.Navigation("StatusTemplate");
}); });
modelBuilder.Entity("PARR.DAL.Models.Tnk", b =>
{
b.HasOne("PARR.DAL.Models.Subprocess", "Subprocess")
.WithMany("Tnks")
.HasForeignKey("SubprocessId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Subprocess");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b => modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{ {
b.HasOne("PARR.DAL.Models.V1.V1_ApplicationType", "ApplicationType") b.HasOne("PARR.DAL.Models.V1.V1_ApplicationType", "ApplicationType")
@@ -1001,9 +1197,22 @@ namespace PARR.DAL.Migrations
b.Navigation("Status"); b.Navigation("Status");
}); });
modelBuilder.Entity("PARR.DAL.Models.Work", b =>
{
b.HasOne("PARR.DAL.Models.Tnk", "Tnk")
.WithMany("Works")
.HasForeignKey("TnkId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tnk");
});
modelBuilder.Entity("PARR.DAL.Models.Application", b => modelBuilder.Entity("PARR.DAL.Models.Application", b =>
{ {
b.Navigation("ApplicationsInHosts"); b.Navigation("ApplicationsInHosts");
b.Navigation("ApplicationsInWorks");
}); });
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
@@ -1011,16 +1220,36 @@ namespace PARR.DAL.Migrations
b.Navigation("ApplicationTypes"); b.Navigation("ApplicationTypes");
}); });
modelBuilder.Entity("PARR.DAL.Models.ApplicationsInWork", b =>
{
b.Navigation("Templates");
});
modelBuilder.Entity("PARR.DAL.Models.Host", b => modelBuilder.Entity("PARR.DAL.Models.Host", b =>
{ {
b.Navigation("ApplicationsInHosts"); b.Navigation("ApplicationsInHosts");
}); });
modelBuilder.Entity("PARR.DAL.Models.Process", b =>
{
b.Navigation("Subprocesses");
});
modelBuilder.Entity("PARR.DAL.Models.StatusTemplate", b => modelBuilder.Entity("PARR.DAL.Models.StatusTemplate", b =>
{ {
b.Navigation("Templates"); b.Navigation("Templates");
}); });
modelBuilder.Entity("PARR.DAL.Models.Subprocess", b =>
{
b.Navigation("Tnks");
});
modelBuilder.Entity("PARR.DAL.Models.Tnk", b =>
{
b.Navigation("Works");
});
modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b => modelBuilder.Entity("PARR.DAL.Models.V1.V1_Application", b =>
{ {
b.Navigation("V1_ApplicationsInHosts"); b.Navigation("V1_ApplicationsInHosts");
@@ -1062,6 +1291,11 @@ namespace PARR.DAL.Migrations
{ {
b.Navigation("Jobs"); b.Navigation("Jobs");
}); });
modelBuilder.Entity("PARR.DAL.Models.Work", b =>
{
b.Navigation("ApplicationsInWorks");
});
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
} }

View File

@@ -19,6 +19,7 @@ namespace PARR.DAL.Models
public ICollection<ApplicationInHost> ApplicationsInHosts { get; set; } = new HashSet<ApplicationInHost>(); public ICollection<ApplicationInHost> ApplicationsInHosts { get; set; } = new HashSet<ApplicationInHost>();
//public ICollection<Application> Applications { get;set; } = new HashSet<Application>();
public ICollection<ApplicationsInWork> ApplicationsInWorks { get; set; } = new HashSet<ApplicationsInWork>();
} }
} }

View File

@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("ApplicationsInWorks")]
[Index(nameof(WorkId), nameof(ApplicationId), IsUnique = true)]
public class ApplicationsInWork : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public Guid WorkId { get; set; }
public Guid ApplicationId { get; set; }
[ForeignKey(nameof(WorkId))]
public Work? Work { get; set; }
[ForeignKey(nameof(ApplicationId))]
public Application? Application { get; set; }
public ICollection<Template> Templates { get; set; } = new HashSet<Template>();
}
}

View File

@@ -0,0 +1,23 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Processes")]
public class Process : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public int EsppId { get; set; }
public ICollection<Subprocess> Subprocesses { get; set; } = new HashSet<Subprocess>();
}
}

View File

@@ -0,0 +1,28 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Subprocesses")]
public class Subprocess : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public int EsppId { get; set; }
public Guid ProcessId { get; set; }
[ForeignKey(nameof(ProcessId))]
public Process? Process { get; set; }
public ICollection<Tnk> Tnks { get; set; } = new HashSet<Tnk>();
}
}

View File

@@ -1,41 +1,74 @@
using PARR.DAL.Models.Base; using Microsoft.EntityFrameworkCore;
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models namespace PARR.DAL.Models
{ {
[Table("Templates")] [Table("Templates")]
[Index(nameof(Name), IsUnique = true)]
public class Template : IBase public class Template : IBase
{ {
[Key] [Key]
public Guid Id { get; set; } public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; } public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; } public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; } public required string Name { get; set; }
public bool IsActive { get; set; } public bool IsActive { get; set; }
//??? Рабочая группа
public required string WorkGroup { get; set; } public required string WorkGroup { get; set; }
public required string ShortDescription { get; set; } public required string ShortDescription { get; set; }
//settings ? регламентная работа
public required string Category { get; set; } public required string Category { get; set; }
// ДВС, ??
public required string ResponseArea { get; set; } public required string ResponseArea { get; set; }
//works ??
public required string Duration { get; set; } public required string Duration { get; set; }
public required string EK { get; set; }
//public required string EK { get; set; }
// settings
public required string Initiator { get; set; } public required string Initiator { get; set; }
public required string FullDescription { get; set; } public required string FullDescription { get; set; }
// settings
public required string ClosingCode { get; set; } public required string ClosingCode { get; set; }
// settings
public required string Solution { get; set; } public required string Solution { get; set; }
public required string Process { get; set; }
public required string SubProcess { get; set; } //public required string Process { get; set; }
public required string TNK { get; set; }
public required string Work { get; set; } //public required string SubProcess { get; set; }
//public required string TNK { get; set; }
//public required string Work { get; set; }
// исполнитель??
public required string Worker { get; set; } public required string Worker { get; set; }
public int StatusCode { get; set; } public int StatusCode { get; set; }
[ForeignKey(nameof(StatusCode))] [ForeignKey(nameof(StatusCode))]
public StatusTemplate? StatusTemplate { get; set; } public StatusTemplate? StatusTemplate { get; set; }
//public required string Status { get; set; }
public Guid ApplicationInWorkId { get; set; }
[ForeignKey(nameof(ApplicationInWorkId))]
public ApplicationsInWork? ApplicationsInWork { get; set; }
} }
} }

28
PARR.DAL/Models/Tnk.cs Normal file
View File

@@ -0,0 +1,28 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Tnks")]
public class Tnk : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public int EsppId { get; set; }
public Guid SubprocessId { get; set; }
[ForeignKey(nameof(SubprocessId))]
public Subprocess? Subprocess { get; set; }
public ICollection<Work> Works { get; set; } = new HashSet<Work>();
}
}

28
PARR.DAL/Models/Work.cs Normal file
View File

@@ -0,0 +1,28 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Works")]
public class Work : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public int EsppId { get; set; }
public Guid TnkId { get; set; }
[ForeignKey(nameof(TnkId))]
public Tnk? Tnk { get; set; }
public ICollection<ApplicationsInWork> ApplicationsInWorks { get; set; } = new HashSet<ApplicationsInWork>();
}
}