@@ -21,6 +21,7 @@ model Venue {
|
||||
regCodes RegistrationCode[]
|
||||
plannedTabs PlannedTab[]
|
||||
tabReminders TabReminder[]
|
||||
tabEvents TabEvent[]
|
||||
}
|
||||
|
||||
model Device {
|
||||
@@ -38,6 +39,7 @@ model Device {
|
||||
tabSnapshots OpenTabSnapshot[]
|
||||
tabOwnerships TabOwnership[]
|
||||
remoteCommands RemoteCommand[]
|
||||
tabEvents TabEvent[]
|
||||
|
||||
@@index([venueId, revokedAt])
|
||||
}
|
||||
@@ -183,3 +185,32 @@ model TabReminder {
|
||||
@@index([venueId, sentAt])
|
||||
@@index([venueId, tabId])
|
||||
}
|
||||
|
||||
// What happened on a tab, as reported by the terminal: lines added or removed, and settlements.
|
||||
// The id is generated by the terminal so a re-sent event is stored only once.
|
||||
model TabEvent {
|
||||
id String @id
|
||||
venueId String
|
||||
deviceId String
|
||||
tabId String
|
||||
customerName String
|
||||
// line_added | line_removed | settled
|
||||
type String
|
||||
productName String?
|
||||
unitPriceInCents Int?
|
||||
// Signed: positive for line_added, negative for line_removed
|
||||
quantityDelta Int?
|
||||
// settled only
|
||||
amountInCents Int?
|
||||
paymentMethod String?
|
||||
commandId String?
|
||||
items Json?
|
||||
occurredAt DateTime
|
||||
receivedAt DateTime @default(now())
|
||||
|
||||
venue Venue @relation(fields: [venueId], references: [id])
|
||||
device Device @relation(fields: [deviceId], references: [id])
|
||||
|
||||
@@index([venueId, occurredAt])
|
||||
@@index([venueId, type, occurredAt])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user