4.6 KiB
4.6 KiB
Visione API Spec
Base path: /api/v1
Auth Header
Authorization: Bearer <token>
Roles
- public: no auth
- authenticated: any valid user
- operator:
reports.manageor admin - admin: role/permission admin
HTTP Semantics
200: success401: missing or invalid auth403: authenticated but forbidden404: missing resource or invalid public intervention token409: workflow or ownership conflict422: semantic payload/reference error
Technical
GET /healthGET /readyGET /openapi.jsonGET /docs
Auth + Profile
POST /auth/registercitizen registrationPOST /auth/otp/requestsends OTP through MailpitPOST /auth/otp/verifyconsumes OTP, returns bearer tokenPOST /auth/login/passwordpassword fallback loginPOST /auth/change-passwordauthenticated password change, also clearsmust_change_passwordGET /mecurrent user profile, roles, permissions, pointsPATCH /meeditable fields today:first_name,last_name,phone
Public Reference / Public Access
GET /areasactive municipal areasGET /interventions/{token}public external-team summary linkGET /open-data/reportsanonymized reports inRESOLVEDorCLOSEDfiltered to Bari municipal boundary
User Reference / Personal
GET /report-categoriesactive report categories, authenticated users onlyGET /notificationsPATCH /notifications/{id}/readPATCH /notifications/read-allGET /me/rewards
Report Endpoints
POST /reportscreate citizen report, optional inlinemedia, area inferred by GeoJSON coordinates must stay inside allowed Bari municipal boundaryGET /reportscitizen sees own reports; operator/admin see allGET /reports/{id}detail + status history + mediaGET /reports/{id}/messagesPOST /reports/{id}/messagesPOST /reports/{id}/mediamax 5 total media, image/video onlyPOST /reports/{id}/feedbackonly owner, only when status isRESOLVED
Operator Workflow
GET /operator/teamsactive external intervention teamsGET /operator/reports/openGET /operator/reports/assignedGET /operator/reports/othersPOST /reports/{id}/takeOPEN -> UNDER_REVIEWPATCH /reports/{id}/statusonly owner operator or admin, valid transitions onlyPOST /reports/{id}/assignmentsassign external team if report isOPEN, assignment can directly claim report and move toASSIGNEDGET /reports/{id}/intervention-summaryoperator/admin full summary with citizen contact dataGET /reports/{id}/team-suggestionssuggestions by category/team-category mapping and areaPOST /reports/{id}/intervention-linkcreate/rotate public intervention token for current assignmentDELETE /reports/{id}/intervention-linkrevoke active intervention token
Moderation
POST /reports/{id}/flagsoperator flags owned reportPOST /reports/{id}/messages/{message_id}/flagsoperator flags owned report messageGET /admin/moderationadmin moderation queuePATCH /admin/moderation/{id}admin resolves/dismisses; may also reject report
Admin Reference Data
POST /admin/categoriesPATCH /admin/categories/{id}POST /admin/areasPATCH /admin/areas/{id}area polygon must stay inside allowed Bari municipal boundaryPOST /admin/teamsPATCH /admin/teams/{id}GET /admin/usersPATCH /admin/users/{id}/rolesPATCH /admin/users/{id}/banGET /admin/stats/overview
Workflow Summary
Citizen
- register/login
- create
OPENreport - watch status/history/media
- chat with operator
- receive notifications
- leave feedback on
RESOLVED
Operator
- inspect open queue
takeor assign team directly- own report through
assigned_operator_id - update status / chat / moderate
- generate public team link
Admin
- manage reference data and users
- resolve moderation
- read global stats
Current Status Machine
OPEN -> UNDER_REVIEW | REJECTEDUNDER_REVIEW -> ASSIGNED | REJECTEDASSIGNED -> IN_PROGRESS | REJECTEDIN_PROGRESS -> RESOLVED | REJECTEDRESOLVED -> CLOSEDREJECTED -> CLOSED
Important Current Truths
- External teams are not platform users.
- Platform owner is always
reports.assigned_operator_id. assignmentsis historical external team linkage only.- Feedback does not auto-close report.
- Public intervention summary exposes citizen phone by design, but not email or full surname.
- Report coordinates are constrained to Bari municipal boundary.
- Admin-created area polygons must stay inside Bari municipal boundary.