46 lines
1.2 KiB
TypeScript
46 lines
1.2 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 'src/prisma/prisma.service';
|
|
|
|
@Injectable()
|
|
export class WorkshopSchema extends PothosSchema {
|
|
constructor(
|
|
@Inject(SchemaBuilderToken) private readonly builder: Builder,
|
|
private readonly prisma: PrismaService,
|
|
) {
|
|
super();
|
|
}
|
|
|
|
@PothosRef()
|
|
workshop() {
|
|
return this.builder.prismaObject('Workshop', {
|
|
fields: (t) => ({
|
|
id: t.exposeID('id'),
|
|
title: t.exposeString('title'),
|
|
description: t.exposeString('description'),
|
|
staffId: t.exposeID('staffId'),
|
|
serviceId: t.exposeID('serviceId'),
|
|
date: t.expose('date', {
|
|
type: 'Date',
|
|
}),
|
|
createdAt: t.expose('createdAt', {
|
|
type: 'Date',
|
|
}),
|
|
updatedAt: t.expose('updatedAt', {
|
|
type: 'Date',
|
|
}),
|
|
service: t.relation('service'),
|
|
workshopOrganization: t.relation('workshopOrganization'),
|
|
workshopSubscription: t.relation('workshopSubscription'),
|
|
staff: t.relation('staff'),
|
|
}),
|
|
});
|
|
}
|
|
}
|