Add edit RSVP modal, plus-one tracking, and unified signup form
Merge RSVP + slot claim into a single form. Add plus_one field to RSVPs. Add clickable RSVP names that open a modal to edit name/note/plus_one. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,7 @@ type Rsvp struct {
|
||||
EventID int64
|
||||
Name string
|
||||
Note string
|
||||
PlusOne int64
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
|
||||
+8
-2
@@ -59,8 +59,8 @@ SELECT COUNT(*) FROM claims WHERE slot_id = ?;
|
||||
SELECT * FROM rsvps WHERE event_id = ? ORDER BY created_at;
|
||||
|
||||
-- name: CreateRsvp :one
|
||||
INSERT INTO rsvps (event_id, name, note)
|
||||
VALUES (?, ?, ?)
|
||||
INSERT INTO rsvps (event_id, name, note, plus_one)
|
||||
VALUES (?, ?, ?, ?)
|
||||
RETURNING *;
|
||||
|
||||
-- name: DeleteRsvp :exec
|
||||
@@ -120,3 +120,9 @@ SELECT * FROM events WHERE user_id = ? ORDER BY created_at DESC;
|
||||
|
||||
-- name: SetEventUser :exec
|
||||
UPDATE events SET user_id = ? WHERE id = ?;
|
||||
|
||||
-- name: GetRsvp :one
|
||||
SELECT * FROM rsvps WHERE id = ?;
|
||||
|
||||
-- name: UpdateRsvp :exec
|
||||
UPDATE rsvps SET name = ?, note = ?, plus_one = ? WHERE id = ?;
|
||||
|
||||
+54
-6
@@ -101,25 +101,32 @@ func (q *Queries) CreateEvent(ctx context.Context, arg CreateEventParams) (Event
|
||||
}
|
||||
|
||||
const createRsvp = `-- name: CreateRsvp :one
|
||||
INSERT INTO rsvps (event_id, name, note)
|
||||
VALUES (?, ?, ?)
|
||||
RETURNING id, event_id, name, note, created_at
|
||||
INSERT INTO rsvps (event_id, name, note, plus_one)
|
||||
VALUES (?, ?, ?, ?)
|
||||
RETURNING id, event_id, name, note, plus_one, created_at
|
||||
`
|
||||
|
||||
type CreateRsvpParams struct {
|
||||
EventID int64
|
||||
Name string
|
||||
Note string
|
||||
PlusOne int64
|
||||
}
|
||||
|
||||
func (q *Queries) CreateRsvp(ctx context.Context, arg CreateRsvpParams) (Rsvp, error) {
|
||||
row := q.db.QueryRowContext(ctx, createRsvp, arg.EventID, arg.Name, arg.Note)
|
||||
row := q.db.QueryRowContext(ctx, createRsvp,
|
||||
arg.EventID,
|
||||
arg.Name,
|
||||
arg.Note,
|
||||
arg.PlusOne,
|
||||
)
|
||||
var i Rsvp
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.EventID,
|
||||
&i.Name,
|
||||
&i.Note,
|
||||
&i.PlusOne,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
@@ -332,8 +339,26 @@ func (q *Queries) GetEventBySlug(ctx context.Context, slug string) (Event, error
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getRsvp = `-- name: GetRsvp :one
|
||||
SELECT id, event_id, name, note, plus_one, created_at FROM rsvps WHERE id = ?
|
||||
`
|
||||
|
||||
func (q *Queries) GetRsvp(ctx context.Context, id int64) (Rsvp, error) {
|
||||
row := q.db.QueryRowContext(ctx, getRsvp, id)
|
||||
var i Rsvp
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.EventID,
|
||||
&i.Name,
|
||||
&i.Note,
|
||||
&i.PlusOne,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getRsvpByName = `-- name: GetRsvpByName :one
|
||||
SELECT id, event_id, name, note, created_at FROM rsvps WHERE event_id = ? AND name = ? COLLATE NOCASE LIMIT 1
|
||||
SELECT id, event_id, name, note, plus_one, created_at FROM rsvps WHERE event_id = ? AND name = ? COLLATE NOCASE LIMIT 1
|
||||
`
|
||||
|
||||
type GetRsvpByNameParams struct {
|
||||
@@ -349,6 +374,7 @@ func (q *Queries) GetRsvpByName(ctx context.Context, arg GetRsvpByNameParams) (R
|
||||
&i.EventID,
|
||||
&i.Name,
|
||||
&i.Note,
|
||||
&i.PlusOne,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
@@ -549,7 +575,7 @@ func (q *Queries) ListEventsByUser(ctx context.Context, userID sql.NullInt64) ([
|
||||
}
|
||||
|
||||
const listRsvps = `-- name: ListRsvps :many
|
||||
SELECT id, event_id, name, note, created_at FROM rsvps WHERE event_id = ? ORDER BY created_at
|
||||
SELECT id, event_id, name, note, plus_one, created_at FROM rsvps WHERE event_id = ? ORDER BY created_at
|
||||
`
|
||||
|
||||
func (q *Queries) ListRsvps(ctx context.Context, eventID int64) ([]Rsvp, error) {
|
||||
@@ -566,6 +592,7 @@ func (q *Queries) ListRsvps(ctx context.Context, eventID int64) ([]Rsvp, error)
|
||||
&i.EventID,
|
||||
&i.Name,
|
||||
&i.Note,
|
||||
&i.PlusOne,
|
||||
&i.CreatedAt,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
@@ -675,6 +702,27 @@ func (q *Queries) UpdateEventDescription(ctx context.Context, arg UpdateEventDes
|
||||
return err
|
||||
}
|
||||
|
||||
const updateRsvp = `-- name: UpdateRsvp :exec
|
||||
UPDATE rsvps SET name = ?, note = ?, plus_one = ? WHERE id = ?
|
||||
`
|
||||
|
||||
type UpdateRsvpParams struct {
|
||||
Name string
|
||||
Note string
|
||||
PlusOne int64
|
||||
ID int64
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateRsvp(ctx context.Context, arg UpdateRsvpParams) error {
|
||||
_, err := q.db.ExecContext(ctx, updateRsvp,
|
||||
arg.Name,
|
||||
arg.Note,
|
||||
arg.PlusOne,
|
||||
arg.ID,
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
const updateSlot = `-- name: UpdateSlot :exec
|
||||
UPDATE slots SET name = ?, emoji = ?, max_claims = ? WHERE id = ?
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user