feat: add party-size queueing and call modes

This commit is contained in:
wangxuming
2026-07-16 11:40:34 +08:00
parent 7f751bebae
commit 66951b4dc3
53 changed files with 3348 additions and 533 deletions

View File

@@ -10,6 +10,10 @@ const (
RoleStaff = "STAFF"
// SuperAdminUsername identifies the permanent production owner account.
SuperAdminUsername = "xqkwljtadmin"
// PublicVisitorUsername is a non-login system actor used for anonymous
// visitor-created tickets so existing foreign keys and idempotency records
// remain attributable without borrowing a real staff account.
PublicVisitorUsername = "public-visitor"
ProjectNotOpen = "NOT_OPEN"
ProjectRunning = "RUNNING"
@@ -19,6 +23,10 @@ const (
ETAFixedBatch = "FIXED_BATCH"
ETAContinuous = "CONTINUOUS"
CallModeTicket = "TICKET"
CallModePeople = "PEOPLE"
CallModeBoth = "BOTH"
TicketWaiting = "WAITING"
TicketCalled = "CALLED"
TicketArrived = "ARRIVED"
@@ -46,7 +54,13 @@ type Project struct {
Status string `gorm:"size:16;not null"`
Timezone string `gorm:"size:64;not null"`
TicketPrefix string `gorm:"size:8;not null"`
CallBatchSize int `gorm:"not null"`
CallBatchSize int `gorm:"column:call_batch_size;not null"`
CallMode string `gorm:"column:call_mode;size:16;not null;default:BOTH"`
MaxCallTicketCount int `gorm:"column:max_call_ticket_count;not null;default:100"`
DefaultCallPeopleCount int `gorm:"column:default_call_people_count;not null;default:1"`
MaxCallPeopleCount int `gorm:"column:max_call_people_count;not null;default:100"`
MinPartySize int `gorm:"column:min_party_size;not null;default:1"`
MaxPartySize int `gorm:"column:max_party_size;not null;default:10"`
GracePeriodMinutes int `gorm:"not null"`
ETAMode string `gorm:"column:eta_mode;size:24;not null"`
AverageBatchIntervalSeconds int `gorm:"not null"`
@@ -54,6 +68,7 @@ type Project struct {
ETABufferMinutes int `gorm:"column:eta_buffer_minutes;not null"`
ETAIntervalSeconds int `gorm:"column:eta_interval_seconds;not null;default:60"`
VisitorNotice string `gorm:"column:visitor_notice;size:240;not null"`
ExperiencedPeopleStart int `gorm:"column:experienced_people_start;not null;default:0"`
DisplayTokenHash *string `gorm:"type:char(64)"`
DeviceSimulationMode string `gorm:"size:16;not null"`
CreatedAt time.Time
@@ -99,6 +114,7 @@ type QueueTicket struct {
ReissuedFromTicketID *string `gorm:"type:uuid;uniqueIndex"`
TicketNumber int `gorm:"not null"`
DisplayNumber string `gorm:"size:24;not null"`
PartySize int `gorm:"column:party_size;not null;default:1"`
PublicTokenHash string `gorm:"type:char(64);not null;uniqueIndex"`
PhoneCiphertext []byte `gorm:"type:bytea"`
PhoneNonce []byte `gorm:"type:bytea"`
@@ -126,6 +142,10 @@ type CallBatch struct {
BatchSequence int `gorm:"not null"`
Revision int64 `gorm:"not null"`
Status string `gorm:"size:16;not null"`
CallMode string `gorm:"column:call_mode;size:16;not null;default:TICKET"`
RequestedCount int `gorm:"column:requested_count;not null;default:1"`
TicketCount int `gorm:"column:ticket_count;not null;default:1"`
PeopleCount int `gorm:"column:people_count;not null;default:1"`
RequestedBy string `gorm:"type:uuid;not null"`
CalledAt time.Time `gorm:"not null"`
CompletedAt *time.Time