feat: support optional user_id ticket identifier
Add an alternative ticket identifier scheme: instead of (name, email),
external integrations can issue tickets bound to an LNbits user_id.
- m007 adds the user_id column on events.ticket
- CreateTicket validator enforces exactly one identifier scheme per ticket
- Ticket / PublicTicket: name, email, user_id all Optional
- _parse_ticket_row reverses the empty-string sentinel used to keep the
NOT NULL name/email columns satisfied when user_id is the identifier
- POST /tickets/{event_id} dispatches to _create_user_id_ticket vs
_create_named_ticket based on the supplied identifier
- New GET /tickets/user/{user_id} returns tickets for a given user
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
708d15629c
commit
11043ec8a7
4 changed files with 165 additions and 23 deletions
|
|
@ -189,3 +189,14 @@ async def m006_add_extra_fields(db):
|
|||
)
|
||||
await _alter_add_column_safe(db, "ALTER TABLE events.events ADD COLUMN extra TEXT")
|
||||
await _alter_add_column_safe(db, "ALTER TABLE events.ticket ADD COLUMN extra TEXT")
|
||||
|
||||
|
||||
async def m007_add_user_id_support(db):
|
||||
"""
|
||||
Add user_id column to ticket table so a ticket can reference an LNbits
|
||||
user id instead of (name, email). Application logic enforces that exactly
|
||||
one identifier scheme is used per ticket.
|
||||
"""
|
||||
await _alter_add_column_safe(
|
||||
db, "ALTER TABLE events.ticket ADD COLUMN user_id TEXT"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue