Total Complexity | 5 |
Complexity/F | 0 |
Lines of Code | 31 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { baseUrl, parseDate } from "./base"; |
||
2 | import { Experience } from "../models/types"; |
||
3 | |||
4 | export const parseSingleExperience = (data: any): Experience => { |
||
5 | const experience = { ...data }; |
||
6 | if (data.start_date) { |
||
7 | experience.start_date = parseDate(data.start_date); |
||
8 | } |
||
9 | if (data.end_date) { |
||
10 | experience.end_date = parseDate(data.end_date); |
||
11 | } |
||
12 | if (data.awarded_date) { |
||
13 | experience.awarded_date = parseDate(data.awarded_date); |
||
14 | } |
||
15 | return experience; |
||
16 | }; |
||
17 | |||
18 | export const parseExperience = (data: any): Experience[] => |
||
19 | data.map(parseSingleExperience); |
||
20 | |||
21 | export const getApplicantExperienceEndpoint = (applicantId: number): string => |
||
22 | `${baseUrl()}/applicants/${applicantId}/experience`; // FIXME: this url doesn't exist yet. |
||
23 | |||
24 | export const getApplicationExperienceEndpoint = ( |
||
25 | applicationId: number, |
||
26 | ): string => `${baseUrl()}/applications/${applicationId}/experience`; // FIXME: this url doesn't exist yet. |
||
27 | |||
28 | export const getExperienceEndpoint = ( |
||
29 | id: number | null, |
||
30 | type: Experience["type"], |
||
31 | ): string => `${baseUrl()}/experience/${type}/${id ?? ""}`; // FIXME: this url doesn't exist yet. |
||
32 |