mirror of
https://github.com/we-promise/sure.git
synced 2026-04-18 11:34:13 +00:00
Document admin-only reset auth in OpenAPI docs (#1198)
* Document admin-only reset auth in OpenAPI docs The DELETE /api/v1/users/reset endpoint now requires admin role (ensure_admin). Update the rswag spec to: - Set default user role to admin so the 200 test passes - Add a 403 response case for non-admin users with read_write scope - Clarify the description notes admin requirement - Add SuccessMessage schema and users paths to openapi.yaml https://claude.ai/code/session_01Tj8ToLRmVg5HLmHwq9KKDY * Consolidate duplicate 403 responses for reset endpoint OpenAPI keys responses by status code, so two 403 blocks caused the first (insufficient scope) to be silently overwritten by the second (non-admin). Merge into a single 403 whose description covers both causes: requires read_write scope and admin role. The test exercises the read-only key path which hits 403 via scope check. https://claude.ai/code/session_01Tj8ToLRmVg5HLmHwq9KKDY * Em-dash out of messages. * Fix tests * Fix tests --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -545,6 +545,13 @@ components:
|
||||
properties:
|
||||
message:
|
||||
type: string
|
||||
SuccessMessage:
|
||||
type: object
|
||||
required:
|
||||
- message
|
||||
properties:
|
||||
message:
|
||||
type: string
|
||||
ImportConfiguration:
|
||||
type: object
|
||||
properties:
|
||||
@@ -2718,3 +2725,66 @@ paths:
|
||||
type: string
|
||||
description: Additional notes
|
||||
required: true
|
||||
"/api/v1/users/reset":
|
||||
delete:
|
||||
summary: Reset account
|
||||
tags:
|
||||
- Users
|
||||
description: Resets all financial data (accounts, categories, merchants, tags,
|
||||
etc.) for the current user's family while keeping the user account intact.
|
||||
The reset runs asynchronously in the background. Requires admin role.
|
||||
security:
|
||||
- apiKeyAuth: []
|
||||
responses:
|
||||
'200':
|
||||
description: account reset initiated
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/SuccessMessage"
|
||||
'401':
|
||||
description: unauthorized
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
'403':
|
||||
description: "forbidden \u2014 requires read_write scope and admin role"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
"/api/v1/users/me":
|
||||
delete:
|
||||
summary: Delete account
|
||||
tags:
|
||||
- Users
|
||||
description: Permanently deactivates the current user account and all associated
|
||||
data. This action cannot be undone.
|
||||
security:
|
||||
- apiKeyAuth: []
|
||||
responses:
|
||||
'200':
|
||||
description: account deleted
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/SuccessMessage"
|
||||
'401':
|
||||
description: unauthorized
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
'403':
|
||||
description: insufficient scope
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
'422':
|
||||
description: deactivation failed
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
|
||||
Reference in New Issue
Block a user