Add phone registration with SMS verification and regenerate Swagger docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-13 14:43:33 +05:00
parent 704606b3f5
commit 5e3c46da83
17 changed files with 1008 additions and 20 deletions

View File

@@ -4658,6 +4658,98 @@ const docTemplate = `{
}
}
},
"/register": {
"post": {
"description": "Starts registration and sends an SMS verification code. Replace sms.LogSender with your SMS client.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Register",
"parameters": [
{
"description": "Registration payload",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/auth.RegisterDTO"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/appresult.AppSuccess"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
}
}
}
},
"/register/verify": {
"post": {
"description": "Confirms the SMS code and creates the user account",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Verify phone",
"parameters": [
{
"description": "Verification payload",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/auth.VerifyDTO"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/appresult.AppSuccess"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
}
}
}
},
"/role-users": {
"get": {
"security": [
@@ -5523,6 +5615,35 @@ const docTemplate = `{
}
}
},
"auth.RegisterDTO": {
"type": "object",
"required": [
"name",
"password",
"passwordConfirm",
"phone",
"username"
],
"properties": {
"name": {
"type": "string"
},
"password": {
"type": "string",
"minLength": 6
},
"passwordConfirm": {
"type": "string"
},
"phone": {
"type": "string"
},
"username": {
"type": "string",
"minLength": 3
}
}
},
"auth.UpdateProfileDTO": {
"type": "object",
"required": [
@@ -5546,6 +5667,21 @@ const docTemplate = `{
}
}
},
"auth.VerifyDTO": {
"type": "object",
"required": [
"code",
"phone"
],
"properties": {
"code": {
"type": "string"
},
"phone": {
"type": "string"
}
}
},
"branches.CreateBranchDTO": {
"type": "object",
"required": [

View File

@@ -4652,6 +4652,98 @@
}
}
},
"/register": {
"post": {
"description": "Starts registration and sends an SMS verification code. Replace sms.LogSender with your SMS client.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Register",
"parameters": [
{
"description": "Registration payload",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/auth.RegisterDTO"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/appresult.AppSuccess"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
}
}
}
},
"/register/verify": {
"post": {
"description": "Confirms the SMS code and creates the user account",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Verify phone",
"parameters": [
{
"description": "Verification payload",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/auth.VerifyDTO"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/appresult.AppSuccess"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
}
}
}
},
"/role-users": {
"get": {
"security": [
@@ -5517,6 +5609,35 @@
}
}
},
"auth.RegisterDTO": {
"type": "object",
"required": [
"name",
"password",
"passwordConfirm",
"phone",
"username"
],
"properties": {
"name": {
"type": "string"
},
"password": {
"type": "string",
"minLength": 6
},
"passwordConfirm": {
"type": "string"
},
"phone": {
"type": "string"
},
"username": {
"type": "string",
"minLength": 3
}
}
},
"auth.UpdateProfileDTO": {
"type": "object",
"required": [
@@ -5540,6 +5661,21 @@
}
}
},
"auth.VerifyDTO": {
"type": "object",
"required": [
"code",
"phone"
],
"properties": {
"code": {
"type": "string"
},
"phone": {
"type": "string"
}
}
},
"branches.CreateBranchDTO": {
"type": "object",
"required": [

View File

@@ -36,6 +36,27 @@ definitions:
required:
- refreshToken
type: object
auth.RegisterDTO:
properties:
name:
type: string
password:
minLength: 6
type: string
passwordConfirm:
type: string
phone:
type: string
username:
minLength: 3
type: string
required:
- name
- password
- passwordConfirm
- phone
- username
type: object
auth.UpdateProfileDTO:
properties:
avatar:
@@ -51,6 +72,16 @@ definitions:
required:
- name
type: object
auth.VerifyDTO:
properties:
code:
type: string
phone:
type: string
required:
- code
- phone
type: object
branches.CreateBranchDTO:
properties:
active:
@@ -4194,6 +4225,67 @@ paths:
summary: Update reason card
tags:
- reason-card
/register:
post:
consumes:
- application/json
description: Starts registration and sends an SMS verification code. Replace
sms.LogSender with your SMS client.
parameters:
- description: Registration payload
in: body
name: body
required: true
schema:
$ref: '#/definitions/auth.RegisterDTO'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/appresult.AppSuccess'
"400":
description: Bad Request
schema:
$ref: '#/definitions/appresult.AppError'
"409":
description: Conflict
schema:
$ref: '#/definitions/appresult.AppError'
summary: Register
tags:
- auth
/register/verify:
post:
consumes:
- application/json
description: Confirms the SMS code and creates the user account
parameters:
- description: Verification payload
in: body
name: body
required: true
schema:
$ref: '#/definitions/auth.VerifyDTO'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/appresult.AppSuccess'
"400":
description: Bad Request
schema:
$ref: '#/definitions/appresult.AppError'
"409":
description: Conflict
schema:
$ref: '#/definitions/appresult.AppError'
summary: Verify phone
tags:
- auth
/role-users:
get:
description: Returns the authenticated user's role-user assignments with the