feat(http): CMS pages + REST API for owners and customers
views.py (Jinja CMS pages, /restaurant/...):
- / restaurant list / dashboard
- /{slug} menu builder
- /{slug}/orders order monitor
- /{slug}/kds kitchen display
- /{slug}/settings restaurant + Nostr settings
views_api.py (REST under /restaurant/api/v1/):
Owner write-side (require_admin_key, ownership-checked):
- restaurants CRUD (publishes kind 0 metadata to Nostr on
create/update; signs with restaurant.nostr_pubkey override
or LNbits Account fallback)
- categories + subcategories CRUD
- menu_items CRUD (publishes/replaces kind 30402 NIP-99
listings on create/update; sends kind 5 NIP-09 deletion on
delete)
- modifier_groups + modifiers CRUD
- availability_windows CRUD
- orders status transitions (PUT /api/v1/orders/{id}/status/{new})
- print_jobs/{id}/ack
- settings (admin-only)
Customer-facing (no auth, customer pubkey optional):
- GET /api/v1/restaurants/{id} profile
- GET /api/v1/restaurants/{id}/menu full menu tree
(categories +
subcategories +
items + modifiers +
availability) in
one round trip
- POST /api/v1/orders/quote pre-flight balance
check; webapp calls
this *before* opening
any per-restaurant
invoice
- POST /api/v1/orders place an order on
one restaurant,
returns bolt11
KDS / order monitor (require_invoice_key, ownership-checked):
- GET /api/v1/restaurants/{id}/orders
- GET /api/v1/restaurants/{id}/print_jobs
crud.py: added get_print_job(job_id) helper used by the ack endpoint.
This commit is contained in:
parent
b155548036
commit
c37b17d474
3 changed files with 871 additions and 0 deletions
8
crud.py
8
crud.py
|
|
@ -563,6 +563,14 @@ async def update_print_job(job: PrintJob) -> PrintJob:
|
|||
return job
|
||||
|
||||
|
||||
async def get_print_job(job_id: str) -> Optional[PrintJob]:
|
||||
return await db.fetchone(
|
||||
"SELECT * FROM restaurant.print_jobs WHERE id = :id",
|
||||
{"id": job_id},
|
||||
PrintJob,
|
||||
)
|
||||
|
||||
|
||||
async def get_print_jobs(
|
||||
restaurant_id: str, status: Optional[str] = None
|
||||
) -> list[PrintJob]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue