implement preview for center
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user