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

CSCfi / metadata-submitter-frontend / 15132822209

20 May 2025 08:35AM UTC coverage: 47.784% (-0.08%) from 47.859%
15132822209

push

github

Hang Le
Feature/fix formatting (merge commit)

Merge branch 'feature/fix-formatting' into 'main'
* Format all files missed by incorrect format script

* Update precommit for husky v9

* Fix formatting script to include all files

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

Approved-by: Hang Le <lhang@csc.fi>
Co-authored-by: Monika Radaviciute <mradavic@csc.fi>
Merged by Hang Le <lhang@csc.fi>

656 of 963 branches covered (68.12%)

Branch coverage included in aggregate %.

150 of 326 new or added lines in 48 files covered. (46.01%)

5 existing lines in 4 files now uncovered.

6353 of 13705 relevant lines covered (46.36%)

4.25 hits per line

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

37.25
/src/services/templateAPI.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, ObjectDisplayValues } from "types"
8
import { getObjectDisplayTitle } from "utils"
1✔
9

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

13
const createTemplatesFromJSON = async (
1✔
14
  objectType: string,
×
15
  JSONContent: Record<string, unknown>[]
×
16
): Promise<APIResponse> => {
×
17
  return await api.post(`/${objectType}`, JSONContent)
×
18
}
×
19

20
const getTemplateByAccessionId = async (
1✔
NEW
21
  objectType: string,
×
NEW
22
  accessionId: string
×
NEW
23
): Promise<APIResponse> => {
×
24
  return await api.get(`/${objectType}/${accessionId}`)
×
25
}
×
26

27
const patchTemplateFromJSON = async (
1✔
28
  objectType: string,
×
29
  accessionId: string,
×
30
  JSONContent: Record<string, unknown>,
×
31
  index: number
×
32
): Promise<APIResponse> => {
×
NEW
33
  const draftTags = {
×
NEW
34
    tags: { displayTitle: getObjectDisplayTitle(objectType, JSONContent as ObjectDisplayValues) },
×
NEW
35
  }
×
36
  const draftIndex = { index }
×
37
  return await api.patch(`/${objectType}/${accessionId}`, {
×
38
    ...omit(JSONContent, OmitObjectValues),
×
39
    draftTags,
×
40
    draftIndex,
×
41
  })
×
42
}
×
43

44
const deleteTemplateByAccessionId = async (
1✔
NEW
45
  objectType: string,
×
NEW
46
  accessionId: string
×
NEW
47
): Promise<APIResponse> => {
×
48
  return await api.delete(`/${objectType}/${accessionId}`)
×
49
}
×
50

51
const getTemplates = async (params: { projectId: string }): Promise<APIResponse> => {
1✔
52
  return await api.get("", params)
×
53
}
×
54

55
export default {
1✔
56
  createTemplatesFromJSON,
1✔
57
  getTemplateByAccessionId,
1✔
58
  patchTemplateFromJSON,
1✔
59
  deleteTemplateByAccessionId,
1✔
60
  getTemplates,
1✔
61
}
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