Initial commit: Harat's Booking monorepo with deploy setup

This commit is contained in:
Eugenius-Anonymous
2026-06-08 14:36:51 +07:00
commit c97f7fd1a8
89 changed files with 10536 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
export class TableService {
async getByPub(pubId: number) {
return prisma.table.findMany({
where: { pubId },
orderBy: { number: 'asc' },
});
}
async getAvailability(pubId: number, date: string, time: string) {
const tables = await prisma.table.findMany({
where: { pubId },
orderBy: { number: 'asc' },
});
const reservedTables = await prisma.reservation.findMany({
where: {
pubId,
date: new Date(date),
time: new Date(`1970-01-01T${time}:00.000Z`),
status: { in: ['PENDING', 'CONFIRMED'] },
},
select: { tableId: true },
});
const reservedIds = new Set(reservedTables.map(r => r.tableId));
return tables.map(table => ({
...table,
isAvailable: !reservedIds.has(table.id),
}));
}
}