web: EntryProposal form implementation.
This commit is contained in:
46
web/src/api-client/event-proposal.models.ts
Normal file
46
web/src/api-client/event-proposal.models.ts
Normal file
@ -0,0 +1,46 @@
|
||||
/* 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,
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user