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 5a9ea54d3..a7d6ee738 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)) { @@ -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..1feaf360c 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()