feat: add SQL query presets, shared program form, and loyalty API/admin improvements
- Add Loyalty and Billing SQL query presets to dev tools - Extract shared program-form.html partial and loyalty-program-form.js mixin - Refactor admin program-edit to use shared form partial - Add store loyalty API endpoints for program management Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -153,6 +153,22 @@ def update_program(
|
||||
return response
|
||||
|
||||
|
||||
@router.delete("/program", status_code=204)
|
||||
def delete_program(
|
||||
current_user: User = Depends(get_current_store_api),
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
"""Delete the merchant's loyalty program (merchant_owner only)."""
|
||||
if current_user.role != "merchant_owner":
|
||||
raise AuthorizationException("Only merchant owners can delete programs")
|
||||
|
||||
store_id = current_user.token_store_id
|
||||
|
||||
program = program_service.require_program_by_store(db, store_id)
|
||||
program_service.delete_program(db, program.id)
|
||||
logger.info(f"Store user deleted loyalty program {program.id}")
|
||||
|
||||
|
||||
@router.get("/stats", response_model=ProgramStatsResponse)
|
||||
def get_stats(
|
||||
current_user: User = Depends(get_current_store_api),
|
||||
|
||||
Reference in New Issue
Block a user