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

@@ -0,0 +1,29 @@
package httpapi
import (
"calllinesystem/server/internal/model"
"gorm.io/gorm"
)
type ticketPeopleTotals struct {
TicketCount int64 `gorm:"column:ticket_count"`
PeopleCount int64 `gorm:"column:people_count"`
}
func queueTotals(db *gorm.DB, projectID, sessionID, status string) (ticketPeopleTotals, error) {
var totals ticketPeopleTotals
err := db.Model(&model.QueueTicket{}).
Select("count(*) AS ticket_count, COALESCE(sum(party_size), 0) AS people_count").
Where("project_id = ? AND queue_session_id = ? AND status = ?", projectID, sessionID, status).
Scan(&totals).Error
return totals, err
}
func ticketsPartySize(tickets []model.QueueTicket) int {
total := 0
for _, ticket := range tickets {
total += ticket.PartySize
}
return total
}