• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CSCfi / metadata-submitter-frontend / 17039256042

18 Aug 2025 11:28AM UTC coverage: 55.494% (-2.3%) from 57.785%
17039256042

push

github

Hang Le
Removing metadata objects and drafts from submission object (merge commit)

Merge branch 'bugfix/remove-metadataObjects-and-drafts' into 'main'
* Fix for undefined object's id and title

* Remove metadataObjects and drafts

Closes #1072
See merge request https://gitlab.ci.csc.fi/sds-dev/sd-submit/metadata-submitter-frontend/-/merge_requests/1154

Reviewed-by: Liisa Lado-Villar <145-lilado@users.noreply.gitlab.ci.csc.fi>
Approved-by: Monika Radaviciute <mradavic@csc.fi>
Approved-by: Liisa Lado-Villar <145-lilado@users.noreply.gitlab.ci.csc.fi>
Merged by Hang Le <lhang@csc.fi>

596 of 832 branches covered (71.63%)

Branch coverage included in aggregate %.

217 of 328 new or added lines in 27 files covered. (66.16%)

469 existing lines in 16 files now uncovered.

5500 of 10153 relevant lines covered (54.17%)

4.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

40.0
/src/services/objectAPI.ts
1
import { create } from "apisauce"
1✔
2
import { omit } from "lodash"
1✔
3

4
import { errorMonitor } from "./errorMonitor"
1✔
5

6
import { OmitObjectValues } from "constants/wizardObject"
1✔
7
import { APIResponse } from "types"
8

9
const api = create({ baseURL: "/v1/objects" })
1✔
10
api.addMonitor(errorMonitor)
1✔
11

12
const createFromXML = async (
1✔
13
  objectType: string,
×
14
  submissionId: string,
×
15
  XMLFile: File
×
16
): Promise<APIResponse> => {
×
17
  const formData = new FormData()
×
18
  formData.append(objectType, XMLFile)
×
19
  return await api.post(`/${objectType}?submission=${submissionId}`, formData, {
×
20
    headers: {
×
21
      "Content-Type": "multipart/form-data",
×
22
    },
×
23
  })
×
24
}
×
25

26
/*
27
  Backend now supports creating multiple objects at once, the response is an Array of objects.
28
  Frontend only creates one object at a time atm but we may support this multi-object feature also in the future.
29
*/
30
const createFromJSON = async (
1✔
31
  objectType: string,
×
32
  submissionId: string,
×
33
  JSONContent: Record<string, unknown>
×
34
): Promise<APIResponse> => {
×
35
  return await api.post(`/${objectType}?submission=${submissionId}`, JSONContent)
×
36
}
×
37

38
const getObjectByAccessionId = async (
1✔
UNCOV
39
  objectType: string,
×
UNCOV
40
  accessionId: string
×
UNCOV
41
): Promise<APIResponse> => {
×
UNCOV
42
  return await api.get(`/${objectType}/${accessionId}`)
×
UNCOV
43
}
×
44

45
const getAllObjectsByObjectType = async (
1✔
46
  objectType: string,
36✔
47
  submissionId: string
36✔
48
): Promise<APIResponse> => {
36✔
49
  return await api.get(`/${objectType}?submission=${submissionId}`)
36✔
50
}
36✔
51

52
const patchFromJSON = async (
1✔
53
  objectType: string,
×
54
  accessionId: string,
×
55
  JSONContent: Record<string, unknown>
×
56
): Promise<APIResponse> => {
×
57
  return await api.patch(`/${objectType}/${accessionId}`, omit(JSONContent, OmitObjectValues))
×
58
}
×
59

60
const replaceXML = async (
1✔
61
  objectType: string,
×
62
  accessionId: string,
×
63
  XMLFile: File
×
64
): Promise<APIResponse> => {
×
65
  const formData = new FormData()
×
66
  formData.append(objectType, XMLFile)
×
67
  return await api.put(`/${objectType}/${accessionId}`, formData)
×
68
}
×
69

70
const deleteObjectByAccessionId = async (
1✔
71
  objectType: string,
×
72
  accessionId: string
×
73
): Promise<APIResponse> => {
×
74
  return await api.delete(`/${objectType}/${accessionId}`)
×
75
}
×
76

77
export default {
1✔
78
  createFromXML,
1✔
79
  createFromJSON,
1✔
80
  getObjectByAccessionId,
1✔
81
  getAllObjectsByObjectType,
1✔
82
  patchFromJSON,
1✔
83
  replaceXML,
1✔
84
  deleteObjectByAccessionId,
1✔
85
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc