update schema due to majority database change

This commit is contained in:
2024-10-18 01:50:26 +07:00
parent 9dcc84d371
commit 1523642b9d
13 changed files with 293 additions and 61 deletions

View File

@@ -7,6 +7,7 @@ import {
} from '@smatch-corp/nestjs-pothos';
import { Builder } from '../Graphql/graphql.builder';
import { PrismaService } from '../Prisma/prisma.service';
import { ScheduleStatus } from '@prisma/client';
@Injectable()
export class ScheduleSchema extends PothosSchema {
@@ -23,10 +24,53 @@ export class ScheduleSchema extends PothosSchema {
description: 'A schedule in the system.',
fields: (t) => ({
id: t.exposeID('id'),
serviceId: t.exposeID('serviceId'),
service: t.relation('service'),
dates: t.expose('dates', { type: 'Json' as any }),
status: t.exposeString('status'),
serviceId: t.exposeID('serviceId', {
description: 'The ID of the service the schedule belongs to.',
nullable: false,
}),
service: t.relation('service', {
description: 'The service the schedule belongs to.',
nullable: false,
}),
scheduleStart: t.expose('ScheduleStart', {
type: 'DateTime',
nullable: false,
}),
scheduleEnd: t.expose('ScheduleEnd', {
type: 'DateTime',
nullable: false,
}),
dates: t.relation('dates'),
status: t.expose('status', {
type: ScheduleStatus,
nullable: false,
}),
}),
});
}
@PothosRef()
scheduleDate() {
return this.builder.prismaObject('ScheduleDate', {
description: 'A schedule date in the system.',
fields: (t) => ({
id: t.exposeID('id', {
description: 'The ID of the schedule date.',
}),
scheduleId: t.exposeID('scheduleId', {
description: 'The ID of the schedule the schedule date belongs to.',
}),
start: t.expose('start', {
type: 'DateTime',
nullable: false,
}),
end: t.expose('end', {
type: 'DateTime',
nullable: false,
}),
schedule: t.relation('Schedule', {
description: 'The schedule the schedule date belongs to.',
}),
}),
});
}