From 703470e501b88c2f3533d7b781dddad59a3e2333 Mon Sep 17 00:00:00 2001 From: neodk2004 Date: Sat, 27 Dec 2025 10:42:10 +0100 Subject: [PATCH] feat(backend): activate posts feed with prisma + strict DI --- backend/src/auth/types/auth-request.ts | 8 ++++++++ backend/src/posts/posts.module.ts | 14 ++++++++++++++ backend/src/prisma/prisma.module.ts | 9 +++++++++ 3 files changed, 31 insertions(+) create mode 100644 backend/src/auth/types/auth-request.ts create mode 100644 backend/src/posts/posts.module.ts create mode 100644 backend/src/prisma/prisma.module.ts diff --git a/backend/src/auth/types/auth-request.ts b/backend/src/auth/types/auth-request.ts new file mode 100644 index 0000000..e825052 --- /dev/null +++ b/backend/src/auth/types/auth-request.ts @@ -0,0 +1,8 @@ +import { Request } from 'express'; + +export interface AuthRequest extends Request { + user: { + id: string; + role: 'USER' | 'ADMIN' | 'MOD'; + } | null; +} diff --git a/backend/src/posts/posts.module.ts b/backend/src/posts/posts.module.ts new file mode 100644 index 0000000..1585f1f --- /dev/null +++ b/backend/src/posts/posts.module.ts @@ -0,0 +1,14 @@ +import { Module } from '@nestjs/common'; +import { PostsController } from './posts.controller'; +import { PostsService } from './posts.service'; +import { PrismaModule } from '../prisma/prisma.module'; +import { PrismaService } from '../prisma/prisma.service'; + +@Module({ + imports: [ + PrismaModule, // 👈 DAS ist der Schlüssel + ], + controllers: [PostsController], + providers: [PostsService, PrismaService,], +}) +export class PostsModule {} diff --git a/backend/src/prisma/prisma.module.ts b/backend/src/prisma/prisma.module.ts new file mode 100644 index 0000000..864e748 --- /dev/null +++ b/backend/src/prisma/prisma.module.ts @@ -0,0 +1,9 @@ +import { Global, Module } from '@nestjs/common'; +import { PrismaService } from '../../prisma/prisma.service'; + +@Global() +@Module({ + providers: [PrismaService], + exports: [PrismaService], +}) +export class PrismaModule {}