diff --git a/docs/API_SPEC.md b/docs/API_SPEC.md index 7179a2e..b830f3b 100644 --- a/docs/API_SPEC.md +++ b/docs/API_SPEC.md @@ -15,6 +15,7 @@ Base path: `/api/v1`. - `POST /auth/login/password`: password login fallback. - `POST /auth/change-password`: change the authenticated user's password. - `GET /me`: return the authenticated user. +- `PATCH /me`: edit user informations. Protected endpoints use: diff --git a/docs/openapi/visione.openapi.yaml b/docs/openapi/visione.openapi.yaml index 67e9ec8..7ba860a 100644 --- a/docs/openapi/visione.openapi.yaml +++ b/docs/openapi/visione.openapi.yaml @@ -385,6 +385,21 @@ ], "type": "object" }, + "EditUserRequest": { + "additionalProperties": false, + "properties": { + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "phone": { + "type": "string" + } + }, + "type": "object" + }, "EmailRequest": { "additionalProperties": false, "properties": { @@ -1597,7 +1612,7 @@ "get": { "description": "Lists configured municipal areas.", "operationId": "AdminController.listAreas", - "parameters": [], + "parameters": [ ], "responses": { "200": { "content": { @@ -1615,7 +1630,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "List areas", @@ -1626,7 +1641,7 @@ "post": { "description": "Creates a municipal area with GeoJSON boundary.", "operationId": "AdminController.createArea", - "parameters": [], + "parameters": [ ], "requestBody": { "content": { "application/json": { @@ -1660,7 +1675,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Create area", @@ -1673,7 +1688,7 @@ "get": { "description": "Lists active report categories.", "operationId": "AdminController.listCategories", - "parameters": [], + "parameters": [ ], "responses": { "200": { "content": { @@ -1691,7 +1706,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "List categories", @@ -1702,7 +1717,7 @@ "post": { "description": "Creates a report category.", "operationId": "AdminController.createCategory", - "parameters": [], + "parameters": [ ], "requestBody": { "content": { "application/json": { @@ -1736,7 +1751,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Create category", @@ -1800,7 +1815,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "List moderation flags", @@ -1857,7 +1872,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Update moderation flag", @@ -1870,7 +1885,7 @@ "get": { "description": "Returns report statistics for administration dashboards.", "operationId": "AdminController.overviewStats", - "parameters": [], + "parameters": [ ], "responses": { "200": { "content": { @@ -1891,7 +1906,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Overview stats", @@ -1904,7 +1919,7 @@ "get": { "description": "Lists intervention teams.", "operationId": "AdminController.listTeams", - "parameters": [], + "parameters": [ ], "responses": { "200": { "content": { @@ -1922,7 +1937,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "List teams", @@ -1933,7 +1948,7 @@ "post": { "description": "Creates an intervention team.", "operationId": "AdminController.createTeam", - "parameters": [], + "parameters": [ ], "requestBody": { "content": { "application/json": { @@ -1967,7 +1982,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Create team", @@ -1980,7 +1995,7 @@ "get": { "description": "Lists platform users with role information.", "operationId": "AdminController.listUsers", - "parameters": [], + "parameters": [ ], "responses": { "200": { "content": { @@ -2001,7 +2016,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "List users", @@ -2058,7 +2073,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Ban or unban user", @@ -2115,7 +2130,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Update user roles", @@ -2128,7 +2143,7 @@ "post": { "description": "Changes the authenticated user's password.", "operationId": "AuthController.changePassword", - "parameters": [], + "parameters": [ ], "requestBody": { "content": { "application/json": { @@ -2162,7 +2177,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Change password", @@ -2175,7 +2190,7 @@ "post": { "description": "Password-based login fallback for local development.", "operationId": "AuthController.loginWithPassword", - "parameters": [], + "parameters": [ ], "requestBody": { "content": { "application/json": { @@ -2211,7 +2226,7 @@ "post": { "description": "Sends a one-time code by email through Mailpit locally.", "operationId": "AuthController.requestOtp", - "parameters": [], + "parameters": [ ], "requestBody": { "content": { "application/json": { @@ -2247,7 +2262,7 @@ "post": { "description": "Verifies an email OTP and creates an API token.", "operationId": "AuthController.verifyOtp", - "parameters": [], + "parameters": [ ], "requestBody": { "content": { "application/json": { @@ -2283,7 +2298,7 @@ "post": { "description": "Creates a citizen account with personal data and password.", "operationId": "AuthController.registerCitizen", - "parameters": [], + "parameters": [ ], "requestBody": { "content": { "application/json": { @@ -2319,7 +2334,7 @@ "get": { "description": "Serves a local Swagger UI page backed by openapi.json.", "operationId": "ApiController.docs", - "parameters": [], + "parameters": [ ], "responses": { "200": { "content": { @@ -2342,7 +2357,7 @@ "get": { "description": "Returns process health without checking dependencies.", "operationId": "ApiController.health", - "parameters": [], + "parameters": [ ], "responses": { "200": { "content": { @@ -2365,7 +2380,7 @@ "get": { "description": "Returns the authenticated user's profile and permissions.", "operationId": "AuthController.me", - "parameters": [], + "parameters": [ ], "responses": { "200": { "content": { @@ -2383,13 +2398,55 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Current user", "tags": [ "Auth" ] + }, + "patch": { + "description": "Updates fields of the authenticated user's profile.", + "operationId": "AuthController.editUser", + "parameters": [ ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EditUserRequest" + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OkResponse" + } + } + }, + "description": "User profile updated successfully." + }, + "400": { + "description": "Invalid parameter type or structural error." + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + } + }, + "security": [ + { + "bearerAuth": [ ] + } + ], + "summary": "Edit current user profile", + "tags": [ + "Auth" + ] } }, "/api/v1/me/rewards": { @@ -2434,7 +2491,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Reward ledger", @@ -2485,7 +2542,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "List notifications", @@ -2532,7 +2589,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Mark notification read", @@ -2565,7 +2622,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Mark all notifications read", @@ -2618,7 +2675,7 @@ "get": { "description": "Returns the generated OpenAPI JSON document.", "operationId": "ApiController.openApi", - "parameters": [], + "parameters": [ ], "responses": { "200": { "content": { @@ -2682,7 +2739,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Assigned reports", @@ -2733,7 +2790,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Open unassigned reports", @@ -2784,7 +2841,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Other operator reports", @@ -2797,7 +2854,7 @@ "get": { "description": "Checks whether MySQL is reachable.", "operationId": "ApiController.ready", - "parameters": [], + "parameters": [ ], "responses": { "200": { "content": { @@ -2875,7 +2932,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "List reports", @@ -2886,7 +2943,7 @@ "post": { "description": "Creates a citizen urban issue report.", "operationId": "ReportController.create", - "parameters": [], + "parameters": [ ], "requestBody": { "content": { "application/json": { @@ -2920,7 +2977,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Create report", @@ -2964,7 +3021,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Report detail", @@ -3021,7 +3078,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Assign team", @@ -3078,7 +3135,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Add feedback", @@ -3135,7 +3192,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Flag report", @@ -3179,7 +3236,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Intervention summary", @@ -3236,7 +3293,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Upload media", @@ -3280,7 +3337,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "List messages", @@ -3335,7 +3392,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Add message", @@ -3401,7 +3458,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Flag message", @@ -3458,7 +3515,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Update report status", @@ -3505,7 +3562,7 @@ }, "security": [ { - "bearerAuth": [] + "bearerAuth": [ ] } ], "summary": "Take report",