refactor: Moved shared code into shared folder
Squashed commit of the following: commit bdcc1abac9753790793e4f239d93050d4ec3f635 Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Wed Jun 30 12:49:30 2021 +0200 Moved shared code into shared folder
This commit is contained in:
56
apps/dafa-web/src/app/shared/models/participant.model.ts
Normal file
56
apps/dafa-web/src/app/shared/models/participant.model.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { ParticipantStatus } from '@dafa-enums/participant-status.enum';
|
||||
import { Service } from '@dafa-enums/service.enum';
|
||||
import { PaginationMeta } from './pagination-meta.model';
|
||||
|
||||
export interface Participant {
|
||||
id: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
fullName: string;
|
||||
status: ParticipantStatus;
|
||||
nextStep: string;
|
||||
service: Service;
|
||||
errandNumber: number;
|
||||
startDate: Date;
|
||||
endDate: Date;
|
||||
handleBefore: Date;
|
||||
}
|
||||
|
||||
export interface ParticipantsApiResponse {
|
||||
data: ParticipantApiResponseData[];
|
||||
meta?: PaginationMeta;
|
||||
}
|
||||
|
||||
export interface ParticipantApiResponse {
|
||||
data: ParticipantApiResponseData;
|
||||
}
|
||||
|
||||
export interface ParticipantApiResponseData {
|
||||
id: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
status: ParticipantStatus;
|
||||
nextStep: string;
|
||||
service: Service;
|
||||
errandNumber: number;
|
||||
startDate: Date;
|
||||
endDate: Date;
|
||||
handleBefore: Date;
|
||||
}
|
||||
|
||||
export function mapParticipantApiResponseToParticipant(data: ParticipantApiResponseData): Participant {
|
||||
const { id, firstName, lastName, status, nextStep, service, errandNumber, startDate, endDate, handleBefore } = data;
|
||||
return {
|
||||
id,
|
||||
firstName,
|
||||
lastName,
|
||||
fullName: `${firstName} ${lastName}`,
|
||||
status,
|
||||
nextStep,
|
||||
service,
|
||||
errandNumber,
|
||||
startDate,
|
||||
endDate,
|
||||
handleBefore,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user