feat: add better tab view
CI / build-and-test (push) Canceled after 0s

This commit is contained in:
2026-10-28 00:37:16 +01:00
parent bca6e88138
commit ca3af671cf
37 changed files with 740 additions and 79 deletions
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Venue" ADD COLUMN "cashPaymentEmails" TEXT[] DEFAULT ARRAY[]::TEXT[];
@@ -0,0 +1,5 @@
-- Every venue gets a "Free Drinks" customer; the next sync opens its tab (or keeps one that is already open)
INSERT INTO "PlannedTab" ("id", "venueId", "customerName", "customerNameKey", "position", "createdAt")
SELECT gen_random_uuid()::text, "id", 'Free Drinks', 'free drinks', 0, CURRENT_TIMESTAMP
FROM "Venue"
ON CONFLICT ("venueId", "customerNameKey") DO NOTHING;
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "TabEvent" ADD COLUMN "orderId" TEXT;
+4
View File
@@ -28,6 +28,8 @@ model Venue {
// Set on the first sync after the server started holding the tabs: the tabs were then taken over from the
// terminal's own open tabs, once
tabsSeededAt DateTime?
// Get an email for every tab paid in cash, on a terminal or on the dashboard
cashPaymentEmails String[] @default([])
}
model Device {
@@ -179,6 +181,8 @@ model TabEvent {
// tab_opened | tab_renamed | tab_deleted | line_added | line_removed | settled | stock_set
type String
lineId String?
// line_added / line_removed: the order on the terminal the drinks belong to
orderId String?
productId String?
productName String?
unitPriceInCents Int?
+3
View File
@@ -2,6 +2,7 @@ import * as bcrypt from 'bcrypt';
import { PrismaClient } from '@prisma/client';
import { v4 as uuidv4 } from 'uuid';
import * as crypto from 'crypto';
import { ensureDefaultCustomers } from '../src/planned-tabs/default-customers';
const prisma = new PrismaClient();
@@ -31,6 +32,7 @@ async function main() {
await prisma.venue.create({
data: { id: venueId, name: 'KoolTap Demo Bar' },
});
await ensureDefaultCustomers(prisma, venueId);
console.log(`Created venue: KoolTap Demo Bar (${venueId})`);
// Create admin user
@@ -78,6 +80,7 @@ async function main() {
// A second venue, so the admin page has more than one
const secondVenueId = uuidv4();
await prisma.venue.create({ data: { id: secondVenueId, name: 'KoolTap Festival Bar' } });
await ensureDefaultCustomers(prisma, secondVenueId);
await prisma.clientUser.create({
data: {
id: uuidv4(),