ba me oi con thanh cong roi
This commit is contained in:
@@ -9,12 +9,15 @@ import type PrismaTypes from '../types/pothos.generated';
|
||||
import { getDatamodel } from '../types/pothos.generated';
|
||||
import { DateTimeResolver, JSONObjectResolver } from 'graphql-scalars';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import GraphQLUpload from 'graphql-upload/GraphQLUpload.js';
|
||||
import type { FileUpload } from 'graphql-upload/processRequest.js';
|
||||
import { PrismaCrudGenerator } from './graphql.generator';
|
||||
|
||||
import { PubSub } from 'graphql-subscriptions';
|
||||
export interface SchemaContext {
|
||||
req: Request;
|
||||
res: Response;
|
||||
generator: PrismaCrudGenerator<BuilderTypes>;
|
||||
pubSub: PubSub;
|
||||
}
|
||||
|
||||
export interface SchemaBuilderOption {
|
||||
@@ -30,6 +33,10 @@ export interface SchemaBuilderOption {
|
||||
Input: JSON;
|
||||
Output: JSON;
|
||||
};
|
||||
Upload: {
|
||||
Input: FileUpload;
|
||||
Output: FileUpload;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -51,6 +58,7 @@ export class Builder extends SchemaBuilder<SchemaBuilderOption> {
|
||||
this.generator = new PrismaCrudGenerator<BuilderTypes>(this);
|
||||
this.addScalarType('DateTime', DateTimeResolver);
|
||||
this.addScalarType('Json', JSONObjectResolver);
|
||||
this.addScalarType('Upload', GraphQLUpload);
|
||||
|
||||
this.queryType({});
|
||||
this.mutationType({});
|
||||
|
||||
@@ -13,7 +13,6 @@ import type { FilterOps } from '@pothos/plugin-prisma-utils';
|
||||
import * as Prisma from '@prisma/client';
|
||||
import { SchemaBuilderToken } from '@smatch-corp/nestjs-pothos';
|
||||
|
||||
//
|
||||
const filterOps = ['equals', 'in', 'notIn', 'not', 'is'] as const;
|
||||
const sortableFilterProps = ['lt', 'lte', 'gt', 'gte'] as const;
|
||||
const stringFilterOps = [
|
||||
|
||||
@@ -28,7 +28,7 @@ import { MilestoneModule } from '../Milestone/milestone.module';
|
||||
import { ScheduleModule } from '../Schedule/schedule.module';
|
||||
import { MessageModule } from '../Message/message.module';
|
||||
import { ServiceMeetingRoomModule } from '../ServiceMeetingRoom/servicemeetingroom.module';
|
||||
import { UploadedDocumentModule } from '../UploadedDocument/uploadeddocument.module';
|
||||
import { UploadedFileModule } from '../UploadedFile/uploadedfile.module';
|
||||
@Global()
|
||||
@Module({
|
||||
imports: [
|
||||
@@ -53,7 +53,7 @@ import { UploadedDocumentModule } from '../UploadedDocument/uploadeddocument.mod
|
||||
ScheduleModule,
|
||||
MessageModule,
|
||||
ServiceMeetingRoomModule,
|
||||
UploadedDocumentModule,
|
||||
UploadedFileModule,
|
||||
PothosModule.forRoot({
|
||||
builder: {
|
||||
inject: [PrismaService],
|
||||
@@ -65,6 +65,10 @@ import { UploadedDocumentModule } from '../UploadedDocument/uploadeddocument.mod
|
||||
path: process.env.API_PATH + '/graphql',
|
||||
playground: true,
|
||||
introspection: true,
|
||||
installSubscriptionHandlers: true,
|
||||
subscriptions: {
|
||||
'graphql-ws': true,
|
||||
},
|
||||
}),
|
||||
],
|
||||
providers: [
|
||||
|
||||
Reference in New Issue
Block a user