[events] Create empty models from factory function (fresh objects)
This commit is contained in:
parent
7d1993e3fa
commit
5780c73608
|
@ -13,15 +13,23 @@ export type EditableJob = Omit<Omit<FG.Job, 'type'>, 'id'> & {
|
||||||
id?: number;
|
id?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const emptyJob: EditableJob = {
|
export const emptyJob = (d: Date | number = new Date()): EditableJob =>
|
||||||
start: new Date(),
|
Object.assign(
|
||||||
end: date.addToDate(new Date(), { hours: 1 }),
|
{},
|
||||||
|
{
|
||||||
|
start: date.adjustDate(d, { minutes: 0, seconds: 0 }),
|
||||||
|
end: date.addToDate(date.adjustDate(d, { minutes: 0, seconds: 0 }), { hours: 1 }),
|
||||||
services: [],
|
services: [],
|
||||||
required_services: 2,
|
required_services: 2,
|
||||||
};
|
}
|
||||||
|
);
|
||||||
|
|
||||||
export const emptyEvent: EditableEvent = {
|
export const emptyEvent = (d: Date | number = new Date()): EditableEvent =>
|
||||||
start: new Date(),
|
Object.assign(
|
||||||
jobs: [Object.assign({}, emptyJob)],
|
{},
|
||||||
|
{
|
||||||
|
start: date.adjustDate(d, { hours: 0, minutes: 0, seconds: 0 }),
|
||||||
|
jobs: [],
|
||||||
is_template: false,
|
is_template: false,
|
||||||
};
|
}
|
||||||
|
);
|
||||||
|
|
Loading…
Reference in New Issue