From 2f0b9e1452708c6196f5b5d6649407e36efaa5f1 Mon Sep 17 00:00:00 2001 From: ivanszabo Date: Wed, 19 Feb 2025 14:12:39 +0100 Subject: [PATCH] =?UTF-8?q?Kis=20adatb=C3=A1zis=20=C3=A9s=20miegym=C3=A1s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/WorkFlowCheck.DL/AppDbContext.cs | 9 +- ...on.cs => CheckListRowTypeConfiguration.cs} | 6 +- ...heckListTemplateHeaderTypeConfiguration.cs | 21 + .../UserRoleTypeConfiguration.cs | 21 + .../Entities/CheckListHeader.cs | 6 +- src/WorkFlowCheck.DL/Entities/CheckListRow.cs | 25 + .../Entities/CheckListTemplateHeader.cs | 4 +- .../Entities/CheckListTemplateRow.cs | 19 +- src/WorkFlowCheck.DL/Entities/CheckPoint.cs | 4 +- src/WorkFlowCheck.DL/Entities/Equipment.cs | 8 +- src/WorkFlowCheck.DL/Entities/Location.cs | 4 +- src/WorkFlowCheck.DL/Entities/Role.cs | 6 +- ...ader.cs => RoleCheckListTemplateHeader.cs} | 8 +- src/WorkFlowCheck.DL/Entities/User.cs | 4 +- src/WorkFlowCheck.DL/Entities/UserRole.cs | 17 + ... 20250219111008_InitialCreate.Designer.cs} | 79 ++- ...ate.cs => 20250219111008_InitialCreate.cs} | 66 +- .../20250219115948_Extend001.Designer.cs | 570 +++++++++++++++++ .../Migrations/20250219115948_Extend001.cs | 122 ++++ .../20250219125200_Extend002.Designer.cs | 578 ++++++++++++++++++ .../Migrations/20250219125200_Extend002.cs | 69 +++ .../Migrations/AppDbContextModelSnapshot.cs | 157 ++++- 22 files changed, 1711 insertions(+), 92 deletions(-) rename src/WorkFlowCheck.DL/Configurations/{UsersCheckListTemplateHeaderTypeConfiguration.cs => CheckListRowTypeConfiguration.cs} (57%) create mode 100644 src/WorkFlowCheck.DL/Configurations/RoleCheckListTemplateHeaderTypeConfiguration.cs create mode 100644 src/WorkFlowCheck.DL/Configurations/UserRoleTypeConfiguration.cs create mode 100644 src/WorkFlowCheck.DL/Entities/CheckListRow.cs rename src/WorkFlowCheck.DL/Entities/{UsersCheckListTemplateHeader.cs => RoleCheckListTemplateHeader.cs} (65%) create mode 100644 src/WorkFlowCheck.DL/Entities/UserRole.cs rename src/WorkFlowCheck.DL/Migrations/{20250204120742_InitialCreate.Designer.cs => 20250219111008_InitialCreate.Designer.cs} (88%) rename src/WorkFlowCheck.DL/Migrations/{20250204120742_InitialCreate.cs => 20250219111008_InitialCreate.cs} (83%) create mode 100644 src/WorkFlowCheck.DL/Migrations/20250219115948_Extend001.Designer.cs create mode 100644 src/WorkFlowCheck.DL/Migrations/20250219115948_Extend001.cs create mode 100644 src/WorkFlowCheck.DL/Migrations/20250219125200_Extend002.Designer.cs create mode 100644 src/WorkFlowCheck.DL/Migrations/20250219125200_Extend002.cs diff --git a/src/WorkFlowCheck.DL/AppDbContext.cs b/src/WorkFlowCheck.DL/AppDbContext.cs index a61fc8d..162926a 100644 --- a/src/WorkFlowCheck.DL/AppDbContext.cs +++ b/src/WorkFlowCheck.DL/AppDbContext.cs @@ -34,6 +34,7 @@ namespace WorkFlowCheck.DL #endif #region Entities DbSet public DbSet CheckListHeaders { get; set; } = null!; + public DbSet CheckListRows { get; set; } = null!; public DbSet CheckListTemplateHeaders { get; set; } = null!; public DbSet CheckListTemplateRows { get; set; } = null!; public DbSet CheckPoints { get; set; } = null!; @@ -41,7 +42,9 @@ namespace WorkFlowCheck.DL public DbSet Locations { get; set; } = null!; public DbSet Roles { get; set; } = null!; public DbSet Users { get; set; } = null!; - public DbSet UsersCheckListTemplateHeaders { get; set; } = null!; + public DbSet UserRoles { get; set; } = null!; + + public DbSet UsersCheckListTemplateHeaders { get; set; } = null!; #endregion @@ -49,14 +52,16 @@ namespace WorkFlowCheck.DL protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.ApplyConfiguration(new CheckListHeaderTypeConfiguration()); + modelBuilder.ApplyConfiguration(new CheckListRowTypeConfiguration()); modelBuilder.ApplyConfiguration(new CheckListTemplateHeaderTypeConfiguration()); modelBuilder.ApplyConfiguration(new CheckListTemplateRowTypeConfiguration()); modelBuilder.ApplyConfiguration(new CheckPointTypeConfiguration()); modelBuilder.ApplyConfiguration(new EquipmentTypeConfiguration()); modelBuilder.ApplyConfiguration(new LocationTypeConfiguration()); modelBuilder.ApplyConfiguration(new RoleTypeConfiguration()); - modelBuilder.ApplyConfiguration(new UsersCheckListTemplateHeaderTypeConfiguration()); + modelBuilder.ApplyConfiguration(new RoleCheckListTemplateHeaderTypeConfiguration()); modelBuilder.ApplyConfiguration(new UserTypeConfiguration()); + modelBuilder.ApplyConfiguration(new UserRoleTypeConfiguration()); modelBuilder.RegisterSoftDeleteQueryFilters(); diff --git a/src/WorkFlowCheck.DL/Configurations/UsersCheckListTemplateHeaderTypeConfiguration.cs b/src/WorkFlowCheck.DL/Configurations/CheckListRowTypeConfiguration.cs similarity index 57% rename from src/WorkFlowCheck.DL/Configurations/UsersCheckListTemplateHeaderTypeConfiguration.cs rename to src/WorkFlowCheck.DL/Configurations/CheckListRowTypeConfiguration.cs index 00a3958..40ad7d0 100644 --- a/src/WorkFlowCheck.DL/Configurations/UsersCheckListTemplateHeaderTypeConfiguration.cs +++ b/src/WorkFlowCheck.DL/Configurations/CheckListRowTypeConfiguration.cs @@ -8,11 +8,11 @@ using System.Threading.Tasks; namespace WorkFlowCheck.DL.Configurations { - public class UsersCheckListTemplateHeaderTypeConfiguration : IEntityTypeConfiguration + public class CheckListRowTypeConfiguration : IEntityTypeConfiguration { - public void Configure(EntityTypeBuilder builder) + public void Configure(EntityTypeBuilder builder) { - builder.ToTable("UsersCheckListTemplateHeader"); + builder.ToTable("CheckListRow"); builder.HasKey(e => e.Id); builder.Property(e => e.Id).ValueGeneratedOnAdd(); } diff --git a/src/WorkFlowCheck.DL/Configurations/RoleCheckListTemplateHeaderTypeConfiguration.cs b/src/WorkFlowCheck.DL/Configurations/RoleCheckListTemplateHeaderTypeConfiguration.cs new file mode 100644 index 0000000..52a313b --- /dev/null +++ b/src/WorkFlowCheck.DL/Configurations/RoleCheckListTemplateHeaderTypeConfiguration.cs @@ -0,0 +1,21 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WorkFlowCheck.DL.Configurations +{ + public class RoleCheckListTemplateHeaderTypeConfiguration : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("RoleCheckListTemplateHeader"); + builder.HasKey(e => e.Id); + builder.Property(e => e.Id).ValueGeneratedOnAdd(); + } + + } +} diff --git a/src/WorkFlowCheck.DL/Configurations/UserRoleTypeConfiguration.cs b/src/WorkFlowCheck.DL/Configurations/UserRoleTypeConfiguration.cs new file mode 100644 index 0000000..560686e --- /dev/null +++ b/src/WorkFlowCheck.DL/Configurations/UserRoleTypeConfiguration.cs @@ -0,0 +1,21 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WorkFlowCheck.DL.Configurations +{ + public class UserRoleTypeConfiguration : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("UserRoles"); + builder.HasKey(e => e.Id); + builder.Property(e => e.Id).ValueGeneratedOnAdd(); + } + + } +} diff --git a/src/WorkFlowCheck.DL/Entities/CheckListHeader.cs b/src/WorkFlowCheck.DL/Entities/CheckListHeader.cs index 0637b9d..5dd1a4d 100644 --- a/src/WorkFlowCheck.DL/Entities/CheckListHeader.cs +++ b/src/WorkFlowCheck.DL/Entities/CheckListHeader.cs @@ -15,11 +15,11 @@ namespace WorkFlowCheck.DL.Entities public string DocumentNumber { get; set; } = null!; public bool IsStorno { get; set; } public DateTime LastModAt { get; set; } - public string LastModBy { get; set; } + public string LastModBy { get; set; } = null!; public DateTime CreatedAt { get; set; } - public string CreatedBy { get; set; } + public string CreatedBy { get; set; } = null!; public bool IsDeleted { get; set; } - public virtual ICollection CheckListTemplateRows { get; set; } + public virtual ICollection CheckListRows { get; set; } } } diff --git a/src/WorkFlowCheck.DL/Entities/CheckListRow.cs b/src/WorkFlowCheck.DL/Entities/CheckListRow.cs new file mode 100644 index 0000000..437a9a8 --- /dev/null +++ b/src/WorkFlowCheck.DL/Entities/CheckListRow.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WorkFlowCheck.DL.Interfaces; + +namespace WorkFlowCheck.DL.Entities +{ + public class CheckListRow:ISoftDeletableEntity, IAuditableEntity + { + public int Id { get; set; } + public int CheckListHeaderId { get; set; } + public virtual CheckListHeader CheckListHeader { get; set; } = null!; + public int CheckListTemplateRowId { get; set; } + public virtual CheckListTemplateRow CheckListTemplateRow { get; set; } = null!; + public string Answer { get; set; } = null!; + public byte[] Photo { get; set; } = null!; + public DateTime LastModAt { get; set; } + public string LastModBy { get; set; } = null!; + public DateTime CreatedAt { get; set; } + public string CreatedBy { get; set; } = null!; + public bool IsDeleted { get; set; } + } +} diff --git a/src/WorkFlowCheck.DL/Entities/CheckListTemplateHeader.cs b/src/WorkFlowCheck.DL/Entities/CheckListTemplateHeader.cs index a3ed7a5..2938b50 100644 --- a/src/WorkFlowCheck.DL/Entities/CheckListTemplateHeader.cs +++ b/src/WorkFlowCheck.DL/Entities/CheckListTemplateHeader.cs @@ -10,8 +10,8 @@ namespace WorkFlowCheck.DL.Entities public string Description { get; set; } = null!; public bool IsDeleted { get ; set ; } public DateTime LastModAt { get ; set ; } - public string LastModBy { get ; set ; } + public string LastModBy { get ; set ; } = null!; public DateTime CreatedAt { get ; set ; } - public string CreatedBy { get ; set ; } + public string CreatedBy { get ; set ; } = null!; } } diff --git a/src/WorkFlowCheck.DL/Entities/CheckListTemplateRow.cs b/src/WorkFlowCheck.DL/Entities/CheckListTemplateRow.cs index 09adafc..818ae41 100644 --- a/src/WorkFlowCheck.DL/Entities/CheckListTemplateRow.cs +++ b/src/WorkFlowCheck.DL/Entities/CheckListTemplateRow.cs @@ -18,11 +18,24 @@ namespace WorkFlowCheck.DL.Entities public int CheckPointId { get; set; } public virtual CheckPoint CheckPoint { get; set; } public string OperationDescription { get; set; } = null!; - public bool IsDeleted { get; set; } + /// + /// + /// I-N (Igen, nem) + /// P (Fénykép készítése) + /// SI-N (Sárga igen,fehér nem) + /// I-SN (Fehér igen, sárga nem) + /// PI-N (Piros igen,fehér nem) + /// I-PN (Fehér igen, piros nem) + /// + /// + public string AnswerType { get; set; } = null!; + + public bool IsDeleted { get; set; } public DateTime LastModAt { get; set; } - public string LastModBy { get; set; } + public string LastModBy { get; set; } = null!; public DateTime CreatedAt { get; set; } - public string CreatedBy { get; set; } + public string CreatedBy { get; set; } = null!; + } } diff --git a/src/WorkFlowCheck.DL/Entities/CheckPoint.cs b/src/WorkFlowCheck.DL/Entities/CheckPoint.cs index 672a40e..9e1d358 100644 --- a/src/WorkFlowCheck.DL/Entities/CheckPoint.cs +++ b/src/WorkFlowCheck.DL/Entities/CheckPoint.cs @@ -14,8 +14,8 @@ namespace WorkFlowCheck.DL.Entities public string Code { get; set; } public bool IsDeleted { get; set; } public DateTime LastModAt { get; set; } - public string LastModBy { get; set; } + public string LastModBy { get; set; } = null!; public DateTime CreatedAt { get; set; } - public string CreatedBy { get; set; } + public string CreatedBy { get; set; } = null!; } } diff --git a/src/WorkFlowCheck.DL/Entities/Equipment.cs b/src/WorkFlowCheck.DL/Entities/Equipment.cs index d66b55a..ad4cdde 100644 --- a/src/WorkFlowCheck.DL/Entities/Equipment.cs +++ b/src/WorkFlowCheck.DL/Entities/Equipment.cs @@ -10,12 +10,12 @@ namespace WorkFlowCheck.DL.Entities public class Equipment :ISoftDeletableEntity,IAuditableEntity { public int Id { get; set; } - public string ShortName { get; set; } - public string EquipmentNumber { get; set; } + public string ShortName { get; set; } = null!; + public string EquipmentNumber { get; set; } = null!; public bool IsDeleted { get ; set ; } public DateTime LastModAt { get ; set ; } - public string LastModBy { get ; set ; } + public string LastModBy { get ; set ; } = null!; public DateTime CreatedAt { get ; set ; } - public string CreatedBy { get ; set ; } + public string CreatedBy { get ; set ; } = null!; } } diff --git a/src/WorkFlowCheck.DL/Entities/Location.cs b/src/WorkFlowCheck.DL/Entities/Location.cs index ca34172..f98e9b8 100644 --- a/src/WorkFlowCheck.DL/Entities/Location.cs +++ b/src/WorkFlowCheck.DL/Entities/Location.cs @@ -13,8 +13,8 @@ namespace WorkFlowCheck.DL.Entities public string FullName { get; set; } = null!; public bool IsDeleted { get ; set ; } public DateTime LastModAt { get ; set ; } - public string LastModBy { get ; set ; } + public string LastModBy { get ; set ; } = null!; public DateTime CreatedAt { get ; set ; } - public string CreatedBy { get ; set ; } + public string CreatedBy { get ; set ; } = null!; } } diff --git a/src/WorkFlowCheck.DL/Entities/Role.cs b/src/WorkFlowCheck.DL/Entities/Role.cs index dccbb26..f190af3 100644 --- a/src/WorkFlowCheck.DL/Entities/Role.cs +++ b/src/WorkFlowCheck.DL/Entities/Role.cs @@ -11,11 +11,11 @@ namespace WorkFlowCheck.DL.Entities public class Role :ISoftDeletableEntity,IAuditableEntity { public int Id { get; set; } - public string RoleName { get; set; } + public string RoleName { get; set; } = null!; public bool IsDeleted { get ; set ; } public DateTime LastModAt { get ; set ; } - public string LastModBy { get ; set ; } + public string LastModBy { get ; set ; } = null!; public DateTime CreatedAt { get ; set ; } - public string CreatedBy { get ; set ; } + public string CreatedBy { get ; set ; } = null!; } } diff --git a/src/WorkFlowCheck.DL/Entities/UsersCheckListTemplateHeader.cs b/src/WorkFlowCheck.DL/Entities/RoleCheckListTemplateHeader.cs similarity index 65% rename from src/WorkFlowCheck.DL/Entities/UsersCheckListTemplateHeader.cs rename to src/WorkFlowCheck.DL/Entities/RoleCheckListTemplateHeader.cs index c92906e..7d89ff5 100644 --- a/src/WorkFlowCheck.DL/Entities/UsersCheckListTemplateHeader.cs +++ b/src/WorkFlowCheck.DL/Entities/RoleCheckListTemplateHeader.cs @@ -2,13 +2,13 @@ namespace WorkFlowCheck.DL.Entities { - public class UsersCheckListTemplateHeader + public class RoleCheckListTemplateHeader { public int Id { get; set; } - public int UsersId { get; set; } - public virtual User User { get; set; } + public int RoleId { get; set; } + public virtual Role Role { get; set; } = null!; public int CheckListTemplateHeaderId { get; set; } - public virtual CheckListTemplateHeader CheckListTemplateHeader { get; set; } + public virtual CheckListTemplateHeader CheckListTemplateHeader { get; set; } = null!; public bool Enabled { get; set; } = false; } } diff --git a/src/WorkFlowCheck.DL/Entities/User.cs b/src/WorkFlowCheck.DL/Entities/User.cs index 9744c99..2555c17 100644 --- a/src/WorkFlowCheck.DL/Entities/User.cs +++ b/src/WorkFlowCheck.DL/Entities/User.cs @@ -12,9 +12,9 @@ namespace WorkFlowCheck.DL.Entities public string UserName { get; set; } = null!; public string? PasswordHash { get; set; } = null; public DateTime LastModAt { get ; set ; } - public string LastModBy { get ; set ; } + public string LastModBy { get ; set ; } = null!; public DateTime CreatedAt { get ; set ; } - public string CreatedBy { get ; set ; } + public string CreatedBy { get ; set ; } = null!; public bool IsDeleted { get ; set ; } } } diff --git a/src/WorkFlowCheck.DL/Entities/UserRole.cs b/src/WorkFlowCheck.DL/Entities/UserRole.cs new file mode 100644 index 0000000..0eebcc8 --- /dev/null +++ b/src/WorkFlowCheck.DL/Entities/UserRole.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WorkFlowCheck.DL.Entities +{ + public class UserRole + { + public int Id { get; set; } + public int RoleId { get; set; } = 0; + public virtual Role Role { get; set; } = null!; + public int UserId { get; set; } + public virtual User User { get; set; } = null!; + } +} diff --git a/src/WorkFlowCheck.DL/Migrations/20250204120742_InitialCreate.Designer.cs b/src/WorkFlowCheck.DL/Migrations/20250219111008_InitialCreate.Designer.cs similarity index 88% rename from src/WorkFlowCheck.DL/Migrations/20250204120742_InitialCreate.Designer.cs rename to src/WorkFlowCheck.DL/Migrations/20250219111008_InitialCreate.Designer.cs index 27df82a..79df59f 100644 --- a/src/WorkFlowCheck.DL/Migrations/20250204120742_InitialCreate.Designer.cs +++ b/src/WorkFlowCheck.DL/Migrations/20250219111008_InitialCreate.Designer.cs @@ -12,7 +12,7 @@ using WorkFlowCheck.DL; namespace WorkFlowCheck.DL.Migrations { [DbContext(typeof(AppDbContext))] - [Migration("20250204120742_InitialCreate")] + [Migration("20250219111008_InitialCreate")] partial class InitialCreate { /// @@ -309,6 +309,32 @@ namespace WorkFlowCheck.DL.Migrations b.ToTable("Roles", (string)null); }); + modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckListTemplateHeader", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CheckListTemplateHeaderId") + .HasColumnType("int"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CheckListTemplateHeaderId"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleCheckListTemplateHeader", (string)null); + }); + modelBuilder.Entity("WorkFlowCheck.DL.Entities.User", b => { b.Property("Id") @@ -361,12 +387,12 @@ namespace WorkFlowCheck.DL.Migrations new { Id = 1, - CreatedAt = new DateTime(2025, 2, 4, 12, 7, 41, 52, DateTimeKind.Utc).AddTicks(7796), + CreatedAt = new DateTime(2025, 2, 19, 11, 10, 8, 377, DateTimeKind.Utc).AddTicks(26), CreatedBy = "System", Email = "admin@nuvolar.hu", FirstName = "Administrator", IsDeleted = false, - LastModAt = new DateTime(2025, 2, 4, 12, 7, 41, 52, DateTimeKind.Utc).AddTicks(7803), + LastModAt = new DateTime(2025, 2, 19, 11, 10, 8, 377, DateTimeKind.Utc).AddTicks(29), LastModBy = "System", LastName = "System", PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY", @@ -375,12 +401,12 @@ namespace WorkFlowCheck.DL.Migrations new { Id = 2, - CreatedAt = new DateTime(2025, 2, 4, 12, 7, 41, 64, DateTimeKind.Utc).AddTicks(4114), + CreatedAt = new DateTime(2025, 2, 19, 11, 10, 8, 389, DateTimeKind.Utc).AddTicks(2814), CreatedBy = "System", Email = "user@nuvolar.hu", FirstName = "User", IsDeleted = false, - LastModAt = new DateTime(2025, 2, 4, 12, 7, 41, 64, DateTimeKind.Utc).AddTicks(4117), + LastModAt = new DateTime(2025, 2, 19, 11, 10, 8, 389, DateTimeKind.Utc).AddTicks(2817), LastModBy = "System", LastName = "System", PasswordHash = "eGM0NUREZnJ0ISFFRDIxMPwM2D9sQSj7zmaSBIsOGe0I9hBFwCGPVbyrYMA5EnKG", @@ -388,7 +414,7 @@ namespace WorkFlowCheck.DL.Migrations }); }); - modelBuilder.Entity("WorkFlowCheck.DL.Entities.UsersCheckListTemplateHeader", b => + modelBuilder.Entity("WorkFlowCheck.DL.Entities.UserRole", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -396,25 +422,19 @@ namespace WorkFlowCheck.DL.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("CheckListTemplateHeaderId") + b.Property("RoleId") .HasColumnType("int"); - b.Property("Enabled") - .HasColumnType("bit"); - b.Property("UserId") .HasColumnType("int"); - b.Property("UsersId") - .HasColumnType("int"); - b.HasKey("Id"); - b.HasIndex("CheckListTemplateHeaderId"); + b.HasIndex("RoleId"); b.HasIndex("UserId"); - b.ToTable("UsersCheckListTemplateHeader", (string)null); + b.ToTable("UserRoles"); }); modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateRow", b => @@ -429,7 +449,7 @@ namespace WorkFlowCheck.DL.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("WorkFlowCheck.DL.Entities.CheckPoint", "EquipmentPoint") + b.HasOne("WorkFlowCheck.DL.Entities.CheckPoint", "CheckPoint") .WithMany() .HasForeignKey("CheckPointId") .OnDelete(DeleteBehavior.Cascade) @@ -443,12 +463,12 @@ namespace WorkFlowCheck.DL.Migrations b.Navigation("CheckListTemplateHeader"); - b.Navigation("Equipment"); + b.Navigation("CheckPoint"); - b.Navigation("EquipmentPoint"); + b.Navigation("Equipment"); }); - modelBuilder.Entity("WorkFlowCheck.DL.Entities.UsersCheckListTemplateHeader", b => + modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckListTemplateHeader", b => { b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader") .WithMany() @@ -456,13 +476,32 @@ namespace WorkFlowCheck.DL.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CheckListTemplateHeader"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.UserRole", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.HasOne("WorkFlowCheck.DL.Entities.User", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.Navigation("CheckListTemplateHeader"); + b.Navigation("Role"); b.Navigation("User"); }); diff --git a/src/WorkFlowCheck.DL/Migrations/20250204120742_InitialCreate.cs b/src/WorkFlowCheck.DL/Migrations/20250219111008_InitialCreate.cs similarity index 83% rename from src/WorkFlowCheck.DL/Migrations/20250204120742_InitialCreate.cs rename to src/WorkFlowCheck.DL/Migrations/20250219111008_InitialCreate.cs index 79a2bcf..18e99f8 100644 --- a/src/WorkFlowCheck.DL/Migrations/20250204120742_InitialCreate.cs +++ b/src/WorkFlowCheck.DL/Migrations/20250219111008_InitialCreate.cs @@ -196,27 +196,52 @@ namespace WorkFlowCheck.DL.Migrations }); migrationBuilder.CreateTable( - name: "UsersCheckListTemplateHeader", + name: "RoleCheckListTemplateHeader", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - UsersId = table.Column(type: "int", nullable: false), - UserId = table.Column(type: "int", nullable: false), + RoleId = table.Column(type: "int", nullable: false), CheckListTemplateHeaderId = table.Column(type: "int", nullable: false), Enabled = table.Column(type: "bit", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_UsersCheckListTemplateHeader", x => x.Id); + table.PrimaryKey("PK_RoleCheckListTemplateHeader", x => x.Id); table.ForeignKey( - name: "FK_UsersCheckListTemplateHeader_CheckListTemplateHeader_CheckListTemplateHeaderId", + name: "FK_RoleCheckListTemplateHeader_CheckListTemplateHeader_CheckListTemplateHeaderId", column: x => x.CheckListTemplateHeaderId, principalTable: "CheckListTemplateHeader", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( - name: "FK_UsersCheckListTemplateHeader_Users_UserId", + name: "FK_RoleCheckListTemplateHeader_Roles_RoleId", + column: x => x.RoleId, + principalTable: "Roles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "UserRoles", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + RoleId = table.Column(type: "int", nullable: false), + UserId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_UserRoles", x => x.Id); + table.ForeignKey( + name: "FK_UserRoles_Roles_RoleId", + column: x => x.RoleId, + principalTable: "Roles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_UserRoles_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", @@ -228,8 +253,8 @@ namespace WorkFlowCheck.DL.Migrations columns: new[] { "Id", "CreatedAt", "CreatedBy", "Email", "FirstName", "IsDeleted", "LastModAt", "LastModBy", "LastName", "PasswordHash", "UserName" }, values: new object[,] { - { 1, new DateTime(2025, 2, 4, 12, 7, 41, 52, DateTimeKind.Utc).AddTicks(7796), "System", "admin@nuvolar.hu", "Administrator", false, new DateTime(2025, 2, 4, 12, 7, 41, 52, DateTimeKind.Utc).AddTicks(7803), "System", "System", "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY", "admin" }, - { 2, new DateTime(2025, 2, 4, 12, 7, 41, 64, DateTimeKind.Utc).AddTicks(4114), "System", "user@nuvolar.hu", "User", false, new DateTime(2025, 2, 4, 12, 7, 41, 64, DateTimeKind.Utc).AddTicks(4117), "System", "System", "eGM0NUREZnJ0ISFFRDIxMPwM2D9sQSj7zmaSBIsOGe0I9hBFwCGPVbyrYMA5EnKG", "user" } + { 1, new DateTime(2025, 2, 19, 11, 10, 8, 377, DateTimeKind.Utc).AddTicks(26), "System", "admin@nuvolar.hu", "Administrator", false, new DateTime(2025, 2, 19, 11, 10, 8, 377, DateTimeKind.Utc).AddTicks(29), "System", "System", "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY", "admin" }, + { 2, new DateTime(2025, 2, 19, 11, 10, 8, 389, DateTimeKind.Utc).AddTicks(2814), "System", "user@nuvolar.hu", "User", false, new DateTime(2025, 2, 19, 11, 10, 8, 389, DateTimeKind.Utc).AddTicks(2817), "System", "System", "eGM0NUREZnJ0ISFFRDIxMPwM2D9sQSj7zmaSBIsOGe0I9hBFwCGPVbyrYMA5EnKG", "user" } }); migrationBuilder.CreateIndex( @@ -253,13 +278,23 @@ namespace WorkFlowCheck.DL.Migrations column: "EquipmentId"); migrationBuilder.CreateIndex( - name: "IX_UsersCheckListTemplateHeader_CheckListTemplateHeaderId", - table: "UsersCheckListTemplateHeader", + name: "IX_RoleCheckListTemplateHeader_CheckListTemplateHeaderId", + table: "RoleCheckListTemplateHeader", column: "CheckListTemplateHeaderId"); migrationBuilder.CreateIndex( - name: "IX_UsersCheckListTemplateHeader_UserId", - table: "UsersCheckListTemplateHeader", + name: "IX_RoleCheckListTemplateHeader_RoleId", + table: "RoleCheckListTemplateHeader", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "IX_UserRoles_RoleId", + table: "UserRoles", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "IX_UserRoles_UserId", + table: "UserRoles", column: "UserId"); } @@ -273,10 +308,10 @@ namespace WorkFlowCheck.DL.Migrations name: "Location"); migrationBuilder.DropTable( - name: "Roles"); + name: "RoleCheckListTemplateHeader"); migrationBuilder.DropTable( - name: "UsersCheckListTemplateHeader"); + name: "UserRoles"); migrationBuilder.DropTable( name: "CheckListHeader"); @@ -290,6 +325,9 @@ namespace WorkFlowCheck.DL.Migrations migrationBuilder.DropTable( name: "CheckListTemplateHeader"); + migrationBuilder.DropTable( + name: "Roles"); + migrationBuilder.DropTable( name: "Users"); } diff --git a/src/WorkFlowCheck.DL/Migrations/20250219115948_Extend001.Designer.cs b/src/WorkFlowCheck.DL/Migrations/20250219115948_Extend001.Designer.cs new file mode 100644 index 0000000..ad584b6 --- /dev/null +++ b/src/WorkFlowCheck.DL/Migrations/20250219115948_Extend001.Designer.cs @@ -0,0 +1,570 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using WorkFlowCheck.DL; + +#nullable disable + +namespace WorkFlowCheck.DL.Migrations +{ + [DbContext(typeof(AppDbContext))] + [Migration("20250219115948_Extend001")] + partial class Extend001 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListHeader", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DocumentNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsStorno") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("CheckListHeader", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListRow", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Answer") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CheckListHeaderId") + .HasColumnType("int"); + + b.Property("CheckListTemplateRowId") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CheckListHeaderId"); + + b.HasIndex("CheckListTemplateRowId"); + + b.ToTable("CheckListRow", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("CheckListTemplateHeader", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateRow", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CheckListTemplateHeaderId") + .HasColumnType("int"); + + b.Property("CheckPointId") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EquipmentId") + .HasColumnType("int"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OperationDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RowIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CheckListTemplateHeaderId"); + + b.HasIndex("CheckPointId"); + + b.HasIndex("EquipmentId"); + + b.ToTable("CheckListTemplateRow", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckPoint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Code") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("CheckPoint", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.Equipment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EquipmentNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Equipment", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Location", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RoleName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Roles", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckListTemplateHeader", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CheckListTemplateHeaderId") + .HasColumnType("int"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CheckListTemplateHeaderId"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleCheckListTemplateHeader", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Users", (string)null); + + b.HasData( + new + { + Id = 1, + CreatedAt = new DateTime(2025, 2, 19, 11, 59, 47, 916, DateTimeKind.Utc).AddTicks(948), + CreatedBy = "System", + Email = "admin@nuvolar.hu", + FirstName = "Administrator", + IsDeleted = false, + LastModAt = new DateTime(2025, 2, 19, 11, 59, 47, 916, DateTimeKind.Utc).AddTicks(951), + LastModBy = "System", + LastName = "System", + PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY", + UserName = "admin" + }, + new + { + Id = 2, + CreatedAt = new DateTime(2025, 2, 19, 11, 59, 47, 927, DateTimeKind.Utc).AddTicks(3684), + CreatedBy = "System", + Email = "user@nuvolar.hu", + FirstName = "User", + IsDeleted = false, + LastModAt = new DateTime(2025, 2, 19, 11, 59, 47, 927, DateTimeKind.Utc).AddTicks(3685), + LastModBy = "System", + LastName = "System", + PasswordHash = "eGM0NUREZnJ0ISFFRDIxMPwM2D9sQSj7zmaSBIsOGe0I9hBFwCGPVbyrYMA5EnKG", + UserName = "user" + }); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.HasIndex("UserId"); + + b.ToTable("UserRoles", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListRow", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.CheckListHeader", "CheckListHeader") + .WithMany("CheckListRows") + .HasForeignKey("CheckListHeaderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateRow", "CheckListTemplateRow") + .WithMany() + .HasForeignKey("CheckListTemplateRowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CheckListHeader"); + + b.Navigation("CheckListTemplateRow"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateRow", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader") + .WithMany() + .HasForeignKey("CheckListTemplateHeaderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WorkFlowCheck.DL.Entities.CheckPoint", "CheckPoint") + .WithMany() + .HasForeignKey("CheckPointId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WorkFlowCheck.DL.Entities.Equipment", "Equipment") + .WithMany() + .HasForeignKey("EquipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CheckListTemplateHeader"); + + b.Navigation("CheckPoint"); + + b.Navigation("Equipment"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckListTemplateHeader", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader") + .WithMany() + .HasForeignKey("CheckListTemplateHeaderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CheckListTemplateHeader"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.UserRole", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WorkFlowCheck.DL.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListHeader", b => + { + b.Navigation("CheckListRows"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/WorkFlowCheck.DL/Migrations/20250219115948_Extend001.cs b/src/WorkFlowCheck.DL/Migrations/20250219115948_Extend001.cs new file mode 100644 index 0000000..973dbb8 --- /dev/null +++ b/src/WorkFlowCheck.DL/Migrations/20250219115948_Extend001.cs @@ -0,0 +1,122 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace WorkFlowCheck.DL.Migrations +{ + /// + public partial class Extend001 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_CheckListTemplateRow_CheckListHeader_CheckListHeaderId", + table: "CheckListTemplateRow"); + + migrationBuilder.DropIndex( + name: "IX_CheckListTemplateRow_CheckListHeaderId", + table: "CheckListTemplateRow"); + + migrationBuilder.DropColumn( + name: "CheckListHeaderId", + table: "CheckListTemplateRow"); + + migrationBuilder.CreateTable( + name: "CheckListRow", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CheckListHeaderId = table.Column(type: "int", nullable: false), + CheckListTemplateRowId = table.Column(type: "int", nullable: false), + Answer = table.Column(type: "nvarchar(max)", nullable: false), + LastModAt = table.Column(type: "datetime2", nullable: false), + LastModBy = table.Column(type: "nvarchar(max)", nullable: false), + CreatedAt = table.Column(type: "datetime2", nullable: false), + CreatedBy = table.Column(type: "nvarchar(max)", nullable: false), + IsDeleted = table.Column(type: "bit", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CheckListRow", x => x.Id); + table.ForeignKey( + name: "FK_CheckListRow_CheckListHeader_CheckListHeaderId", + column: x => x.CheckListHeaderId, + principalTable: "CheckListHeader", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CheckListRow_CheckListTemplateRow_CheckListTemplateRowId", + column: x => x.CheckListTemplateRowId, + principalTable: "CheckListTemplateRow", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.UpdateData( + table: "Users", + keyColumn: "Id", + keyValue: 1, + columns: new[] { "CreatedAt", "LastModAt" }, + values: new object[] { new DateTime(2025, 2, 19, 11, 59, 47, 916, DateTimeKind.Utc).AddTicks(948), new DateTime(2025, 2, 19, 11, 59, 47, 916, DateTimeKind.Utc).AddTicks(951) }); + + migrationBuilder.UpdateData( + table: "Users", + keyColumn: "Id", + keyValue: 2, + columns: new[] { "CreatedAt", "LastModAt" }, + values: new object[] { new DateTime(2025, 2, 19, 11, 59, 47, 927, DateTimeKind.Utc).AddTicks(3684), new DateTime(2025, 2, 19, 11, 59, 47, 927, DateTimeKind.Utc).AddTicks(3685) }); + + migrationBuilder.CreateIndex( + name: "IX_CheckListRow_CheckListHeaderId", + table: "CheckListRow", + column: "CheckListHeaderId"); + + migrationBuilder.CreateIndex( + name: "IX_CheckListRow_CheckListTemplateRowId", + table: "CheckListRow", + column: "CheckListTemplateRowId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CheckListRow"); + + migrationBuilder.AddColumn( + name: "CheckListHeaderId", + table: "CheckListTemplateRow", + type: "int", + nullable: true); + + migrationBuilder.UpdateData( + table: "Users", + keyColumn: "Id", + keyValue: 1, + columns: new[] { "CreatedAt", "LastModAt" }, + values: new object[] { new DateTime(2025, 2, 19, 11, 10, 8, 377, DateTimeKind.Utc).AddTicks(26), new DateTime(2025, 2, 19, 11, 10, 8, 377, DateTimeKind.Utc).AddTicks(29) }); + + migrationBuilder.UpdateData( + table: "Users", + keyColumn: "Id", + keyValue: 2, + columns: new[] { "CreatedAt", "LastModAt" }, + values: new object[] { new DateTime(2025, 2, 19, 11, 10, 8, 389, DateTimeKind.Utc).AddTicks(2814), new DateTime(2025, 2, 19, 11, 10, 8, 389, DateTimeKind.Utc).AddTicks(2817) }); + + migrationBuilder.CreateIndex( + name: "IX_CheckListTemplateRow_CheckListHeaderId", + table: "CheckListTemplateRow", + column: "CheckListHeaderId"); + + migrationBuilder.AddForeignKey( + name: "FK_CheckListTemplateRow_CheckListHeader_CheckListHeaderId", + table: "CheckListTemplateRow", + column: "CheckListHeaderId", + principalTable: "CheckListHeader", + principalColumn: "Id"); + } + } +} diff --git a/src/WorkFlowCheck.DL/Migrations/20250219125200_Extend002.Designer.cs b/src/WorkFlowCheck.DL/Migrations/20250219125200_Extend002.Designer.cs new file mode 100644 index 0000000..0cf2a8d --- /dev/null +++ b/src/WorkFlowCheck.DL/Migrations/20250219125200_Extend002.Designer.cs @@ -0,0 +1,578 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using WorkFlowCheck.DL; + +#nullable disable + +namespace WorkFlowCheck.DL.Migrations +{ + [DbContext(typeof(AppDbContext))] + [Migration("20250219125200_Extend002")] + partial class Extend002 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListHeader", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DocumentNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsStorno") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("CheckListHeader", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListRow", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Answer") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CheckListHeaderId") + .HasColumnType("int"); + + b.Property("CheckListTemplateRowId") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Photo") + .IsRequired() + .HasColumnType("varbinary(max)"); + + b.HasKey("Id"); + + b.HasIndex("CheckListHeaderId"); + + b.HasIndex("CheckListTemplateRowId"); + + b.ToTable("CheckListRow", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("CheckListTemplateHeader", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateRow", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AnswerType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CheckListTemplateHeaderId") + .HasColumnType("int"); + + b.Property("CheckPointId") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EquipmentId") + .HasColumnType("int"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OperationDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RowIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CheckListTemplateHeaderId"); + + b.HasIndex("CheckPointId"); + + b.HasIndex("EquipmentId"); + + b.ToTable("CheckListTemplateRow", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckPoint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Code") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("CheckPoint", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.Equipment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EquipmentNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Equipment", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Location", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RoleName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Roles", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckListTemplateHeader", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CheckListTemplateHeaderId") + .HasColumnType("int"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CheckListTemplateHeaderId"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleCheckListTemplateHeader", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Users", (string)null); + + b.HasData( + new + { + Id = 1, + CreatedAt = new DateTime(2025, 2, 19, 12, 52, 0, 186, DateTimeKind.Utc).AddTicks(2300), + CreatedBy = "System", + Email = "admin@nuvolar.hu", + FirstName = "Administrator", + IsDeleted = false, + LastModAt = new DateTime(2025, 2, 19, 12, 52, 0, 186, DateTimeKind.Utc).AddTicks(2303), + LastModBy = "System", + LastName = "System", + PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY", + UserName = "admin" + }, + new + { + Id = 2, + CreatedAt = new DateTime(2025, 2, 19, 12, 52, 0, 197, DateTimeKind.Utc).AddTicks(6358), + CreatedBy = "System", + Email = "user@nuvolar.hu", + FirstName = "User", + IsDeleted = false, + LastModAt = new DateTime(2025, 2, 19, 12, 52, 0, 197, DateTimeKind.Utc).AddTicks(6360), + LastModBy = "System", + LastName = "System", + PasswordHash = "eGM0NUREZnJ0ISFFRDIxMPwM2D9sQSj7zmaSBIsOGe0I9hBFwCGPVbyrYMA5EnKG", + UserName = "user" + }); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.HasIndex("UserId"); + + b.ToTable("UserRoles", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListRow", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.CheckListHeader", "CheckListHeader") + .WithMany("CheckListRows") + .HasForeignKey("CheckListHeaderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateRow", "CheckListTemplateRow") + .WithMany() + .HasForeignKey("CheckListTemplateRowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CheckListHeader"); + + b.Navigation("CheckListTemplateRow"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateRow", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader") + .WithMany() + .HasForeignKey("CheckListTemplateHeaderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WorkFlowCheck.DL.Entities.CheckPoint", "CheckPoint") + .WithMany() + .HasForeignKey("CheckPointId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WorkFlowCheck.DL.Entities.Equipment", "Equipment") + .WithMany() + .HasForeignKey("EquipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CheckListTemplateHeader"); + + b.Navigation("CheckPoint"); + + b.Navigation("Equipment"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckListTemplateHeader", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader") + .WithMany() + .HasForeignKey("CheckListTemplateHeaderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CheckListTemplateHeader"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.UserRole", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WorkFlowCheck.DL.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListHeader", b => + { + b.Navigation("CheckListRows"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/WorkFlowCheck.DL/Migrations/20250219125200_Extend002.cs b/src/WorkFlowCheck.DL/Migrations/20250219125200_Extend002.cs new file mode 100644 index 0000000..4c0193b --- /dev/null +++ b/src/WorkFlowCheck.DL/Migrations/20250219125200_Extend002.cs @@ -0,0 +1,69 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace WorkFlowCheck.DL.Migrations +{ + /// + public partial class Extend002 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "AnswerType", + table: "CheckListTemplateRow", + type: "nvarchar(max)", + nullable: false, + defaultValue: ""); + + migrationBuilder.AddColumn( + name: "Photo", + table: "CheckListRow", + type: "varbinary(max)", + nullable: false, + defaultValue: new byte[0]); + + migrationBuilder.UpdateData( + table: "Users", + keyColumn: "Id", + keyValue: 1, + columns: new[] { "CreatedAt", "LastModAt" }, + values: new object[] { new DateTime(2025, 2, 19, 12, 52, 0, 186, DateTimeKind.Utc).AddTicks(2300), new DateTime(2025, 2, 19, 12, 52, 0, 186, DateTimeKind.Utc).AddTicks(2303) }); + + migrationBuilder.UpdateData( + table: "Users", + keyColumn: "Id", + keyValue: 2, + columns: new[] { "CreatedAt", "LastModAt" }, + values: new object[] { new DateTime(2025, 2, 19, 12, 52, 0, 197, DateTimeKind.Utc).AddTicks(6358), new DateTime(2025, 2, 19, 12, 52, 0, 197, DateTimeKind.Utc).AddTicks(6360) }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "AnswerType", + table: "CheckListTemplateRow"); + + migrationBuilder.DropColumn( + name: "Photo", + table: "CheckListRow"); + + migrationBuilder.UpdateData( + table: "Users", + keyColumn: "Id", + keyValue: 1, + columns: new[] { "CreatedAt", "LastModAt" }, + values: new object[] { new DateTime(2025, 2, 19, 11, 59, 47, 916, DateTimeKind.Utc).AddTicks(948), new DateTime(2025, 2, 19, 11, 59, 47, 916, DateTimeKind.Utc).AddTicks(951) }); + + migrationBuilder.UpdateData( + table: "Users", + keyColumn: "Id", + keyValue: 2, + columns: new[] { "CreatedAt", "LastModAt" }, + values: new object[] { new DateTime(2025, 2, 19, 11, 59, 47, 927, DateTimeKind.Utc).AddTicks(3684), new DateTime(2025, 2, 19, 11, 59, 47, 927, DateTimeKind.Utc).AddTicks(3685) }); + } + } +} diff --git a/src/WorkFlowCheck.DL/Migrations/AppDbContextModelSnapshot.cs b/src/WorkFlowCheck.DL/Migrations/AppDbContextModelSnapshot.cs index fde7339..79f7101 100644 --- a/src/WorkFlowCheck.DL/Migrations/AppDbContextModelSnapshot.cs +++ b/src/WorkFlowCheck.DL/Migrations/AppDbContextModelSnapshot.cs @@ -67,6 +67,54 @@ namespace WorkFlowCheck.DL.Migrations b.ToTable("CheckListHeader", (string)null); }); + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListRow", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Answer") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CheckListHeaderId") + .HasColumnType("int"); + + b.Property("CheckListTemplateRowId") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Photo") + .IsRequired() + .HasColumnType("varbinary(max)"); + + b.HasKey("Id"); + + b.HasIndex("CheckListHeaderId"); + + b.HasIndex("CheckListTemplateRowId"); + + b.ToTable("CheckListRow", (string)null); + }); + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", b => { b.Property("Id") @@ -113,8 +161,9 @@ namespace WorkFlowCheck.DL.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("CheckListHeaderId") - .HasColumnType("int"); + b.Property("AnswerType") + .IsRequired() + .HasColumnType("nvarchar(max)"); b.Property("CheckListTemplateHeaderId") .HasColumnType("int"); @@ -151,8 +200,6 @@ namespace WorkFlowCheck.DL.Migrations b.HasKey("Id"); - b.HasIndex("CheckListHeaderId"); - b.HasIndex("CheckListTemplateHeaderId"); b.HasIndex("CheckPointId"); @@ -306,6 +353,32 @@ namespace WorkFlowCheck.DL.Migrations b.ToTable("Roles", (string)null); }); + modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckListTemplateHeader", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CheckListTemplateHeaderId") + .HasColumnType("int"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CheckListTemplateHeaderId"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleCheckListTemplateHeader", (string)null); + }); + modelBuilder.Entity("WorkFlowCheck.DL.Entities.User", b => { b.Property("Id") @@ -358,12 +431,12 @@ namespace WorkFlowCheck.DL.Migrations new { Id = 1, - CreatedAt = new DateTime(2025, 2, 4, 12, 7, 41, 52, DateTimeKind.Utc).AddTicks(7796), + CreatedAt = new DateTime(2025, 2, 19, 12, 52, 0, 186, DateTimeKind.Utc).AddTicks(2300), CreatedBy = "System", Email = "admin@nuvolar.hu", FirstName = "Administrator", IsDeleted = false, - LastModAt = new DateTime(2025, 2, 4, 12, 7, 41, 52, DateTimeKind.Utc).AddTicks(7803), + LastModAt = new DateTime(2025, 2, 19, 12, 52, 0, 186, DateTimeKind.Utc).AddTicks(2303), LastModBy = "System", LastName = "System", PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY", @@ -372,12 +445,12 @@ namespace WorkFlowCheck.DL.Migrations new { Id = 2, - CreatedAt = new DateTime(2025, 2, 4, 12, 7, 41, 64, DateTimeKind.Utc).AddTicks(4114), + CreatedAt = new DateTime(2025, 2, 19, 12, 52, 0, 197, DateTimeKind.Utc).AddTicks(6358), CreatedBy = "System", Email = "user@nuvolar.hu", FirstName = "User", IsDeleted = false, - LastModAt = new DateTime(2025, 2, 4, 12, 7, 41, 64, DateTimeKind.Utc).AddTicks(4117), + LastModAt = new DateTime(2025, 2, 19, 12, 52, 0, 197, DateTimeKind.Utc).AddTicks(6360), LastModBy = "System", LastName = "System", PasswordHash = "eGM0NUREZnJ0ISFFRDIxMPwM2D9sQSj7zmaSBIsOGe0I9hBFwCGPVbyrYMA5EnKG", @@ -385,7 +458,7 @@ namespace WorkFlowCheck.DL.Migrations }); }); - modelBuilder.Entity("WorkFlowCheck.DL.Entities.UsersCheckListTemplateHeader", b => + modelBuilder.Entity("WorkFlowCheck.DL.Entities.UserRole", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -393,40 +466,49 @@ namespace WorkFlowCheck.DL.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("CheckListTemplateHeaderId") + b.Property("RoleId") .HasColumnType("int"); - b.Property("Enabled") - .HasColumnType("bit"); - b.Property("UserId") .HasColumnType("int"); - b.Property("UsersId") - .HasColumnType("int"); - b.HasKey("Id"); - b.HasIndex("CheckListTemplateHeaderId"); + b.HasIndex("RoleId"); b.HasIndex("UserId"); - b.ToTable("UsersCheckListTemplateHeader", (string)null); + b.ToTable("UserRoles", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListRow", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.CheckListHeader", "CheckListHeader") + .WithMany("CheckListRows") + .HasForeignKey("CheckListHeaderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateRow", "CheckListTemplateRow") + .WithMany() + .HasForeignKey("CheckListTemplateRowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CheckListHeader"); + + b.Navigation("CheckListTemplateRow"); }); modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateRow", b => { - b.HasOne("WorkFlowCheck.DL.Entities.CheckListHeader", null) - .WithMany("CheckListTemplateRows") - .HasForeignKey("CheckListHeaderId"); - b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader") .WithMany() .HasForeignKey("CheckListTemplateHeaderId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("WorkFlowCheck.DL.Entities.CheckPoint", "EquipmentPoint") + b.HasOne("WorkFlowCheck.DL.Entities.CheckPoint", "CheckPoint") .WithMany() .HasForeignKey("CheckPointId") .OnDelete(DeleteBehavior.Cascade) @@ -440,12 +522,12 @@ namespace WorkFlowCheck.DL.Migrations b.Navigation("CheckListTemplateHeader"); - b.Navigation("Equipment"); + b.Navigation("CheckPoint"); - b.Navigation("EquipmentPoint"); + b.Navigation("Equipment"); }); - modelBuilder.Entity("WorkFlowCheck.DL.Entities.UsersCheckListTemplateHeader", b => + modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckListTemplateHeader", b => { b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader") .WithMany() @@ -453,20 +535,39 @@ namespace WorkFlowCheck.DL.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CheckListTemplateHeader"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.UserRole", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.HasOne("WorkFlowCheck.DL.Entities.User", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.Navigation("CheckListTemplateHeader"); + b.Navigation("Role"); b.Navigation("User"); }); modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListHeader", b => { - b.Navigation("CheckListTemplateRows"); + b.Navigation("CheckListRows"); }); #pragma warning restore 612, 618 }