troi mua qua
This commit is contained in:
45
src/workshop/workshop.schema.ts
Normal file
45
src/workshop/workshop.schema.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
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'),
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user