Add yes/no RSVP answers with required login
RSVPs now carry a status ('yes'/'no'). When auth is enabled, answering
requires login for all events, not just capped ones. Answers are deduped
one per user and re-answering updates in place. A 'no' zeroes plus_one,
is excluded from Going counts and cap math, frees the person's slot
claims, and shows in a separate "Can't make it" list.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+8
-4
@@ -64,12 +64,16 @@ DELETE FROM claims WHERE id = ?;
|
||||
-- name: CountClaimsBySlot :one
|
||||
SELECT COUNT(*) FROM claims WHERE slot_id = ?;
|
||||
|
||||
-- name: DeleteClaimsByEventAndName :exec
|
||||
DELETE FROM claims WHERE slot_id IN (SELECT id FROM slots WHERE event_id = ?)
|
||||
AND claims.name = ? COLLATE NOCASE;
|
||||
|
||||
-- name: ListRsvps :many
|
||||
SELECT * FROM rsvps WHERE event_id = ? ORDER BY created_at;
|
||||
|
||||
-- name: CreateRsvp :one
|
||||
INSERT INTO rsvps (event_id, name, note, plus_one, user_id)
|
||||
VALUES (?, ?, ?, ?, ?)
|
||||
INSERT INTO rsvps (event_id, name, note, plus_one, status, user_id)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
RETURNING *;
|
||||
|
||||
-- name: DeleteRsvp :exec
|
||||
@@ -85,7 +89,7 @@ SELECT * FROM rsvps WHERE event_id = ? AND name = ? COLLATE NOCASE LIMIT 1;
|
||||
SELECT * FROM rsvps WHERE event_id = ? AND user_id = ? LIMIT 1;
|
||||
|
||||
-- name: CountGoing :one
|
||||
SELECT CAST(COALESCE(SUM(1 + plus_one), 0) AS INTEGER) FROM rsvps WHERE event_id = ?;
|
||||
SELECT CAST(COALESCE(SUM(1 + plus_one), 0) AS INTEGER) FROM rsvps WHERE event_id = ? AND status = 'yes';
|
||||
|
||||
-- name: DeleteDuplicateRsvps :exec
|
||||
DELETE FROM rsvps WHERE id NOT IN (
|
||||
@@ -140,7 +144,7 @@ UPDATE events SET user_id = ? WHERE id = ?;
|
||||
SELECT * FROM rsvps WHERE id = ?;
|
||||
|
||||
-- name: UpdateRsvp :exec
|
||||
UPDATE rsvps SET name = ?, note = ?, plus_one = ? WHERE id = ?;
|
||||
UPDATE rsvps SET name = ?, note = ?, plus_one = ?, status = ? WHERE id = ?;
|
||||
|
||||
-- name: CreateSmsConsent :exec
|
||||
INSERT INTO sms_consents (phone, ip_address, user_agent) VALUES (?, ?, ?);
|
||||
|
||||
Reference in New Issue
Block a user