Skip to content

Commit 3b9e458

Browse files
authored
chore: add typed Fastify augmentation and global error handler utilities (#192)
1 parent 58cdf89 commit 3b9e458

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

apps/backend/src/plugins/prisma.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ import type { FastifyInstance } from 'fastify';
44

55
declare module 'fastify' {
66
interface FastifyInstance {
7-
prisma: PrismaClient;
7+
prisma: PrismaClient;
8+
authenticate(
9+
request: FastifyRequest,
10+
reply: FastifyReply
11+
): Promise<void>;
812
}
913
}
10-
1114
export const prismaPlugin = fp(async (app: FastifyInstance) => {
1215
const prisma = new PrismaClient({
1316
log: process.env.NODE_ENV !== 'production' ? ['query', 'error', 'warn'] : ['error'],
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function getErrorMessage(err: unknown): string {
2+
return err instanceof Error ? err.message : String(err);
3+
}

0 commit comments

Comments
 (0)