Files
harats-booking/server/src/modules/pub/pub.service.ts
T
2026-06-08 14:36:51 +07:00

16 lines
371 B
TypeScript

import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
export class PubService {
async getAll() {
return prisma.pub.findMany({ orderBy: { name: 'asc' } });
}
async getById(id: number) {
const pub = await prisma.pub.findUnique({ where: { id } });
if (!pub) throw new Error('Паб не найден');
return pub;
}
}