diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/OrganizationController.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/OrganizationController.cs index 8584a78..b1c93de 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/OrganizationController.cs +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/OrganizationController.cs @@ -19,14 +19,18 @@ namespace FSI.Prj.Mgt.Controllers _context = context; } - public async Task Index(string searchString, int? page) + public async Task IndexAsync(string searchString, int? page) { - await UpdateFullShortName(_context.Organizations.ToList()); + await UpdateFullShortNameAsync(_context.Organizations.ToList()); IQueryable items = _context.Organizations.Include(x => x.Parent).OrderBy(x => x.FullShortName); if (!string.IsNullOrEmpty(searchString)) { - items = items.Where(x => x.Name!.Contains(searchString) || x.Description!.Contains(searchString)); + items = items.Where(x => x.ShortName!.Contains(searchString) + || x.Name!.Contains(searchString) + || x.Description!.Contains(searchString) + || x.Parent.Name!.Contains(searchString) + || x.FullShortName!.Contains(searchString)); } return View(await items.ToPagedListAsync(page ?? 1, 10)); @@ -61,6 +65,8 @@ namespace FSI.Prj.Mgt.Controllers //////ViewBag.Json = JsonConvert.SerializeObject(nodes); } + + public async Task AddOrEdit(int id = 0) { @@ -111,7 +117,7 @@ namespace FSI.Prj.Mgt.Controllers { item.FullShortName = GetFullShortName(_context.Organizations.ToList(), item.ParentId, item.ShortName); } - + item.ModificationTimeStamp = DateTime.Now; // Zeitstempel für Modifikation if (ModelState.IsValid) @@ -127,8 +133,8 @@ namespace FSI.Prj.Mgt.Controllers try { item.CreationTimeStamp = item.ModificationTimeStamp; // Zeitstempel für Erstellung - _context.Add(item); - await _context.SaveChangesAsync(); + _context.Add(item); + await _context.SaveChangesAsync(); } catch (Exception ex) { @@ -138,9 +144,9 @@ namespace FSI.Prj.Mgt.Controllers else // Update { try - { + { _context.Update(item); - await _context.SaveChangesAsync(); + await _context.SaveChangesAsync(); } catch (Exception ex) { @@ -161,7 +167,7 @@ namespace FSI.Prj.Mgt.Controllers [HttpPost, ActionName("Delete")] [ValidateAntiForgeryToken] - public async Task DeleteConfirmed(int id) + public async Task DeleteConfirmedAsync(int id) { await _context.Organizations .Where(x => x.ParentId == id) @@ -187,7 +193,7 @@ namespace FSI.Prj.Mgt.Controllers // return RedirectToAction("Index", "Organization"); //} - public async Task UpdateFullShortName(List organizations) + public async Task UpdateFullShortNameAsync(List organizations) { foreach (var organization in organizations) { diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/ProjectController.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/ProjectController.cs index 725127f..16d9b3f 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/ProjectController.cs +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/ProjectController.cs @@ -20,7 +20,7 @@ namespace FSI.Prj.Mgt.Controllers public async Task Index(string searchString, int? page) { - IQueryable items = _context.Projects.Include(x => x.Plant); + IQueryable items = _context.Projects; //.Include(x => x.Organization); if (!string.IsNullOrEmpty(searchString)) { @@ -30,13 +30,14 @@ namespace FSI.Prj.Mgt.Controllers return View(await items.ToPagedListAsync(page ?? 1, 10)); } + public async Task AddOrEdit(int id = 0) { if (id == 0) { var item = new Project(); - item.Plants = _context.Plants.ToList(); + // item.Organizations = _context.Organizations.ToList(); return View(item); } @@ -49,7 +50,7 @@ namespace FSI.Prj.Mgt.Controllers return NotFound(); } - item.Plants = _context.Plants.ToList(); + // item.Organizations = _context.Organizations.ToList(); return View(item); } } @@ -59,16 +60,22 @@ namespace FSI.Prj.Mgt.Controllers public async Task AddOrEdit(int id, Project item) { ModelState.Remove("Plant"); - ModelState.Remove("Plants"); + ModelState.Remove("Organization"); if (ModelState.IsValid) { if (id == 0) // Insert { + try + { + _context.Add(item); + await _context.SaveChangesAsync(); + } + catch (Exception ex) + { - _context.Add(item); - await _context.SaveChangesAsync(); + } } else // Update { @@ -88,7 +95,7 @@ namespace FSI.Prj.Mgt.Controllers { var errors = ModelState.SelectMany(x => x.Value.Errors.Select(z => z.Exception)); } - item.Plants = (_context.Plants.ToList()); + //item.Organizations = (_context.Organizations.ToList()); return Json(new { isValid = false, html = Helper.RenderRazorViewToString(this, "AddOrEdit", item) }); } diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231003081806_Init.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231003081806_Init.cs deleted file mode 100644 index 1f0b904..0000000 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231003081806_Init.cs +++ /dev/null @@ -1,118 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace FSI.Prj.Mgt.Data.Migrations -{ - /// - public partial class Init : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Organizations", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Name = table.Column(type: "nvarchar(max)", nullable: false), - ShortName = table.Column(type: "nvarchar(max)", nullable: false), - Description = table.Column(type: "nvarchar(max)", nullable: true), - ParentId = table.Column(type: "int", nullable: true), - Type = table.Column(type: "int", nullable: false), - CreationTimeStamp = table.Column(type: "datetime2", nullable: false), - ModificationTimeStamp = table.Column(type: "datetime2", nullable: false), - FullShortName = table.Column(type: "nvarchar(max)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Organizations", x => x.Id); - table.ForeignKey( - name: "FK_Organizations_Organizations_ParentId", - column: x => x.ParentId, - principalTable: "Organizations", - principalColumn: "Id"); - }); - - migrationBuilder.CreateTable( - name: "Plants", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ShortName = table.Column(type: "nvarchar(max)", nullable: false), - Name = table.Column(type: "nvarchar(max)", nullable: false), - SubPlantShortName = table.Column(type: "nvarchar(max)", nullable: false), - SubPlantName = table.Column(type: "nvarchar(max)", nullable: false), - ProjectId = table.Column(type: "int", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Plants", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Projects", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - No = table.Column(type: "int", nullable: false), - Name = table.Column(type: "nvarchar(max)", nullable: false), - Description = table.Column(type: "nvarchar(max)", nullable: false), - Status = table.Column(type: "int", nullable: false), - PlantId = table.Column(type: "int", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Projects", x => x.Id); - table.ForeignKey( - name: "FK_Projects_Plants_PlantId", - column: x => x.PlantId, - principalTable: "Plants", - principalColumn: "Id"); - }); - - migrationBuilder.CreateIndex( - name: "IX_Organizations_ParentId", - table: "Organizations", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_Plants_ProjectId", - table: "Plants", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_Projects_PlantId", - table: "Projects", - column: "PlantId"); - - migrationBuilder.AddForeignKey( - name: "FK_Plants_Projects_ProjectId", - table: "Plants", - column: "ProjectId", - principalTable: "Projects", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Plants_Projects_ProjectId", - table: "Plants"); - - migrationBuilder.DropTable( - name: "Organizations"); - - migrationBuilder.DropTable( - name: "Projects"); - - migrationBuilder.DropTable( - name: "Plants"); - } - } -} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010052843_InitOrganization.Designer.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010052843_InitOrganization.Designer.cs new file mode 100644 index 0000000..1e3474f --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010052843_InitOrganization.Designer.cs @@ -0,0 +1,339 @@ +// +using System; +using FSI.Prj.Mgt.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20231010052843_InitOrganization")] + partial class InitOrganization + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FullShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Parent") + .WithMany("Parents") + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Navigation("Parents"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010052843_InitOrganization.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010052843_InitOrganization.cs new file mode 100644 index 0000000..c432643 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010052843_InitOrganization.cs @@ -0,0 +1,52 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + /// + public partial class InitOrganization : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Organizations", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(max)", nullable: false), + ShortName = table.Column(type: "nvarchar(max)", nullable: false), + Description = table.Column(type: "nvarchar(max)", nullable: true), + ParentId = table.Column(type: "int", nullable: true), + Type = table.Column(type: "int", nullable: false), + CreationTimeStamp = table.Column(type: "datetime2", nullable: false), + ModificationTimeStamp = table.Column(type: "datetime2", nullable: false), + FullShortName = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Organizations", x => x.Id); + table.ForeignKey( + name: "FK_Organizations_Organizations_ParentId", + column: x => x.ParentId, + principalTable: "Organizations", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_Organizations_ParentId", + table: "Organizations", + column: "ParentId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Organizations"); + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053101_InitProjects.Designer.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053101_InitProjects.Designer.cs new file mode 100644 index 0000000..58c46d5 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053101_InitProjects.Designer.cs @@ -0,0 +1,386 @@ +// +using System; +using FSI.Prj.Mgt.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20231010053101_InitProjects")] + partial class InitProjects + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FullShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.HasIndex("ProjectId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("No") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Projects"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Parent") + .WithMany("Parents") + .HasForeignKey("ParentId"); + + b.HasOne("FSI.Prj.Mgt.Models.Project", null) + .WithMany("Organizations") + .HasForeignKey("ProjectId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Navigation("Parents"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.Navigation("Organizations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053101_InitProjects.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053101_InitProjects.cs new file mode 100644 index 0000000..069b504 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053101_InitProjects.cs @@ -0,0 +1,70 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + /// + public partial class InitProjects : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Organizations", + type: "int", + nullable: true); + + migrationBuilder.CreateTable( + name: "Projects", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + No = table.Column(type: "int", nullable: false), + Name = table.Column(type: "nvarchar(max)", nullable: false), + Description = table.Column(type: "nvarchar(max)", nullable: false), + Status = table.Column(type: "int", nullable: false), + CreationTimeStamp = table.Column(type: "datetime2", nullable: false), + ModificationTimeStamp = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Projects", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_Organizations_ProjectId", + table: "Organizations", + column: "ProjectId"); + + migrationBuilder.AddForeignKey( + name: "FK_Organizations_Projects_ProjectId", + table: "Organizations", + column: "ProjectId", + principalTable: "Projects", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Organizations_Projects_ProjectId", + table: "Organizations"); + + migrationBuilder.DropTable( + name: "Projects"); + + migrationBuilder.DropIndex( + name: "IX_Organizations_ProjectId", + table: "Organizations"); + + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Organizations"); + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053258_InitProjects2.Designer.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053258_InitProjects2.Designer.cs new file mode 100644 index 0000000..d34b2f5 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053258_InitProjects2.Designer.cs @@ -0,0 +1,372 @@ +// +using System; +using FSI.Prj.Mgt.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20231010053258_InitProjects2")] + partial class InitProjects2 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FullShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("No") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Projects"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Parent") + .WithMany("Parents") + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Navigation("Parents"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053258_InitProjects2.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053258_InitProjects2.cs new file mode 100644 index 0000000..8a00e5d --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053258_InitProjects2.cs @@ -0,0 +1,48 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + /// + public partial class InitProjects2 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Organizations_Projects_ProjectId", + table: "Organizations"); + + migrationBuilder.DropIndex( + name: "IX_Organizations_ProjectId", + table: "Organizations"); + + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Organizations"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Organizations", + type: "int", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_Organizations_ProjectId", + table: "Organizations", + column: "ProjectId"); + + migrationBuilder.AddForeignKey( + name: "FK_Organizations_Projects_ProjectId", + table: "Organizations", + column: "ProjectId", + principalTable: "Projects", + principalColumn: "Id"); + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053350_InitProjects3.Designer.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053350_InitProjects3.Designer.cs new file mode 100644 index 0000000..546b45c --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053350_InitProjects3.Designer.cs @@ -0,0 +1,386 @@ +// +using System; +using FSI.Prj.Mgt.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20231010053350_InitProjects3")] + partial class InitProjects3 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FullShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("No") + .HasColumnType("int"); + + b.Property("OrganizationId") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.ToTable("Projects"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Parent") + .WithMany("Parents") + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId"); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Navigation("Parents"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053350_InitProjects3.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053350_InitProjects3.cs new file mode 100644 index 0000000..ee03696 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053350_InitProjects3.cs @@ -0,0 +1,48 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + /// + public partial class InitProjects3 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "OrganizationId", + table: "Projects", + type: "int", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_Projects_OrganizationId", + table: "Projects", + column: "OrganizationId"); + + migrationBuilder.AddForeignKey( + name: "FK_Projects_Organizations_OrganizationId", + table: "Projects", + column: "OrganizationId", + principalTable: "Organizations", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Projects_Organizations_OrganizationId", + table: "Projects"); + + migrationBuilder.DropIndex( + name: "IX_Projects_OrganizationId", + table: "Projects"); + + migrationBuilder.DropColumn( + name: "OrganizationId", + table: "Projects"); + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053445_InitProjects4.Designer.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053445_InitProjects4.Designer.cs new file mode 100644 index 0000000..b726fc5 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053445_InitProjects4.Designer.cs @@ -0,0 +1,400 @@ +// +using System; +using FSI.Prj.Mgt.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20231010053445_InitProjects4")] + partial class InitProjects4 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FullShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.HasIndex("ProjectId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("No") + .HasColumnType("int"); + + b.Property("OrganizationId") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.ToTable("Projects"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Parent") + .WithMany("Parents") + .HasForeignKey("ParentId"); + + b.HasOne("FSI.Prj.Mgt.Models.Project", null) + .WithMany("Organizations") + .HasForeignKey("ProjectId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId"); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Navigation("Parents"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.Navigation("Organizations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053445_InitProjects4.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053445_InitProjects4.cs new file mode 100644 index 0000000..1edb3cc --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053445_InitProjects4.cs @@ -0,0 +1,48 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + /// + public partial class InitProjects4 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Organizations", + type: "int", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_Organizations_ProjectId", + table: "Organizations", + column: "ProjectId"); + + migrationBuilder.AddForeignKey( + name: "FK_Organizations_Projects_ProjectId", + table: "Organizations", + column: "ProjectId", + principalTable: "Projects", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Organizations_Projects_ProjectId", + table: "Organizations"); + + migrationBuilder.DropIndex( + name: "IX_Organizations_ProjectId", + table: "Organizations"); + + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Organizations"); + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053544_InitProjects5.Designer.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053544_InitProjects5.Designer.cs new file mode 100644 index 0000000..d1a1d3f --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053544_InitProjects5.Designer.cs @@ -0,0 +1,400 @@ +// +using System; +using FSI.Prj.Mgt.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20231010053544_InitProjects5")] + partial class InitProjects5 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FullShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.HasIndex("ProjectId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("No") + .HasColumnType("int"); + + b.Property("OrganizationId") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.ToTable("Projects"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Parent") + .WithMany("Parents") + .HasForeignKey("ParentId"); + + b.HasOne("FSI.Prj.Mgt.Models.Project", null) + .WithMany("Organizations") + .HasForeignKey("ProjectId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId"); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Navigation("Parents"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.Navigation("Organizations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053544_InitProjects5.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053544_InitProjects5.cs new file mode 100644 index 0000000..e8607ff --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053544_InitProjects5.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + /// + public partial class InitProjects5 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053625_InitProjects6.Designer.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053625_InitProjects6.Designer.cs new file mode 100644 index 0000000..1dc14b5 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053625_InitProjects6.Designer.cs @@ -0,0 +1,400 @@ +// +using System; +using FSI.Prj.Mgt.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20231010053625_InitProjects6")] + partial class InitProjects6 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FullShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.HasIndex("ProjectId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("No") + .HasColumnType("int"); + + b.Property("OrganizationId") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.ToTable("Projects"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Parent") + .WithMany("Parents") + .HasForeignKey("ParentId"); + + b.HasOne("FSI.Prj.Mgt.Models.Project", null) + .WithMany("Organizations") + .HasForeignKey("ProjectId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId"); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Navigation("Parents"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.Navigation("Organizations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053625_InitProjects6.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053625_InitProjects6.cs new file mode 100644 index 0000000..353e0b9 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053625_InitProjects6.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + /// + public partial class InitProjects6 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053722_InitProjects7.Designer.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053722_InitProjects7.Designer.cs new file mode 100644 index 0000000..75242d1 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053722_InitProjects7.Designer.cs @@ -0,0 +1,386 @@ +// +using System; +using FSI.Prj.Mgt.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20231010053722_InitProjects7")] + partial class InitProjects7 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FullShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("No") + .HasColumnType("int"); + + b.Property("OrganizationId") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.ToTable("Projects"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Parent") + .WithMany("Parents") + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId"); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Navigation("Parents"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053722_InitProjects7.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053722_InitProjects7.cs new file mode 100644 index 0000000..8c1c2ea --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010053722_InitProjects7.cs @@ -0,0 +1,48 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + /// + public partial class InitProjects7 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Organizations_Projects_ProjectId", + table: "Organizations"); + + migrationBuilder.DropIndex( + name: "IX_Organizations_ProjectId", + table: "Organizations"); + + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Organizations"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Organizations", + type: "int", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_Organizations_ProjectId", + table: "Organizations", + column: "ProjectId"); + + migrationBuilder.AddForeignKey( + name: "FK_Organizations_Projects_ProjectId", + table: "Organizations", + column: "ProjectId", + principalTable: "Projects", + principalColumn: "Id"); + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010054110_InitProjects8.Designer.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010054110_InitProjects8.Designer.cs new file mode 100644 index 0000000..5f595c0 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010054110_InitProjects8.Designer.cs @@ -0,0 +1,389 @@ +// +using System; +using FSI.Prj.Mgt.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20231010054110_InitProjects8")] + partial class InitProjects8 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FullShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("No") + .HasColumnType("int"); + + b.Property("OrganizationId") + .IsRequired() + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.ToTable("Projects"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Parent") + .WithMany("Parents") + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Navigation("Parents"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010054110_InitProjects8.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010054110_InitProjects8.cs new file mode 100644 index 0000000..7bc72f5 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010054110_InitProjects8.cs @@ -0,0 +1,59 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + /// + public partial class InitProjects8 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Projects_Organizations_OrganizationId", + table: "Projects"); + + migrationBuilder.AlterColumn( + name: "OrganizationId", + table: "Projects", + type: "int", + nullable: false, + defaultValue: 0, + oldClrType: typeof(int), + oldType: "int", + oldNullable: true); + + migrationBuilder.AddForeignKey( + name: "FK_Projects_Organizations_OrganizationId", + table: "Projects", + column: "OrganizationId", + principalTable: "Organizations", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Projects_Organizations_OrganizationId", + table: "Projects"); + + migrationBuilder.AlterColumn( + name: "OrganizationId", + table: "Projects", + type: "int", + nullable: true, + oldClrType: typeof(int), + oldType: "int"); + + migrationBuilder.AddForeignKey( + name: "FK_Projects_Organizations_OrganizationId", + table: "Projects", + column: "OrganizationId", + principalTable: "Organizations", + principalColumn: "Id"); + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010054334_InitProjects9.Designer.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010054334_InitProjects9.Designer.cs new file mode 100644 index 0000000..57401af --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010054334_InitProjects9.Designer.cs @@ -0,0 +1,389 @@ +// +using System; +using FSI.Prj.Mgt.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20231010054334_InitProjects9")] + partial class InitProjects9 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FullShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("No") + .HasColumnType("int"); + + b.Property("OrganizationId") + .IsRequired() + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.ToTable("Projects"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Parent") + .WithMany("Parents") + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Navigation("Parents"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010054334_InitProjects9.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010054334_InitProjects9.cs new file mode 100644 index 0000000..4371c17 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010054334_InitProjects9.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + /// + public partial class InitProjects9 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010054446_InitProjects10.Designer.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010054446_InitProjects10.Designer.cs new file mode 100644 index 0000000..05b3e37 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010054446_InitProjects10.Designer.cs @@ -0,0 +1,403 @@ +// +using System; +using FSI.Prj.Mgt.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20231010054446_InitProjects10")] + partial class InitProjects10 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FullShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.HasIndex("ProjectId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("No") + .HasColumnType("int"); + + b.Property("OrganizationId") + .IsRequired() + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.ToTable("Projects"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Parent") + .WithMany("Parents") + .HasForeignKey("ParentId"); + + b.HasOne("FSI.Prj.Mgt.Models.Project", null) + .WithMany("Organizations") + .HasForeignKey("ProjectId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Navigation("Parents"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.Navigation("Organizations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010054446_InitProjects10.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010054446_InitProjects10.cs new file mode 100644 index 0000000..1201455 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010054446_InitProjects10.cs @@ -0,0 +1,48 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + /// + public partial class InitProjects10 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Organizations", + type: "int", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_Organizations_ProjectId", + table: "Organizations", + column: "ProjectId"); + + migrationBuilder.AddForeignKey( + name: "FK_Organizations_Projects_ProjectId", + table: "Organizations", + column: "ProjectId", + principalTable: "Projects", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Organizations_Projects_ProjectId", + table: "Organizations"); + + migrationBuilder.DropIndex( + name: "IX_Organizations_ProjectId", + table: "Organizations"); + + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Organizations"); + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010055454_InitProjects11.Designer.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010055454_InitProjects11.Designer.cs new file mode 100644 index 0000000..b7de203 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010055454_InitProjects11.Designer.cs @@ -0,0 +1,388 @@ +// +using System; +using FSI.Prj.Mgt.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20231010055454_InitProjects11")] + partial class InitProjects11 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FullShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("Organizations"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("No") + .HasColumnType("int"); + + b.Property("OrganizationId") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("OrganizationId"); + + b.ToTable("Projects"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("RoleId") + .HasColumnType("nvarchar(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("nvarchar(450)"); + + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Parent") + .WithMany("Parents") + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Organization") + .WithMany() + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Organization"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => + { + b.Navigation("Parents"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010055454_InitProjects11.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010055454_InitProjects11.cs new file mode 100644 index 0000000..de2f68d --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010055454_InitProjects11.cs @@ -0,0 +1,48 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + /// + public partial class InitProjects11 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Organizations_Projects_ProjectId", + table: "Organizations"); + + migrationBuilder.DropIndex( + name: "IX_Organizations_ProjectId", + table: "Organizations"); + + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Organizations"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Organizations", + type: "int", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_Organizations_ProjectId", + table: "Organizations", + column: "ProjectId"); + + migrationBuilder.AddForeignKey( + name: "FK_Organizations_Projects_ProjectId", + table: "Organizations", + column: "ProjectId", + principalTable: "Projects", + principalColumn: "Id"); + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231003081806_Init.Designer.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010055809_InitProjects12.Designer.cs similarity index 94% rename from FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231003081806_Init.Designer.cs rename to FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010055809_InitProjects12.Designer.cs index fa5a6b9..6c830dd 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231003081806_Init.Designer.cs +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010055809_InitProjects12.Designer.cs @@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace FSI.Prj.Mgt.Data.Migrations { [DbContext(typeof(ApplicationDbContext))] - [Migration("20231003081806_Init")] - partial class Init + [Migration("20231010055809_InitProjects12")] + partial class InitProjects12 { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -53,6 +53,9 @@ namespace FSI.Prj.Mgt.Data.Migrations b.Property("ParentId") .HasColumnType("int"); + b.Property("ProjectId") + .HasColumnType("int"); + b.Property("ShortName") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -64,6 +67,8 @@ namespace FSI.Prj.Mgt.Data.Migrations b.HasIndex("ParentId"); + b.HasIndex("ProjectId"); + b.ToTable("Organizations"); }); @@ -79,9 +84,6 @@ namespace FSI.Prj.Mgt.Data.Migrations .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("ProjectId") - .HasColumnType("int"); - b.Property("ShortName") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -96,8 +98,6 @@ namespace FSI.Prj.Mgt.Data.Migrations b.HasKey("Id"); - b.HasIndex("ProjectId"); - b.ToTable("Plants"); }); @@ -109,10 +109,16 @@ namespace FSI.Prj.Mgt.Data.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + b.Property("Description") .IsRequired() .HasColumnType("nvarchar(max)"); + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + b.Property("Name") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -120,7 +126,7 @@ namespace FSI.Prj.Mgt.Data.Migrations b.Property("No") .HasColumnType("int"); - b.Property("PlantId") + b.Property("OrganizationId") .HasColumnType("int"); b.Property("Status") @@ -128,7 +134,7 @@ namespace FSI.Prj.Mgt.Data.Migrations b.HasKey("Id"); - b.HasIndex("PlantId"); + b.HasIndex("OrganizationId"); b.ToTable("Projects"); }); @@ -341,23 +347,22 @@ namespace FSI.Prj.Mgt.Data.Migrations .WithMany("Parents") .HasForeignKey("ParentId"); - b.Navigation("Parent"); - }); - - modelBuilder.Entity("FSI.Prj.Mgt.Models.Plant", b => - { b.HasOne("FSI.Prj.Mgt.Models.Project", null) - .WithMany("Plants") + .WithMany("Organizations") .HasForeignKey("ProjectId"); + + b.Navigation("Parent"); }); modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => { - b.HasOne("FSI.Prj.Mgt.Models.Plant", "Plant") + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Organization") .WithMany() - .HasForeignKey("PlantId"); + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.Navigation("Plant"); + b.Navigation("Organization"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => @@ -418,7 +423,7 @@ namespace FSI.Prj.Mgt.Data.Migrations modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => { - b.Navigation("Plants"); + b.Navigation("Organizations"); }); #pragma warning restore 612, 618 } diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010055809_InitProjects12.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010055809_InitProjects12.cs new file mode 100644 index 0000000..a6e979e --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20231010055809_InitProjects12.cs @@ -0,0 +1,67 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace FSI.Prj.Mgt.Data.Migrations +{ + /// + public partial class InitProjects12 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ProjectId", + table: "Organizations", + type: "int", + nullable: true); + + migrationBuilder.CreateTable( + name: "Plants", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ShortName = table.Column(type: "nvarchar(max)", nullable: false), + Name = table.Column(type: "nvarchar(max)", nullable: false), + SubPlantShortName = table.Column(type: "nvarchar(max)", nullable: false), + SubPlantName = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Plants", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_Organizations_ProjectId", + table: "Organizations", + column: "ProjectId"); + + migrationBuilder.AddForeignKey( + name: "FK_Organizations_Projects_ProjectId", + table: "Organizations", + column: "ProjectId", + principalTable: "Projects", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Organizations_Projects_ProjectId", + table: "Organizations"); + + migrationBuilder.DropTable( + name: "Plants"); + + migrationBuilder.DropIndex( + name: "IX_Organizations_ProjectId", + table: "Organizations"); + + migrationBuilder.DropColumn( + name: "ProjectId", + table: "Organizations"); + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/ApplicationDbContextModelSnapshot.cs index 81d3395..2cfc108 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -50,6 +50,9 @@ namespace FSI.Prj.Mgt.Data.Migrations b.Property("ParentId") .HasColumnType("int"); + b.Property("ProjectId") + .HasColumnType("int"); + b.Property("ShortName") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -61,6 +64,8 @@ namespace FSI.Prj.Mgt.Data.Migrations b.HasIndex("ParentId"); + b.HasIndex("ProjectId"); + b.ToTable("Organizations"); }); @@ -76,9 +81,6 @@ namespace FSI.Prj.Mgt.Data.Migrations .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("ProjectId") - .HasColumnType("int"); - b.Property("ShortName") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -93,8 +95,6 @@ namespace FSI.Prj.Mgt.Data.Migrations b.HasKey("Id"); - b.HasIndex("ProjectId"); - b.ToTable("Plants"); }); @@ -106,10 +106,16 @@ namespace FSI.Prj.Mgt.Data.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + b.Property("CreationTimeStamp") + .HasColumnType("datetime2"); + b.Property("Description") .IsRequired() .HasColumnType("nvarchar(max)"); + b.Property("ModificationTimeStamp") + .HasColumnType("datetime2"); + b.Property("Name") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -117,7 +123,7 @@ namespace FSI.Prj.Mgt.Data.Migrations b.Property("No") .HasColumnType("int"); - b.Property("PlantId") + b.Property("OrganizationId") .HasColumnType("int"); b.Property("Status") @@ -125,7 +131,7 @@ namespace FSI.Prj.Mgt.Data.Migrations b.HasKey("Id"); - b.HasIndex("PlantId"); + b.HasIndex("OrganizationId"); b.ToTable("Projects"); }); @@ -338,23 +344,22 @@ namespace FSI.Prj.Mgt.Data.Migrations .WithMany("Parents") .HasForeignKey("ParentId"); - b.Navigation("Parent"); - }); - - modelBuilder.Entity("FSI.Prj.Mgt.Models.Plant", b => - { b.HasOne("FSI.Prj.Mgt.Models.Project", null) - .WithMany("Plants") + .WithMany("Organizations") .HasForeignKey("ProjectId"); + + b.Navigation("Parent"); }); modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => { - b.HasOne("FSI.Prj.Mgt.Models.Plant", "Plant") + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Organization") .WithMany() - .HasForeignKey("PlantId"); + .HasForeignKey("OrganizationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.Navigation("Plant"); + b.Navigation("Organization"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => @@ -415,7 +420,7 @@ namespace FSI.Prj.Mgt.Data.Migrations modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => { - b.Navigation("Plants"); + b.Navigation("Organizations"); }); #pragma warning restore 612, 618 } diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/FSI.Prj.Mgt.csproj b/FSI.Prj.Mgt/FSI.Prj.Mgt/FSI.Prj.Mgt.csproj index 9792081..d4adaec 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/FSI.Prj.Mgt.csproj +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/FSI.Prj.Mgt.csproj @@ -7,6 +7,8 @@ aspnet-FSI.Prj.Mgt-babd23eb-b186-4281-a330-8c3b06203166 + + diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Organization.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Organization.cs index aad9e8c..189c358 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Organization.cs +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Organization.cs @@ -1,6 +1,4 @@ -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Microsoft.EntityFrameworkCore.Storage; -using System.ComponentModel; +using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; @@ -35,7 +33,7 @@ namespace FSI.Prj.Mgt.Models public virtual ICollection Parents { get; set; } [DisplayName("Type")] - [Required(ErrorMessage = "Dieses Feld wird benötigt.")] + [Required(ErrorMessage = "Typ muss angegeben werden.")] public OrganizationType Type { get; set; } [DisplayName("Erstellungsdatum")] diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/OrganizationViewModel.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/OrganizationViewModel.cs new file mode 100644 index 0000000..189c358 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/OrganizationViewModel.cs @@ -0,0 +1,64 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace FSI.Prj.Mgt.Models +{ + public class Organization + { + public Organization() + { + Parents = new HashSet(); + } + + [Key] + public int Id { get; set; } + + [DisplayName("Name")] + [Required(ErrorMessage = "Namen eingeben.")] + public string Name { get; set; } + + [DisplayName("Kurzname")] + [Required(ErrorMessage = "Kurznamen eingeben.")] + public string ShortName { get; set; } + + [DisplayName("Beschreibung")] + public string? Description { get; set; } + + [ForeignKey("Id")] + [DisplayName("übergeordnetes Element")] + public int? ParentId { get; set; } + + public virtual Organization? Parent { get; set; } + public virtual ICollection Parents { get; set; } + + [DisplayName("Type")] + [Required(ErrorMessage = "Typ muss angegeben werden.")] + public OrganizationType Type { get; set; } + + [DisplayName("Erstellungsdatum")] + public DateTime CreationTimeStamp { get; set; } + + [DisplayName("Änderungsdatum")] + public DateTime ModificationTimeStamp { get; set; } + + [DisplayName("vollständiger Kurzname")] + public string FullShortName { get; set; } + + } + + public enum OrganizationType + { + [Display(Name = "Firma")] + company, + [Display(Name = "Werk")] + factory, + [Display(Name = "Bereich")] + area, + [Display(Name = "Anlage")] + plant, + [Display(Name = "Teilanlage")] + subPlant, + } + +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Project.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Project.cs index acc44ca..63da060 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Project.cs +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Project.cs @@ -8,35 +8,42 @@ namespace FSI.Prj.Mgt.Models { public Project() { - Plants = new HashSet(); + // Organizations = new HashSet(); } [Key] public int Id { get; set; } [DisplayName("Projekt-Nr")] - [Required(ErrorMessage = "Dieses Feld wird benötigt.")] - public int No{ get; set; } - + public int No { get; set; } + [DisplayName("Name")] - [Required(ErrorMessage = "Dieses Feld wird benötigt.")] + [Required(ErrorMessage = "Projekt-Name eingeben.")] public string Name { get; set; } - + [DisplayName("Beschreibung")] - [Required(ErrorMessage = "Dieses Feld wird benötigt.")] + [Required(ErrorMessage = "Beschreibung eingeben.")] public string Description { get; set; } - - [DisplayName("Status")] - [Required(ErrorMessage = "Dieses Feld wird benötigt.")] - public ProjectStatus Status { get; set; } - - [ForeignKey("Id")] - [DisplayName("Anlage, Teilanlage, ...")] - public int? PlantId { get; set; } - public virtual Plant Plant { get; set; } - public virtual ICollection Plants { get; set; } + [DisplayName("Status")] + [Required(ErrorMessage = "Status muss angegeben werden.")] + public ProjectStatus Status { get; set; } + + + [DisplayName("Anlage, Teilanlage, ...")] + public virtual int OrganizationId { get; set; } + + [ForeignKey("OrganizationId")] + public virtual Organization Organization { get; set; } + + //public virtual ICollection Organizations { get; set; } + + [DisplayName("Erstellungsdatum")] + public DateTime CreationTimeStamp { get; set; } + + [DisplayName("Änderungsdatum")] + public DateTime ModificationTimeStamp { get; set; } } diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/AddOrEdit.cshtml b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/AddOrEdit.cshtml index 3773345..c5bc843 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/AddOrEdit.cshtml +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/AddOrEdit.cshtml @@ -16,7 +16,7 @@
- +
@@ -43,6 +43,8 @@ +
+
diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/Index.cshtml b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/Index.cshtml index faf00b5..43410bd 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/Index.cshtml +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/Index.cshtml @@ -5,10 +5,10 @@ @model IPagedList @{ - ViewData["Title"] = "Organisationen"; + ViewData["Title"] = "Organisation"; } -

Organisationen

+

Organisation


@@ -19,6 +19,8 @@

+ +
@await Html.PartialAsync("_ViewAll", Model)
@@ -35,13 +37,7 @@ - - - - - - -@* +@* @@ -73,10 +69,10 @@ }, 250); }); $('#jstree').on('changed.jstree', function (e, data) { - var i, j, + var i, j, postedItems = []; for (i = 0, j = data.selected.length; i < j; i++) { - + postedItems.push({ text: data.instance.get_node(data.selected[i]).text, @@ -102,7 +98,7 @@ "plugins": ["wholerow", "checkbox", "search"], }); }); - + } *@ \ No newline at end of file diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/_ViewAll.cshtml b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/_ViewAll.cshtml index 372e4b1..0ae36f7 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/_ViewAll.cshtml +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/_ViewAll.cshtml @@ -10,7 +10,7 @@ - @Html.DisplayNameFor(x => x.GetEnumerator().Current.ShortName) + @Html.DisplayNameFor(x => x.GetEnumerator().Current.ShortName) @Html.DisplayNameFor(x => x.GetEnumerator().Current.Name) @@ -38,40 +38,54 @@ @{ - foreach (var item in Model) + if (Model.Count() != 0) + { + foreach (var item in Model) + { + + + @Html.DisplayFor(modelItem => item.Id) + + + @Html.DisplayFor(modelItem => item.ShortName) + + + @Html.DisplayFor(modelItem => item.Name) + + + @Html.DisplayFor(modelItem => @item.Description) + + + @Html.DisplayFor(modelItem => @item.Type) + + + @Html.DisplayFor(modelItem => @item.Parent.Name) @(item.Parent == null ? "" : "(")@Html.DisplayFor(modelItem => @item.Parent.ShortName)@(item.Parent == null ? "" : ")") + + + @Html.DisplayFor(modelItem => @item.FullShortName) + + +
+ + + + + +
+ +
+ +
+ + + } + } + else { - - @Html.DisplayFor(modelItem => item.Id) - - - @Html.DisplayFor(modelItem => item.ShortName) - - - @Html.DisplayFor(modelItem => item.Name) - - - @Html.DisplayFor(modelItem => @item.Description) - - - @Html.DisplayFor(modelItem => @item.Type) - - - @Html.DisplayFor(modelItem => @item.Parent.Name) @(item.Parent == null ? "" : "(")@Html.DisplayFor(modelItem => @item.Parent.ShortName)@(item.Parent == null ? "" : ")") - - - @Html.DisplayFor(modelItem => @item.FullShortName) - - -
- - - -
- -
-
- + Keine Einträge gefunden } } diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/AddOrEdit.cshtml b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/AddOrEdit.cshtml index ec4eab8..67bed3e 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/AddOrEdit.cshtml +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/AddOrEdit.cshtml @@ -11,17 +11,15 @@
- + + + + -
- - - -
- +
@@ -37,11 +35,12 @@ -
- - + @*
+ +
- + *@ +
diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/_ViewAll.cshtml b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/_ViewAll.cshtml index 7b02155..abb93fa 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/_ViewAll.cshtml +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/_ViewAll.cshtml @@ -12,9 +12,9 @@ @Html.DisplayNameFor(x => x.GetEnumerator().Current.No) - - @Html.DisplayNameFor(x => x.GetEnumerator().Current.Plant) - + @* + @Html.DisplayNameFor(x => x.GetEnumerator().Current.Organization) + *@ @Html.DisplayNameFor(x => x.GetEnumerator().Current.Name) @@ -25,9 +25,9 @@ @Html.DisplayNameFor(x => x.GetEnumerator().Current.Status) - + - neues Projekt erstellen + neu @@ -44,9 +44,9 @@ @Html.DisplayFor(modelItem => item.No) - - @Html.DisplayFor(modelItem => @item.Plant.Name) @Html.DisplayFor(modelItem => @item.Plant.SubPlantShortName) - + @* + @Html.DisplayFor(modelItem => @item.Organization.Name) @Html.DisplayFor(modelItem => @item.Organization.FullShortName) + *@ @Html.DisplayFor(modelItem => @item.Name) @@ -63,7 +63,7 @@ @* - *@ + nsubmit="return jQueryAjaxDelete(this)"*@
diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Shared/_Layout.cshtml b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Shared/_Layout.cshtml index bf4514b..9259ed1 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Shared/_Layout.cshtml +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Shared/_Layout.cshtml @@ -28,7 +28,7 @@ Privacy