Skip to content

Instantly share code, notes, and snippets.

View copy-ninja1's full-sized avatar
🏠
Working from home

Emmanuel copy-ninja1

🏠
Working from home
View GitHub Profile
@copy-ninja1
copy-ninja1 / base.type.ts
Last active March 22, 2025 16:25
Prisma Base Service with nestjs
export type Operations =
| 'aggregate'
| 'count'
| 'create'
| 'createMany'
| 'delete'
| 'deleteMany'
| 'findFirst'
| 'findMany'
| 'findUnique'
@copy-ninja1
copy-ninja1 / errorMap.prisma.ts
Last active November 17, 2024 22:11
This is a Prisma Error Map, it provides clear error messages for common issues like duplicate records, missing data, or constraint violations.
import {
BadRequestException,
NotFoundException,
ConflictException,
InternalServerErrorException,
} from '@nestjs/common';
export enum PrismaErrorCode {
P2000 = 'P2000',