implement preview for center

This commit is contained in:
2024-11-01 21:10:54 +07:00
parent db9f3213fd
commit e86d979ddb
2 changed files with 97 additions and 39 deletions

View File

@@ -24,15 +24,12 @@ 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 ScheduleConfigTypeForCenter = {
startDate: string
endDate: string
slots: number[]
days: number[]
}
export type ScheduleSlotType = {
slot: string
@@ -185,10 +182,18 @@ export class ScheduleSchema extends PothosSchema {
scheduleConfigInputForCenter() {
return this.builder.inputType('ScheduleConfigInputForCenter', {
fields: (t) => ({
startDate: t.string(),
endDate: t.string(),
slots: t.intList(),
days: t.intList(),
startDate: t.string({
required: true,
}),
endDate: t.string({
required: true,
}),
slots: t.intList({
required: true,
}),
days: t.intList({
required: true,
}),
}),
})
}
@@ -224,20 +229,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,
// )
// },
// }),
centerPreviewSchedule: t.field({
type: this.previewSchedule(),
description: 'Preview a schedule for center mentor.',
args: {
scheduleConfigInput: t.arg({
type: this.scheduleConfigInputForCenter(),
required: true,
}),
},
resolve: async (_parent, args, _context, _info) => {
return await this.scheduleService.createSchedulePreviewForCenter(
args.scheduleConfigInput,
)
},
}),
adminPreviewSchedule: t.field({
type: this.previewSchedule(),