wms-be/docs/swagger.yaml

463 lines
10 KiB
YAML

basePath: /api/v1
definitions:
dto.SendVerificationEmailRequest:
properties:
email:
type: string
required:
- email
type: object
dto.UserCreateRequest:
properties:
address:
type: string
client_id:
type: string
email:
type: string
gender:
maxLength: 10
type: string
location_id:
type: string
maintenance_group_user_id:
type: string
name:
maxLength: 100
minLength: 2
type: string
password:
minLength: 8
type: string
phone:
maxLength: 20
minLength: 8
type: string
photo_url:
type: string
username:
maxLength: 100
minLength: 2
type: string
required:
- client_id
- email
- name
- password
- username
type: object
dto.UserLoginRequest:
properties:
email:
type: string
password:
type: string
required:
- email
- password
type: object
dto.UserResponse:
properties:
address:
type: string
email:
type: string
gender:
type: string
id:
type: string
name:
type: string
password:
type: string
phone:
type: string
photo_url:
type: string
roles:
items:
$ref: '#/definitions/dto.UserRolesResponse'
type: array
username:
type: string
type: object
dto.UserRolesResponse:
properties:
id:
type: string
name:
type: string
type: object
dto.UserUpdateRequest:
properties:
address:
type: string
client_id:
type: string
email:
type: string
gender:
maxLength: 10
type: string
location_id:
type: string
maintenance_group_user_id:
type: string
name:
maxLength: 100
minLength: 2
type: string
password:
minLength: 8
type: string
phone:
maxLength: 20
minLength: 8
type: string
photo_url:
type: string
username:
maxLength: 100
minLength: 2
type: string
type: object
dto.VerifyEmailRequest:
properties:
token:
type: string
required:
- token
type: object
externalDocs:
description: OpenAPI
url: https://swagger.io/resources/open-api/
host: localhost:8888
info:
contact:
email: support@swagger.io
name: API Support
url: http://www.swagger.io/support
description: This is a sample server celler server.
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
termsOfService: http://swagger.io/terms/
title: WMS Wareify API Docs
version: "1.0"
paths:
/auth/login:
post:
consumes:
- application/json
description: Authenticate user and return access & refresh tokens.
parameters:
- description: Login payload
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.UserLoginRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"400":
description: Bad Request
schema:
additionalProperties: true
type: object
summary: User login
tags:
- Auth
/auth/refresh:
post:
consumes:
- application/json
description: Exchange a refresh token for a new access token (and optionally
a new refresh token).
parameters:
- description: Refresh token payload
in: body
name: request
required: true
schema:
type: object
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"400":
description: Bad Request
schema:
additionalProperties: true
type: object
"401":
description: Unauthorized
schema:
additionalProperties: true
type: object
summary: Refresh auth token
tags:
- Auth
/example/helloworld:
get:
consumes:
- application/json
description: do ping
produces:
- application/json
responses:
"200":
description: OK
schema:
type: string
summary: ping example
tags:
- example
/users:
delete:
consumes:
- application/json
description: Delete the authenticated user's account (soft/hard depends on implementation).
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"400":
description: Bad Request
schema:
additionalProperties: true
type: object
security:
- ApiKeyAuth: []
summary: Delete current user
tags:
- Users
get:
consumes:
- application/json
description: Get paginated list of users for the current client. Supports filtering
by name and including related roles.
parameters:
- description: Filter by name (partial match)
in: query
name: name
type: string
- description: 'Page number (default: 1)'
in: query
name: page
type: integer
- description: 'Page size (default: 10)'
in: query
name: page_size
type: integer
- description: Sort expression, e.g. created_at desc
in: query
name: sort
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/dto.UserResponse'
type: array
"400":
description: Bad Request
schema:
additionalProperties: true
type: object
security:
- ApiKeyAuth: []
summary: Get list of users
tags:
- Users
put:
consumes:
- application/json
description: Update profile of the authenticated user. Use multipart/form-data
if uploading files (photo).
parameters:
- description: Update payload
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.UserUpdateRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.UserResponse'
"400":
description: Bad Request
schema:
additionalProperties: true
type: object
security:
- ApiKeyAuth: []
summary: Update current user
tags:
- Users
/users/{id}:
get:
consumes:
- application/json
description: Get details of a user by their ID. Requires appropriate permissions.
parameters:
- description: User ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.UserResponse'
"400":
description: Bad Request
schema:
additionalProperties: true
type: object
security:
- ApiKeyAuth: []
summary: Get user by ID
tags:
- Users
/users/me:
get:
consumes:
- application/json
description: Return the authenticated user's profile.
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.UserResponse'
"400":
description: Bad Request
schema:
additionalProperties: true
type: object
security:
- ApiKeyAuth: []
summary: Get current user
tags:
- Users
/users/register:
post:
consumes:
- application/json
description: Create a new user under the authenticated client. Validates input
and returns created user.
parameters:
- description: Register payload
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.UserCreateRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.UserResponse'
"400":
description: Bad Request
schema:
additionalProperties: true
type: object
"500":
description: Internal Server Error
schema:
additionalProperties: true
type: object
summary: Register a new user
tags:
- Users
/users/send-verification-email:
post:
consumes:
- application/json
description: Send email with verification code/link to a user's email address.
parameters:
- description: Email request payload
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.SendVerificationEmailRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"400":
description: Bad Request
schema:
additionalProperties: true
type: object
summary: Send verification email
tags:
- Users
/users/verify-email:
post:
consumes:
- application/json
description: Verify a user's email using code or token sent via email.
parameters:
- description: Verify email payload
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.VerifyEmailRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.UserResponse'
"400":
description: Bad Request
schema:
additionalProperties: true
type: object
summary: Verify user email
tags:
- Users
securityDefinitions:
BearerAuth:
description: Bearer token for authentication
in: header
name: Authorization
type: apiKey
swagger: "2.0"