update service status
This commit is contained in:
@@ -18,11 +18,17 @@ import SmartSubscriptionPlugin, {
|
||||
subscribeOptionsFromIterator,
|
||||
} from '@pothos/plugin-smart-subscriptions';
|
||||
import RelayPlugin from '@pothos/plugin-relay';
|
||||
import ErrorsPlugin from '@pothos/plugin-errors';
|
||||
import AuthzPlugin from '@pothos/plugin-authz';
|
||||
import { User } from '@prisma/client';
|
||||
// import { rules } from '../common/graphql/common.graphql.auth-rule';
|
||||
|
||||
export interface SchemaContext {
|
||||
req: Request;
|
||||
res: Response;
|
||||
generator: PrismaCrudGenerator<BuilderTypes>;
|
||||
me: User;
|
||||
pubSub: PubSub;
|
||||
generator: PrismaCrudGenerator<BuilderTypes>;
|
||||
}
|
||||
|
||||
export interface SchemaBuilderOption {
|
||||
@@ -32,6 +38,7 @@ export interface SchemaBuilderOption {
|
||||
Connection: {
|
||||
totalCount: number | (() => number | Promise<number>);
|
||||
};
|
||||
// AuthZRule: keyof typeof rules;
|
||||
Scalars: {
|
||||
DateTime: {
|
||||
Input: Date;
|
||||
@@ -60,6 +67,8 @@ export class Builder extends SchemaBuilder<SchemaBuilderOption> {
|
||||
SimpleObjectPlugin,
|
||||
SmartSubscriptionPlugin,
|
||||
RelayPlugin,
|
||||
ErrorsPlugin,
|
||||
AuthzPlugin,
|
||||
],
|
||||
smartSubscriptions: {
|
||||
debounceDelay: 1000,
|
||||
@@ -75,6 +84,9 @@ export class Builder extends SchemaBuilder<SchemaBuilderOption> {
|
||||
onUnusedQuery: process.env.NODE_ENV === 'production' ? null : 'warn',
|
||||
dmmf: getDatamodel(),
|
||||
},
|
||||
errors: {
|
||||
defaultTypes: [],
|
||||
},
|
||||
});
|
||||
this.generator = new PrismaCrudGenerator<BuilderTypes>(this);
|
||||
this.addScalarType('DateTime', DateTimeResolver);
|
||||
@@ -83,7 +95,7 @@ export class Builder extends SchemaBuilder<SchemaBuilderOption> {
|
||||
|
||||
this.queryType({});
|
||||
this.mutationType({});
|
||||
// this.subscriptionType({});
|
||||
this.subscriptionType({});
|
||||
|
||||
this.globalConnectionField('totalCount', (t) =>
|
||||
t.int({
|
||||
|
||||
@@ -6,6 +6,7 @@ import { PothosApolloDriver } from '@smatch-corp/nestjs-pothos-apollo-driver';
|
||||
import { Builder } from './graphql.builder';
|
||||
import { PrismaService } from '../Prisma/prisma.service';
|
||||
import { GraphQLValidationMiddleware } from '../middlewares/graphql.middleware';
|
||||
import { CommonModule } from '../common/common.module';
|
||||
import { PrismaModule } from '../Prisma/prisma.module';
|
||||
import { UserModule } from '../User/user.module';
|
||||
import { CenterModule } from '../Center/center.module';
|
||||
@@ -33,6 +34,7 @@ import { ManagedServiceModule } from '../ManagedService/managedservice.module';
|
||||
@Global()
|
||||
@Module({
|
||||
imports: [
|
||||
CommonModule,
|
||||
PrismaModule,
|
||||
UserModule,
|
||||
CenterModule,
|
||||
@@ -64,9 +66,9 @@ import { ManagedServiceModule } from '../ManagedService/managedservice.module';
|
||||
GraphQLModule.forRoot<ApolloDriverConfig>({
|
||||
driver: PothosApolloDriver,
|
||||
path: process.env.API_PATH + '/graphql',
|
||||
debug: process.env.NODE_ENV === 'development',
|
||||
playground: true,
|
||||
introspection: true,
|
||||
debug: process.env.NODE_ENV === 'development' || false,
|
||||
playground: process.env.NODE_ENV === 'development' || false,
|
||||
introspection: process.env.NODE_ENV === 'development' || false,
|
||||
installSubscriptionHandlers: true,
|
||||
subscriptions: {
|
||||
'graphql-ws': true,
|
||||
|
||||
Reference in New Issue
Block a user