fix time geneate logic and replace default datetime by luxon

This commit is contained in:
2024-11-01 17:27:25 +07:00
parent 24a49d9412
commit ec77f07de1
14 changed files with 253 additions and 52 deletions

View File

@@ -23,6 +23,16 @@ export type ScheduleConfigType =
| null
| undefined
export type ScheduleConfigTypeForCenter =
| {
startDate?: string | null | undefined
endDate?: string | null | undefined
slots?: number[] | null | undefined
days?: number[] | null | undefined
}
| null
| undefined
export type ScheduleSlotType = {
slot: string
start: string
@@ -144,6 +154,18 @@ export class ScheduleSchema extends PothosSchema {
})
}
@PothosRef()
scheduleConfigInputForCenter() {
return this.builder.inputType('ScheduleConfigInputForCenter', {
fields: (t) => ({
startDate: t.string(),
endDate: t.string(),
slots: t.intList(),
days: t.intList(),
}),
})
}
@Pothos()
init(): void {
this.builder.queryFields((t) => ({
@@ -175,6 +197,21 @@ export class ScheduleSchema extends PothosSchema {
},
}),
// centerPreviewSchedule: t.field({
// type: this.previewSchedule(),
// description: 'Preview a schedule for center mentor.',
// args: {
// scheduleConfig: t.arg({
// type: this.scheduleConfigInputForCenter(),
// }),
// },
// resolve: async (_parent, args, _context, _info) => {
// return await this.scheduleService.createSchedulePreviewForCenter(
// args.scheduleConfig,
// )
// },
// }),
adminPreviewSchedule: t.field({
type: this.previewSchedule(),
description: 'Preview a schedule for admin.',