Add forgot-password SMS reset, client/staff user lists, and regenerate Swagger.

Fold follow-up migrations into init, expose GET /users/clients and /users/staff, and refresh seed data.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-14 16:42:47 +05:00
parent 5e3c46da83
commit 514b9ca5fc
24 changed files with 1477 additions and 473 deletions

View File

@@ -19,14 +19,22 @@ definitions:
status:
type: boolean
type: object
auth.ForgotPasswordDTO:
properties:
name:
type: string
required:
- name
type: object
auth.LoginDTO:
properties:
email:
name:
type: string
password:
type: string
phone:
type: string
required:
- email
- password
type: object
auth.RefreshTokenDTO:
@@ -57,6 +65,23 @@ definitions:
- phone
- username
type: object
auth.ResetPasswordDTO:
properties:
code:
type: string
name:
type: string
password:
minLength: 6
type: string
passwordConfirm:
type: string
required:
- code
- name
- password
- passwordConfirm
type: object
auth.UpdateProfileDTO:
properties:
avatar:
@@ -2313,6 +2338,66 @@ paths:
- BearerAuth: []
tags:
- file-upload
/forgot-password:
post:
consumes:
- application/json
description: Finds the user by name and sends an SMS verification code
parameters:
- description: Forgot password payload
in: body
name: body
required: true
schema:
$ref: '#/definitions/auth.ForgotPasswordDTO'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/appresult.AppSuccess'
"400":
description: Bad Request
schema:
$ref: '#/definitions/appresult.AppError'
"404":
description: Not Found
schema:
$ref: '#/definitions/appresult.AppError'
summary: Forgot password
tags:
- auth
/forgot-password/verify:
post:
consumes:
- application/json
description: Confirms the SMS code and sets a new password
parameters:
- description: Reset password payload
in: body
name: body
required: true
schema:
$ref: '#/definitions/auth.ResetPasswordDTO'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/appresult.AppSuccess'
"400":
description: Bad Request
schema:
$ref: '#/definitions/appresult.AppError'
"404":
description: Not Found
schema:
$ref: '#/definitions/appresult.AppError'
summary: Reset password
tags:
- auth
/loan-orders:
get:
description: Returns paginated loan orders with optional filters
@@ -3295,7 +3380,7 @@ paths:
post:
consumes:
- application/json
description: Authenticates a user by email and password
description: Authenticates a user by name or phone, and password
parameters:
- description: Login payload
in: body
@@ -4585,7 +4670,7 @@ paths:
- auth
/users:
get:
description: Returns paginated users with optional filters
description: Returns paginated users with role user, with optional filters
parameters:
- description: Filter by username
in: query
@@ -4757,15 +4842,10 @@ paths:
summary: Update user
tags:
- user
/users/role:
/users/clients:
get:
description: Returns paginated users filtered by role
description: Returns paginated users from the users table with role user
parameters:
- description: user role
in: query
name: role
required: true
type: string
- description: Filter by username
in: query
name: username
@@ -4791,8 +4871,43 @@ paths:
description: Bad Request
schema:
$ref: '#/definitions/appresult.AppError'
"404":
description: Not Found
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/appresult.AppError'
security:
- BearerAuth: []
summary: List client users
tags:
- user
/users/staff:
get:
description: Returns paginated users assigned to branches (from branch_user),
including each user's branches.
parameters:
- description: Filter by username
in: query
name: username
type: string
- default: 1
description: Page number
in: query
name: page
type: integer
- default: 10
description: Items per page
in: query
name: limit
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/appresult.AppSuccess'
"400":
description: Bad Request
schema:
$ref: '#/definitions/appresult.AppError'
"500":
@@ -4801,7 +4916,7 @@ paths:
$ref: '#/definitions/appresult.AppError'
security:
- BearerAuth: []
summary: List users by role
summary: List staff users
tags:
- user
securityDefinitions: