From ef562138308b5d871749c8d14d9af79dcde41f49 Mon Sep 17 00:00:00 2001 From: GeorgeWebberley Date: Sun, 1 Mar 2026 12:17:20 +0100 Subject: [PATCH] Fixed build issues with prisma client and updated imports in app module for storage and grapghql --- README.md | 4 ---- nest-cli.json | 6 +++++- src/app.module.ts | 33 ++++++++++++++++++++++++++--- src/common/prisma/prisma.service.ts | 2 +- tsconfig.json | 6 +----- 5 files changed, 37 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 0e2c00a..e69de29 100644 --- a/README.md +++ b/README.md @@ -1,4 +0,0 @@ - - - -Security Note: This project uses NestJS 11 and Prisma 7. Current npm audit reports are primarily linked to development-only CLI tools (@prisma/dev) and internal peer-dependency mismatches in the Express 5 ecosystem. No critical production-level vulnerabilities are currently unpatched in the core runtime. \ No newline at end of file diff --git a/nest-cli.json b/nest-cli.json index f9aa683..2e3084a 100644 --- a/nest-cli.json +++ b/nest-cli.json @@ -3,6 +3,10 @@ "collection": "@nestjs/schematics", "sourceRoot": "src", "compilerOptions": { - "deleteOutDir": true + "deleteOutDir": true, + "assets": [ + "generated/prisma/package.json" + ], + "watchAssets": true } } diff --git a/src/app.module.ts b/src/app.module.ts index 4d1e673..af881b9 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -1,10 +1,37 @@ -import { Module } from '@nestjs/common'; +import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; import { PrismaModule } from './common/prisma/prisma.module'; import { CasesModule } from './cases/cases.module'; +import { ConfigModule } from '@nestjs/config'; +import { GraphQLModule } from '@nestjs/graphql'; +import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo'; +import { join } from 'path'; +import { StorageModule } from './common/storage/storage.module'; +import { graphqlUploadExpress } from 'graphql-upload-ts'; + @Module({ - imports: [PrismaModule, CasesModule], + imports: [ + ConfigModule.forRoot({ + isGlobal: true, + }), + GraphQLModule.forRoot({ + driver: ApolloDriver, + autoSchemaFile: join(process.cwd(), 'src/schema.gql'), + sortSchema: true, + playground: true, + // Needed for uploads in Apollo v4 + csrfPrevention: false, + }), + + + PrismaModule, CasesModule, StorageModule,], controllers: [], providers: [], }) -export class AppModule {} +export class AppModule implements NestModule { + configure(consumer: MiddlewareConsumer) { + consumer + .apply(graphqlUploadExpress({ maxFileSize: 10000000, maxFiles: 1 })) + .forRoutes('graphql'); + } +} diff --git a/src/common/prisma/prisma.service.ts b/src/common/prisma/prisma.service.ts index c520ca8..8c2b800 100644 --- a/src/common/prisma/prisma.service.ts +++ b/src/common/prisma/prisma.service.ts @@ -1,4 +1,4 @@ -import { PrismaClient } from '@db'; +import { PrismaClient } from '../../generated/prisma/client.js'; import { Injectable, OnModuleInit, OnModuleDestroy } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { PrismaPg } from '@prisma/adapter-pg'; diff --git a/tsconfig.json b/tsconfig.json index 76db106..13d19b6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,11 +14,7 @@ "sourceMap": true, "outDir": "./dist", "baseUrl": "./", - "paths": { - "@db": [ - "./src/generated/prisma/client.ts" - ] - }, + "paths": {}, "incremental": true, "skipLibCheck": true, "strictNullChecks": true,