Refactor code structure and dependencies
- Remove unused files and modules - Update submodule URL for epess-database - Update DATABASE_URL in compose.yaml - Update CI workflow to fetch submodules during checkout and fix GITHUB_TOKEN issue - Enable strict mode in tsconfig.json - Add UsersService and UsersResolver in users module - Remove AppService and AppController - Update main.ts to remove unused imports and log statement - Add PrismaModule and PrismaService - Add PrismaContextMiddleware - Update GraphQL module to use schema and PrismaService - Update package.json dependencies and devDependencies
This commit is contained in:
@@ -1,48 +1,18 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { GraphQLModule } from '@nestjs/graphql';
|
||||
import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
|
||||
|
||||
const subOperationHandler = (message: any, params: any, webSocket: any) => {
|
||||
console.log('onOperation');
|
||||
return params;
|
||||
};
|
||||
import { PrismaService } from '../prisma/prisma.service';
|
||||
import { schema } from './schema';
|
||||
@Module({
|
||||
imports: [
|
||||
GraphQLModule.forRoot<ApolloDriverConfig>({
|
||||
driver: ApolloDriver, // Specify the driver
|
||||
buildSchemaOptions: {
|
||||
numberScalarMode: 'integer',
|
||||
},
|
||||
subscriptions: {
|
||||
'subscriptions-transport-ws': {
|
||||
keepAlive: 5000,
|
||||
path: '/graphql-sub',
|
||||
onOperation: (message: any, params: any, webSocket: any) => {
|
||||
subOperationHandler(message, params, webSocket);
|
||||
return params;
|
||||
},
|
||||
onConnect: (connectionParams: any, webSocket: any) => {
|
||||
console.log('onConnect');
|
||||
return connectionParams;
|
||||
},
|
||||
onDisconnect: (webSocket: any) => {
|
||||
console.log('onDisconnect');
|
||||
},
|
||||
},
|
||||
},
|
||||
playground: {
|
||||
workspaceName: 'EPESS',
|
||||
tabs: [
|
||||
{
|
||||
endpoint: '/graphql',
|
||||
query: `# Welcome to the EPESS GraphQL API
|
||||
`,
|
||||
},
|
||||
],
|
||||
},
|
||||
introspection: true,
|
||||
driver: ApolloDriver,
|
||||
schema: schema,
|
||||
debug: true,
|
||||
allowBatchedHttpRequests: true,
|
||||
introspection: true,
|
||||
}),
|
||||
],
|
||||
providers: [PrismaService],
|
||||
})
|
||||
export class GraphqlModule {}
|
||||
|
||||
Reference in New Issue
Block a user