44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { Inject, Injectable } from '@nestjs/common'
|
|
import {
|
|
Pothos,
|
|
PothosRef,
|
|
PothosSchema,
|
|
SchemaBuilderToken,
|
|
} from '@smatch-corp/nestjs-pothos'
|
|
import { Builder } from '../Graphql/graphql.builder'
|
|
import { PrismaService } from '../Prisma/prisma.service'
|
|
|
|
@Injectable()
|
|
export class WorkshopOrganizationSchema extends PothosSchema {
|
|
constructor(
|
|
@Inject(SchemaBuilderToken) private readonly builder: Builder,
|
|
private readonly prisma: PrismaService,
|
|
) {
|
|
super()
|
|
}
|
|
@PothosRef()
|
|
workshopOrganization() {
|
|
return this.builder.prismaObject('WorkshopOrganization', {
|
|
fields: (t) => ({
|
|
workshopId: t.exposeID('workshopId', {
|
|
description: 'The ID of the workshop that the organization is for.',
|
|
}),
|
|
serviceId: t.exposeID('serviceId', {
|
|
description: 'The ID of the service that the organization is for.',
|
|
}),
|
|
workshop: t.relation('workshop', {
|
|
description: 'The workshop that the organization is for.',
|
|
}),
|
|
service: t.relation('service', {
|
|
description: 'The service that the organization is for.',
|
|
}),
|
|
createdAt: t.expose('createdAt', {
|
|
type: 'DateTime',
|
|
description:
|
|
'The date and time the workshop organization was created.',
|
|
}),
|
|
}),
|
|
})
|
|
}
|
|
}
|