Mosque Management
:::info Status
Implemented. Source: fastapi-backend/api/v1/endpoints/mosques.py.
:::
The mosque entity itself and who administers it — distinct from Membership, which covers the member↔mosque relationship.
Mosque CRUD
| Endpoint | Purpose |
|---|---|
GET /mosques | List/search mosques (by registration code, city, active flag, free-text q); paginated with limit/offset, or unpaginated for mobile/legacy clients when limit is omitted |
GET /mosques/{id} | Mosque detail — public, no auth required |
POST /mosques | Create a mosque; fails on a duplicate registration_code |
PATCH /mosques/{id} | Update a mosque — requires mosque-admin standing for that mosque (see Authorization); only a superadmin may change registration_code |
GET /mosques/{id}/audio | Look up the active recording for a trigger type (azaan, jummah, waaz, taraweeh, announcement, test) |
GET /mosques/{id}/activity | Merged recent-activity feed for the admin Overview page — broadcasts, device events, announcements, new members |
POST /mosques/{mosque_id}/trigger | Same as POST /triggers/mosque/{mosque_id} — create a broadcast trigger for this mosque |
Mosque admins
A mosque admin row is a separate relationship from memberships — see
Authorization — mosque-admin flags for
is_owner/can_trigger/can_manage.
| Endpoint | Purpose |
|---|---|
GET /mosques/{mosque_id}/admins | List a mosque's admins |
POST /mosques/{mosque_id}/admins | Add an existing user as an admin of this mosque |
DELETE /mosques/{mosque_id}/admins/{user_id} | Remove an admin |
Auto-approve members
mosques.auto_approve_members decides whether self-service joins
(POST /mosques/{id}/join, join-by-code) land as approved immediately or
pending — see Membership module.
Full request/response schemas: API Reference.