feat: Add user registration endpoint with JWT token generation and update API documentation

This commit is contained in:
2025-03-10 22:44:16 +00:00
parent 9f8eab0fac
commit 460235b832
5 changed files with 256 additions and 0 deletions
+82
View File
@@ -729,6 +729,88 @@ const docTemplate = `{
}
}
},
"/auth/register": {
"post": {
"description": "Register a new user and get a JWT token",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Register",
"parameters": [
{
"description": "User data",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.UserCreateDto"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/dto.TokenDto"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.Response"
},
{
"type": "object",
"properties": {
"error": {
"$ref": "#/definitions/utils.ErrorInfo"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.Response"
},
{
"type": "object",
"properties": {
"error": {
"$ref": "#/definitions/utils.ErrorInfo"
}
}
}
]
}
}
}
}
},
"/companies": {
"get": {
"security": [
+82
View File
@@ -723,6 +723,88 @@
}
}
},
"/auth/register": {
"post": {
"description": "Register a new user and get a JWT token",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Register",
"parameters": [
{
"description": "User data",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.UserCreateDto"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/dto.TokenDto"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.Response"
},
{
"type": "object",
"properties": {
"error": {
"$ref": "#/definitions/utils.ErrorInfo"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.Response"
},
{
"type": "object",
"properties": {
"error": {
"$ref": "#/definitions/utils.ErrorInfo"
}
}
}
]
}
}
}
}
},
"/companies": {
"get": {
"security": [
+45
View File
@@ -686,6 +686,51 @@ paths:
summary: Get current user
tags:
- auth
/auth/register:
post:
consumes:
- application/json
description: Register a new user and get a JWT token
parameters:
- description: User data
in: body
name: user
required: true
schema:
$ref: '#/definitions/dto.UserCreateDto'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/utils.Response'
- properties:
data:
$ref: '#/definitions/dto.TokenDto'
type: object
"400":
description: Bad Request
schema:
allOf:
- $ref: '#/definitions/utils.Response'
- properties:
error:
$ref: '#/definitions/utils.ErrorInfo'
type: object
"500":
description: Internal Server Error
schema:
allOf:
- $ref: '#/definitions/utils.Response'
- properties:
error:
$ref: '#/definitions/utils.ErrorInfo'
type: object
summary: Register
tags:
- auth
/companies:
get:
consumes: