Initial commit: Harat's Booking monorepo with deploy setup
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user