47 lines
1.0 KiB
TypeScript
47 lines
1.0 KiB
TypeScript
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
import { default as dayjs } from 'dayjs';
|
|
|
|
interface MutableEventProposalModel {
|
|
name: string;
|
|
description: string;
|
|
purpose: string;
|
|
department: string;
|
|
location: string;
|
|
owner: string;
|
|
date: Date;
|
|
budgetInDollars: number;
|
|
}
|
|
|
|
interface MutableEventProposalConfig {
|
|
departments: Array<{
|
|
value: string;
|
|
color: string;
|
|
}>;
|
|
}
|
|
|
|
export type EventProposalModel = Readonly<MutableEventProposalModel>;
|
|
export type EventProposalConfig = Readonly<MutableEventProposalConfig>;
|
|
|
|
// eslint-disable-next-line
|
|
export function eventProposalConfigFromDTO(dto: any): EventProposalConfig {
|
|
const { departments } = dto;
|
|
return { departments };
|
|
}
|
|
|
|
export function eventProposalModelToDTO(ep: EventProposalModel): any {
|
|
return { ...ep, date: dayjs(ep.date).format() };
|
|
}
|
|
|
|
export function newEventProposal(): EventProposalModel {
|
|
return {
|
|
name: '',
|
|
description: '',
|
|
purpose: '',
|
|
department: '',
|
|
location: '',
|
|
owner: '',
|
|
date: new Date(),
|
|
budgetInDollars: 0,
|
|
};
|
|
}
|