feat: event proposal and approval workflow #9
1 changed files with 20 additions and 0 deletions
feat: add CRUD functions for public and pending event queries
- get_public_events(): returns approved, non-canceled events - get_pending_events(): returns proposed events for admin review Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
commit
0c782e6239
20
crud.py
20
crud.py
|
|
@ -200,6 +200,26 @@ async def get_all_events() -> list[Event]:
|
|||
)
|
||||
|
||||
|
||||
async def get_public_events() -> list[Event]:
|
||||
"""Get approved, non-canceled events for public display."""
|
||||
return await db.fetchall(
|
||||
"""
|
||||
SELECT * FROM events.events
|
||||
WHERE status = 'approved' AND canceled = FALSE
|
||||
ORDER BY event_start_date ASC
|
||||
""",
|
||||
model=Event,
|
||||
)
|
||||
|
||||
|
||||
async def get_pending_events() -> list[Event]:
|
||||
"""Get proposed events awaiting admin approval."""
|
||||
return await db.fetchall(
|
||||
"SELECT * FROM events.events WHERE status = 'proposed' ORDER BY time DESC",
|
||||
model=Event,
|
||||
)
|
||||
|
||||
|
||||
async def delete_event(event_id: str) -> None:
|
||||
await db.execute("DELETE FROM events.events WHERE id = :id", {"id": event_id})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue