From 8e9090ec15176f73a96b441b6afd3ef91f146db3 Mon Sep 17 00:00:00 2001 From: Luke-Young20 <74249900+Luke-Young20@users.noreply.github.com> Date: Fri, 15 Dec 2023 11:58:10 +0000 Subject: [PATCH 1/3] feat: egress' should be sorted by completed date --- src/Data-Egress-UI/Views/Data/GetAllEgresses.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data-Egress-UI/Views/Data/GetAllEgresses.cshtml b/src/Data-Egress-UI/Views/Data/GetAllEgresses.cshtml index 5a9ea54d3..8b7e65668 100644 --- a/src/Data-Egress-UI/Views/Data/GetAllEgresses.cshtml +++ b/src/Data-Egress-UI/Views/Data/GetAllEgresses.cshtml @@ -35,7 +35,7 @@ - @foreach (var egressSubmission in Model) + @foreach (var egressSubmission in Model.OrderByDescending(x => x.Completed)) { From 34f506baa866ac8e7835b2bd97384d6eac9d8777 Mon Sep 17 00:00:00 2001 From: Luke-Young20 <74249900+Luke-Young20@users.noreply.github.com> Date: Mon, 18 Dec 2023 11:10:18 +0000 Subject: [PATCH 2/3] feat: progress on adding in projectname to egress --- src/BL/Models/EgressSubmission.cs | 2 +- .../20231218110801_ProjectName.Designer.cs | 133 ++++++++++++++++++ .../Migrations/20231218110801_ProjectName.cs | 39 +++++ .../ApplicationDbContextModelSnapshot.cs | 9 +- .../Views/Data/GetAllEgresses.cshtml | 2 +- .../Controllers/SubmissionController.cs | 5 + 6 files changed, 184 insertions(+), 6 deletions(-) create mode 100644 src/Data-Egress-API/Migrations/20231218110801_ProjectName.Designer.cs create mode 100644 src/Data-Egress-API/Migrations/20231218110801_ProjectName.cs diff --git a/src/BL/Models/EgressSubmission.cs b/src/BL/Models/EgressSubmission.cs index bc056c3dd..a1f072f22 100644 --- a/src/BL/Models/EgressSubmission.cs +++ b/src/BL/Models/EgressSubmission.cs @@ -17,7 +17,7 @@ public class EgressSubmission public string? OutputBucket { get; set; } - + public string ProjectName { get; set; } public DateTime? Completed { get; set; } public string? Reviewer { get; set; } public virtual List Files { get; set; } diff --git a/src/Data-Egress-API/Migrations/20231218110801_ProjectName.Designer.cs b/src/Data-Egress-API/Migrations/20231218110801_ProjectName.Designer.cs new file mode 100644 index 000000000..10a93f7a7 --- /dev/null +++ b/src/Data-Egress-API/Migrations/20231218110801_ProjectName.Designer.cs @@ -0,0 +1,133 @@ +// +using System; +using Data_Egress_API.Repositories.DbContexts; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Data_Egress_API.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20231218110801_ProjectName")] + partial class ProjectName + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.13") + .HasAnnotation("Proxies:ChangeTracking", false) + .HasAnnotation("Proxies:CheckEquality", false) + .HasAnnotation("Proxies:LazyLoading", true) + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("BL.Models.EgressFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EgressSubmissionId") + .HasColumnType("integer"); + + b.Property("LastUpdate") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Reviewer") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("EgressSubmissionId"); + + b.ToTable("EgressFiles"); + }); + + modelBuilder.Entity("BL.Models.EgressSubmission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Completed") + .HasColumnType("timestamp with time zone"); + + b.Property("OutputBucket") + .HasColumnType("text"); + + b.Property("ProjectName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Reviewer") + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("SubmissionId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("EgressSubmissions"); + }); + + modelBuilder.Entity("BL.Models.KeycloakCredentials", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CredentialType") + .HasColumnType("integer"); + + b.Property("PasswordEnc") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("KeycloakCredentials"); + }); + + modelBuilder.Entity("BL.Models.EgressFile", b => + { + b.HasOne("BL.Models.EgressSubmission", "EgressSubmission") + .WithMany("Files") + .HasForeignKey("EgressSubmissionId"); + + b.Navigation("EgressSubmission"); + }); + + modelBuilder.Entity("BL.Models.EgressSubmission", b => + { + b.Navigation("Files"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Data-Egress-API/Migrations/20231218110801_ProjectName.cs b/src/Data-Egress-API/Migrations/20231218110801_ProjectName.cs new file mode 100644 index 000000000..e0bcf0cbb --- /dev/null +++ b/src/Data-Egress-API/Migrations/20231218110801_ProjectName.cs @@ -0,0 +1,39 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Data_Egress_API.Migrations +{ + /// + public partial class ProjectName : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "SubFolder", + table: "EgressSubmissions"); + + migrationBuilder.AddColumn( + name: "ProjectName", + table: "EgressSubmissions", + type: "text", + nullable: false, + defaultValue: ""); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProjectName", + table: "EgressSubmissions"); + + migrationBuilder.AddColumn( + name: "SubFolder", + table: "EgressSubmissions", + type: "text", + nullable: true); + } + } +} diff --git a/src/Data-Egress-API/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Data-Egress-API/Migrations/ApplicationDbContextModelSnapshot.cs index 9ee097e57..3718fb219 100644 --- a/src/Data-Egress-API/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/Data-Egress-API/Migrations/ApplicationDbContextModelSnapshot.cs @@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") + .HasAnnotation("ProductVersion", "7.0.13") .HasAnnotation("Proxies:ChangeTracking", false) .HasAnnotation("Proxies:CheckEquality", false) .HasAnnotation("Proxies:LazyLoading", true) @@ -69,15 +69,16 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("OutputBucket") .HasColumnType("text"); + b.Property("ProjectName") + .IsRequired() + .HasColumnType("text"); + b.Property("Reviewer") .HasColumnType("text"); b.Property("Status") .HasColumnType("integer"); - b.Property("SubFolder") - .HasColumnType("text"); - b.Property("SubmissionId") .HasColumnType("text"); diff --git a/src/Data-Egress-UI/Views/Data/GetAllEgresses.cshtml b/src/Data-Egress-UI/Views/Data/GetAllEgresses.cshtml index 8b7e65668..e2a2ebfb5 100644 --- a/src/Data-Egress-UI/Views/Data/GetAllEgresses.cshtml +++ b/src/Data-Egress-UI/Views/Data/GetAllEgresses.cshtml @@ -46,7 +46,7 @@ - Project Name + @egressSubmission.ProjectName @egressSubmission.Files.Count diff --git a/src/TRE-API/Controllers/SubmissionController.cs b/src/TRE-API/Controllers/SubmissionController.cs index d7fa3a780..faea68836 100644 --- a/src/TRE-API/Controllers/SubmissionController.cs +++ b/src/TRE-API/Controllers/SubmissionController.cs @@ -190,9 +190,14 @@ public IActionResult FilesReadyForReview([FromBody] ReviewFiles review) { _subHelper.UpdateStatusForTre(review.SubId, StatusType.DataOutRequested, ""); var bucket = _subHelper.GetOutputBucketGuts(review.SubId, false); + var subId = Int32.Parse(review.SubId); + var ProjectName = ""; + ProjectName = _dbContext.Projects.Where(x => x.SubmissionProjectId == subId).FirstOrDefault().SubmissionProjectName; var egsub = new EgressSubmission() { SubmissionId = review.SubId, + + ProjectName = ProjectName, OutputBucket = bucket.Bucket, Status = EgressStatus.NotCompleted, Files = new List() From d972483eed6883e723c104661f5ac6a5c3625151 Mon Sep 17 00:00:00 2001 From: Luke-Young20 <74249900+Luke-Young20@users.noreply.github.com> Date: Mon, 18 Dec 2023 11:14:56 +0000 Subject: [PATCH 3/3] feat: Should build and run (so that patricia can have the migration changes) --- src/Data-Egress-UI/Views/Data/GetAllEgresses.cshtml | 2 +- src/TRE-API/Controllers/SubmissionController.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Data-Egress-UI/Views/Data/GetAllEgresses.cshtml b/src/Data-Egress-UI/Views/Data/GetAllEgresses.cshtml index e2a2ebfb5..a7d6ee738 100644 --- a/src/Data-Egress-UI/Views/Data/GetAllEgresses.cshtml +++ b/src/Data-Egress-UI/Views/Data/GetAllEgresses.cshtml @@ -46,7 +46,7 @@ - @egressSubmission.ProjectName + @* @egressSubmission.ProjectName*@ @egressSubmission.Files.Count diff --git a/src/TRE-API/Controllers/SubmissionController.cs b/src/TRE-API/Controllers/SubmissionController.cs index faea68836..1feaf360c 100644 --- a/src/TRE-API/Controllers/SubmissionController.cs +++ b/src/TRE-API/Controllers/SubmissionController.cs @@ -190,14 +190,14 @@ public IActionResult FilesReadyForReview([FromBody] ReviewFiles review) { _subHelper.UpdateStatusForTre(review.SubId, StatusType.DataOutRequested, ""); var bucket = _subHelper.GetOutputBucketGuts(review.SubId, false); - var subId = Int32.Parse(review.SubId); - var ProjectName = ""; - ProjectName = _dbContext.Projects.Where(x => x.SubmissionProjectId == subId).FirstOrDefault().SubmissionProjectName; + //var subId = Int32.Parse(review.SubId); + //var ProjectName = ""; + //ProjectName = _dbContext.Projects.Where(x => x.SubmissionProjectId == subId).FirstOrDefault().SubmissionProjectName; var egsub = new EgressSubmission() { SubmissionId = review.SubId, - ProjectName = ProjectName, + //ProjectName = ProjectName, OutputBucket = bucket.Bucket, Status = EgressStatus.NotCompleted, Files = new List()