ba me oi con thanh cong roi

This commit is contained in:
2024-10-14 23:05:35 +07:00
parent 76ff5d28ac
commit 0ac5868d2d
18 changed files with 365 additions and 138 deletions

View File

@@ -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({});