From d6fced60dfc7479c4034ef3dc3e7a3b9f96a269d Mon Sep 17 00:00:00 2001 From: John Phan Date: Fri, 6 Dec 2024 08:58:26 -0800 Subject: [PATCH 1/3] 35373 Add name to molecular analysis run item - Added name field to MolecularRunItemDto and MolecularAnalysisRunItem --- .../api/dto/MolecularAnalysisRunItemDto.java | 2 ++ .../api/entities/MolecularAnalysisRunItem.java | 4 ++++ .../58-Add_name_to_MolecularAnalysisRunItem.xml | 16 ++++++++++++++++ .../MolecularAnalysisRunItemFactory.java | 1 + .../MolecularAnalysisRunItemTestFixture.java | 1 + 5 files changed, 24 insertions(+) create mode 100644 src/main/resources/db/changelog/migrations/58-Add_name_to_MolecularAnalysisRunItem.xml diff --git a/src/main/java/ca/gc/aafc/seqdb/api/dto/MolecularAnalysisRunItemDto.java b/src/main/java/ca/gc/aafc/seqdb/api/dto/MolecularAnalysisRunItemDto.java index c8683c94..cd0e7232 100644 --- a/src/main/java/ca/gc/aafc/seqdb/api/dto/MolecularAnalysisRunItemDto.java +++ b/src/main/java/ca/gc/aafc/seqdb/api/dto/MolecularAnalysisRunItemDto.java @@ -31,6 +31,8 @@ public class MolecularAnalysisRunItemDto { private String usageType; + private String name; + @JsonApiRelation private MolecularAnalysisRunDto run; diff --git a/src/main/java/ca/gc/aafc/seqdb/api/entities/MolecularAnalysisRunItem.java b/src/main/java/ca/gc/aafc/seqdb/api/entities/MolecularAnalysisRunItem.java index af68c925..54c3dfd6 100644 --- a/src/main/java/ca/gc/aafc/seqdb/api/entities/MolecularAnalysisRunItem.java +++ b/src/main/java/ca/gc/aafc/seqdb/api/entities/MolecularAnalysisRunItem.java @@ -57,6 +57,10 @@ public class MolecularAnalysisRunItem implements DinaEntity { @Column(name = "usage_type") private String usageType; + @NotBlank + @Size(max = 50) + private String name; + // eager since we need it for group-based permission @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "molecular_analysis_run_id") diff --git a/src/main/resources/db/changelog/migrations/58-Add_name_to_MolecularAnalysisRunItem.xml b/src/main/resources/db/changelog/migrations/58-Add_name_to_MolecularAnalysisRunItem.xml new file mode 100644 index 00000000..e7c1942d --- /dev/null +++ b/src/main/resources/db/changelog/migrations/58-Add_name_to_MolecularAnalysisRunItem.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/java/ca/gc/aafc/seqdb/api/testsupport/factories/MolecularAnalysisRunItemFactory.java b/src/test/java/ca/gc/aafc/seqdb/api/testsupport/factories/MolecularAnalysisRunItemFactory.java index ae762056..64b5f674 100644 --- a/src/test/java/ca/gc/aafc/seqdb/api/testsupport/factories/MolecularAnalysisRunItemFactory.java +++ b/src/test/java/ca/gc/aafc/seqdb/api/testsupport/factories/MolecularAnalysisRunItemFactory.java @@ -14,6 +14,7 @@ public static MolecularAnalysisRunItem.MolecularAnalysisRunItemBuilder newMolecu .uuid(UUID.randomUUID()) .createdBy("test user") .usageType(SeqReactionDto.TYPENAME) + .name("test-name") .run(run); } } diff --git a/src/test/java/ca/gc/aafc/seqdb/api/testsupport/fixtures/MolecularAnalysisRunItemTestFixture.java b/src/test/java/ca/gc/aafc/seqdb/api/testsupport/fixtures/MolecularAnalysisRunItemTestFixture.java index c8e9ed74..35e8a2f8 100644 --- a/src/test/java/ca/gc/aafc/seqdb/api/testsupport/fixtures/MolecularAnalysisRunItemTestFixture.java +++ b/src/test/java/ca/gc/aafc/seqdb/api/testsupport/fixtures/MolecularAnalysisRunItemTestFixture.java @@ -9,6 +9,7 @@ public static MolecularAnalysisRunItemDto newMolecularAnalysisRunItem() { return MolecularAnalysisRunItemDto.builder() .createdBy("test-user") .usageType(SeqReactionDto.TYPENAME) + .name("test-name") .build(); } } From 13ae4123fbe87655f1dfbd9665a10bb646f95bc6 Mon Sep 17 00:00:00 2001 From: John Phan Date: Fri, 6 Dec 2024 09:04:15 -0800 Subject: [PATCH 2/3] - Added new db migration xml to db changelog master --- src/main/resources/db/changelog/db.changelog-master.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/db/changelog/db.changelog-master.xml b/src/main/resources/db/changelog/db.changelog-master.xml index afc89dec..27efc23a 100644 --- a/src/main/resources/db/changelog/db.changelog-master.xml +++ b/src/main/resources/db/changelog/db.changelog-master.xml @@ -62,4 +62,5 @@ + From 0ec8dce989a9540b3bb2ccc6e104298527c4ddbe Mon Sep 17 00:00:00 2001 From: John Phan Date: Fri, 6 Dec 2024 09:13:45 -0800 Subject: [PATCH 3/3] - Make MolecularAnalysisRunItem name optional --- .../gc/aafc/seqdb/api/entities/MolecularAnalysisRunItem.java | 1 - .../migrations/58-Add_name_to_MolecularAnalysisRunItem.xml | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/ca/gc/aafc/seqdb/api/entities/MolecularAnalysisRunItem.java b/src/main/java/ca/gc/aafc/seqdb/api/entities/MolecularAnalysisRunItem.java index 54c3dfd6..cb531533 100644 --- a/src/main/java/ca/gc/aafc/seqdb/api/entities/MolecularAnalysisRunItem.java +++ b/src/main/java/ca/gc/aafc/seqdb/api/entities/MolecularAnalysisRunItem.java @@ -57,7 +57,6 @@ public class MolecularAnalysisRunItem implements DinaEntity { @Column(name = "usage_type") private String usageType; - @NotBlank @Size(max = 50) private String name; diff --git a/src/main/resources/db/changelog/migrations/58-Add_name_to_MolecularAnalysisRunItem.xml b/src/main/resources/db/changelog/migrations/58-Add_name_to_MolecularAnalysisRunItem.xml index e7c1942d..a8b3ad6f 100644 --- a/src/main/resources/db/changelog/migrations/58-Add_name_to_MolecularAnalysisRunItem.xml +++ b/src/main/resources/db/changelog/migrations/58-Add_name_to_MolecularAnalysisRunItem.xml @@ -8,9 +8,7 @@ - - - + \ No newline at end of file