Skip to content

Commit 078eda2

Browse files
committed
Fix empty accession list case
1 parent f01a61d commit 078eda2

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

env.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
DB_PORT=5432
77

88
# The database user name
9-
DB_USER=massbank_export_api_user
9+
DB_USER=massbank3
1010

1111
# The database password
12-
DB_PASSWORD=massbank-export-api-password
12+
DB_PASSWORD=massbank3password
1313

1414
# The name of the database
1515
DB_NAME=records

src/main/java/massbank_export_api/api/db/RecordRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public interface RecordRepository extends JpaRepository<DbRecord, Long> {
1111

1212
DbRecord findByAccession(String accession);
1313

14-
// Custom query to fetch all accessions
15-
@Query(value = "SELECT accession FROM record", nativeQuery = true)
14+
@Query("SELECT r.accession FROM DbRecord r")
1615
List<String> findAllAccessions();
16+
1717
}

src/test/java/massbank_export_api/ExportApiControllerTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,15 @@ public void testCreateConversionTaskNistMSP() throws Exception {
147147
.andExpect(content().string(expectedResponse));
148148
}
149149

150+
@Test
151+
public void testCreateConversionTaskNistMSPEmptyRecordList() throws Exception {
152+
String requestBody = "{ \"record_list\": [ ], \"format\": \"nist_msp\" }";
153+
mockMvc.perform(post("/convert")
154+
.contentType("application/json")
155+
.content(requestBody))
156+
.andExpect(status().isOk());
157+
}
158+
150159
@Test
151160
public void testCreateConversionTaskRikenMSP() throws Exception {
152161
String requestBody = "{ \"record_list\": [\"MSBNK-IPB_Halle-PB001341\" , \"MSBNK-IPB_Halle-PB000125\"], \"format\": \"riken_msp\" }";

0 commit comments

Comments
 (0)