mirror of
https://github.com/Dvorinka/Bookra.git
synced 2026-10-29 07:54:44 +00:00
feat(waitlist): queue position on the customer manage page
A waitlisted customer saw only a bare status — worse, the badge fell back to "Pending" for both waitlisted and cancelled states. The view now carries a 1-based waitlistPosition (earlier-created waitlisted bookings on the session + 1) and the page renders a warning-tone notice with the queue spot and auto-promotion explanation, in CS/EN. Also fixed the badge's nonexistent --danger-soft/--warning-soft tokens. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
7509e82261
commit
3892e9ce8c
7 files changed
+155
-14
No files matched your search
@@ -204,6 +204,18 @@ func (r *PGRepository) GetDashboardMetrics(ctx context.Context, tenantID string,
|
||||
return metrics, err
|
||||
}
|
||||
|
||||
func (r *PGRepository) GetWaitlistPosition(ctx context.Context, sessionID, bookingID string) (int, error) {
|
||||
var position int
|
||||
err := r.pool.QueryRow(ctx, `
|
||||
SELECT COUNT(*) + 1
|
||||
FROM bookings
|
||||
WHERE class_session_id = $1
|
||||
AND status = 'waitlisted'
|
||||
AND created_at < (SELECT created_at FROM bookings WHERE id = $2)
|
||||
`, sessionID, bookingID).Scan(&position)
|
||||
return position, err
|
||||
}
|
||||
|
||||
func (r *PGRepository) CancelPendingReminderJobsForBooking(ctx context.Context, bookingID string) error {
|
||||
_, err := r.pool.Exec(ctx, `
|
||||
UPDATE reminder_jobs
|
||||
|
||||
Reference in new issue
Block a user