diff --git a/src/Fusion.Summary.Api/Database/Migrations/20241023141731_Add_TaskOwnerReports_Table.Designer.cs b/src/Fusion.Summary.Api/Database/Migrations/20241023141731_Add_TaskOwnerReports_Table.Designer.cs new file mode 100644 index 000000000..fdc01a0de --- /dev/null +++ b/src/Fusion.Summary.Api/Database/Migrations/20241023141731_Add_TaskOwnerReports_Table.Designer.cs @@ -0,0 +1,352 @@ +// +using System; +using Fusion.Summary.Api.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Fusion.Summary.Api.Database.Migrations +{ + [DbContext(typeof(SummaryDbContext))] + [Migration("20241023141731_Add_TaskOwnerReports_Table")] + partial class Add_TaskOwnerReports_Table + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Fusion.Summary.Api.Database.Models.DbDepartment", b => + { + b.Property("DepartmentSapId") + .HasColumnType("nvarchar(450)"); + + b.Property("DelegateResourceOwnersAzureUniqueId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FullDepartmentName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ResourceOwnersAzureUniqueId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("DepartmentSapId"); + + b.ToTable("Departments", (string)null); + }); + + modelBuilder.Entity("Fusion.Summary.Api.Database.Models.DbProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AssignedAdminsAzureUniqueId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DirectorAzureUniqueId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("OrgProjectExternalId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("OrgProjectExternalId") + .IsUnique(); + + b.ToTable("Projects", (string)null); + }); + + modelBuilder.Entity("Fusion.Summary.Api.Database.Models.DbWeeklySummaryReport", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AllocationChangesAwaitingTaskOwnerAction") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("AverageTimeToHandleRequests") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CapacityInUse") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DepartmentSapId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("NumberOfOpenRequests") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("NumberOfPersonnel") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("NumberOfRequestsLastPeriod") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("NumberOfRequestsStartingInLessThanThreeMonths") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("NumberOfRequestsStartingInMoreThanThreeMonths") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Period") + .HasColumnType("datetime2"); + + b.Property("ProjectChangesAffectingNextThreeMonths") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("DepartmentSapId", "Period") + .IsUnique(); + + b.ToTable("WeeklySummaryReports", (string)null); + }); + + modelBuilder.Entity("Fusion.Summary.Api.Database.Models.DbWeeklyTaskOwnerReport", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ActionsAwaitingTaskOwnerAction") + .HasColumnType("int"); + + b.Property("PeriodEnd") + .HasColumnType("datetime2"); + + b.Property("PeriodStart") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId", "PeriodStart", "PeriodEnd") + .IsUnique(); + + b.ToTable("WeeklyTaskOwnerReports", (string)null); + }); + + modelBuilder.Entity("Fusion.Summary.Api.Database.Models.DbWeeklySummaryReport", b => + { + b.HasOne("Fusion.Summary.Api.Database.Models.DbDepartment", "Department") + .WithMany() + .HasForeignKey("DepartmentSapId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.OwnsMany("Fusion.Summary.Api.Database.Models.DbEndingPosition", "PositionsEnding", b1 => + { + b1.Property("DbWeeklySummaryReportId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b1.Property("EndDate") + .HasColumnType("datetime2"); + + b1.Property("FullName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("DbWeeklySummaryReportId", "Id"); + + b1.ToTable("WeeklySummaryReports"); + + b1.ToJson("PositionsEnding"); + + b1.WithOwner() + .HasForeignKey("DbWeeklySummaryReportId"); + }); + + b.OwnsMany("Fusion.Summary.Api.Database.Models.DbPersonnelMoreThan100PercentFTE", "PersonnelMoreThan100PercentFTE", b1 => + { + b1.Property("DbWeeklySummaryReportId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b1.Property("FTE") + .HasColumnType("float"); + + b1.Property("FullName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("DbWeeklySummaryReportId", "Id"); + + b1.ToTable("WeeklySummaryReports"); + + b1.ToJson("PersonnelMoreThan100PercentFTE"); + + b1.WithOwner() + .HasForeignKey("DbWeeklySummaryReportId"); + }); + + b.Navigation("Department"); + + b.Navigation("PersonnelMoreThan100PercentFTE"); + + b.Navigation("PositionsEnding"); + }); + + modelBuilder.Entity("Fusion.Summary.Api.Database.Models.DbWeeklyTaskOwnerReport", b => + { + b.HasOne("Fusion.Summary.Api.Database.Models.DbProject", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.OwnsMany("Fusion.Summary.Api.Database.Models.DbAdminAccessExpiring", "AdminAccessExpiringInLessThanThreeMonths", b1 => + { + b1.Property("DbWeeklyTaskOwnerReportId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b1.Property("AzureUniqueId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Expires") + .HasColumnType("datetime2"); + + b1.Property("FullName") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b1.HasKey("DbWeeklyTaskOwnerReportId", "Id"); + + b1.ToTable("WeeklyTaskOwnerReports"); + + b1.ToJson("AdminAccessExpiringInLessThanThreeMonths"); + + b1.WithOwner() + .HasForeignKey("DbWeeklyTaskOwnerReportId"); + }); + + b.OwnsMany("Fusion.Summary.Api.Database.Models.DbPositionAllocationEnding", "PositionAllocationsEndingInNextThreeMonths", b1 => + { + b1.Property("DbWeeklyTaskOwnerReportId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b1.Property("PositionAppliesTo") + .HasColumnType("datetime2"); + + b1.Property("PositionExternalId") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b1.Property("PositionName") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b1.Property("PositionNameDetailed") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b1.HasKey("DbWeeklyTaskOwnerReportId", "Id"); + + b1.ToTable("WeeklyTaskOwnerReports"); + + b1.ToJson("PositionAllocationsEndingInNextThreeMonths"); + + b1.WithOwner() + .HasForeignKey("DbWeeklyTaskOwnerReportId"); + }); + + b.OwnsMany("Fusion.Summary.Api.Database.Models.DbTBNPositionStartingSoon", "TBNPositionsStartingInLessThanThreeMonths", b1 => + { + b1.Property("DbWeeklyTaskOwnerReportId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b1.Property("PositionAppliesFrom") + .HasColumnType("datetime2"); + + b1.Property("PositionExternalId") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b1.Property("PositionName") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b1.Property("PositionNameDetailed") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b1.HasKey("DbWeeklyTaskOwnerReportId", "Id"); + + b1.ToTable("WeeklyTaskOwnerReports"); + + b1.ToJson("TBNPositionsStartingInLessThanThreeMonths"); + + b1.WithOwner() + .HasForeignKey("DbWeeklyTaskOwnerReportId"); + }); + + b.Navigation("AdminAccessExpiringInLessThanThreeMonths"); + + b.Navigation("PositionAllocationsEndingInNextThreeMonths"); + + b.Navigation("Project"); + + b.Navigation("TBNPositionsStartingInLessThanThreeMonths"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Fusion.Summary.Api/Database/Migrations/20241023141731_Add_TaskOwnerReports_Table.cs b/src/Fusion.Summary.Api/Database/Migrations/20241023141731_Add_TaskOwnerReports_Table.cs new file mode 100644 index 000000000..867870e05 --- /dev/null +++ b/src/Fusion.Summary.Api/Database/Migrations/20241023141731_Add_TaskOwnerReports_Table.cs @@ -0,0 +1,76 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Fusion.Summary.Api.Database.Migrations +{ + /// + public partial class Add_TaskOwnerReports_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Projects", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + OrgProjectExternalId = table.Column(type: "uniqueidentifier", nullable: false), + DirectorAzureUniqueId = table.Column(type: "uniqueidentifier", nullable: true), + AssignedAdminsAzureUniqueId = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Projects", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "WeeklyTaskOwnerReports", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ProjectId = table.Column(type: "uniqueidentifier", nullable: false), + PeriodStart = table.Column(type: "datetime2", nullable: false), + PeriodEnd = table.Column(type: "datetime2", nullable: false), + ActionsAwaitingTaskOwnerAction = table.Column(type: "int", nullable: false), + AdminAccessExpiringInLessThanThreeMonths = table.Column(type: "nvarchar(max)", nullable: true), + PositionAllocationsEndingInNextThreeMonths = table.Column(type: "nvarchar(max)", nullable: true), + TBNPositionsStartingInLessThanThreeMonths = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_WeeklyTaskOwnerReports", x => x.Id); + table.ForeignKey( + name: "FK_WeeklyTaskOwnerReports_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_Projects_OrgProjectExternalId", + table: "Projects", + column: "OrgProjectExternalId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_WeeklyTaskOwnerReports_ProjectId_PeriodStart_PeriodEnd", + table: "WeeklyTaskOwnerReports", + columns: new[] { "ProjectId", "PeriodStart", "PeriodEnd" }, + unique: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "WeeklyTaskOwnerReports"); + + migrationBuilder.DropTable( + name: "Projects"); + } + } +} diff --git a/src/Fusion.Summary.Api/Database/Migrations/SummaryDbContextModelSnapshot.cs b/src/Fusion.Summary.Api/Database/Migrations/SummaryDbContextModelSnapshot.cs index 4f9c9f4d7..8af159fd8 100644 --- a/src/Fusion.Summary.Api/Database/Migrations/SummaryDbContextModelSnapshot.cs +++ b/src/Fusion.Summary.Api/Database/Migrations/SummaryDbContextModelSnapshot.cs @@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "8.0.6") + .HasAnnotation("ProductVersion", "8.0.10") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -44,6 +44,35 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Departments", (string)null); }); + modelBuilder.Entity("Fusion.Summary.Api.Database.Models.DbProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AssignedAdminsAzureUniqueId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DirectorAzureUniqueId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("OrgProjectExternalId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("OrgProjectExternalId") + .IsUnique(); + + b.ToTable("Projects", (string)null); + }); + modelBuilder.Entity("Fusion.Summary.Api.Database.Models.DbWeeklySummaryReport", b => { b.Property("Id") @@ -101,6 +130,32 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("WeeklySummaryReports", (string)null); }); + modelBuilder.Entity("Fusion.Summary.Api.Database.Models.DbWeeklyTaskOwnerReport", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ActionsAwaitingTaskOwnerAction") + .HasColumnType("int"); + + b.Property("PeriodEnd") + .HasColumnType("datetime2"); + + b.Property("PeriodStart") + .HasColumnType("datetime2"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId", "PeriodStart", "PeriodEnd") + .IsUnique(); + + b.ToTable("WeeklyTaskOwnerReports", (string)null); + }); + modelBuilder.Entity("Fusion.Summary.Api.Database.Models.DbWeeklySummaryReport", b => { b.HasOne("Fusion.Summary.Api.Database.Models.DbDepartment", "Department") @@ -167,6 +222,127 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("PositionsEnding"); }); + + modelBuilder.Entity("Fusion.Summary.Api.Database.Models.DbWeeklyTaskOwnerReport", b => + { + b.HasOne("Fusion.Summary.Api.Database.Models.DbProject", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.OwnsMany("Fusion.Summary.Api.Database.Models.DbAdminAccessExpiring", "AdminAccessExpiringInLessThanThreeMonths", b1 => + { + b1.Property("DbWeeklyTaskOwnerReportId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b1.Property("AzureUniqueId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Expires") + .HasColumnType("datetime2"); + + b1.Property("FullName") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b1.HasKey("DbWeeklyTaskOwnerReportId", "Id"); + + b1.ToTable("WeeklyTaskOwnerReports"); + + b1.ToJson("AdminAccessExpiringInLessThanThreeMonths"); + + b1.WithOwner() + .HasForeignKey("DbWeeklyTaskOwnerReportId"); + }); + + b.OwnsMany("Fusion.Summary.Api.Database.Models.DbPositionAllocationEnding", "PositionAllocationsEndingInNextThreeMonths", b1 => + { + b1.Property("DbWeeklyTaskOwnerReportId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b1.Property("PositionAppliesTo") + .HasColumnType("datetime2"); + + b1.Property("PositionExternalId") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b1.Property("PositionName") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b1.Property("PositionNameDetailed") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b1.HasKey("DbWeeklyTaskOwnerReportId", "Id"); + + b1.ToTable("WeeklyTaskOwnerReports"); + + b1.ToJson("PositionAllocationsEndingInNextThreeMonths"); + + b1.WithOwner() + .HasForeignKey("DbWeeklyTaskOwnerReportId"); + }); + + b.OwnsMany("Fusion.Summary.Api.Database.Models.DbTBNPositionStartingSoon", "TBNPositionsStartingInLessThanThreeMonths", b1 => + { + b1.Property("DbWeeklyTaskOwnerReportId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b1.Property("PositionAppliesFrom") + .HasColumnType("datetime2"); + + b1.Property("PositionExternalId") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b1.Property("PositionName") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b1.Property("PositionNameDetailed") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b1.HasKey("DbWeeklyTaskOwnerReportId", "Id"); + + b1.ToTable("WeeklyTaskOwnerReports"); + + b1.ToJson("TBNPositionsStartingInLessThanThreeMonths"); + + b1.WithOwner() + .HasForeignKey("DbWeeklyTaskOwnerReportId"); + }); + + b.Navigation("AdminAccessExpiringInLessThanThreeMonths"); + + b.Navigation("PositionAllocationsEndingInNextThreeMonths"); + + b.Navigation("Project"); + + b.Navigation("TBNPositionsStartingInLessThanThreeMonths"); + }); #pragma warning restore 612, 618 } }