Files
2026-05-08 18:17:07 +07:00

996 lines
25 KiB
YAML

basePath: /api/v1
definitions:
models.Cabinet:
properties:
createdAt:
type: string
description:
type: string
id:
type: integer
name:
type: string
roomId:
type: integer
updatedAt:
type: string
type: object
models.Room:
properties:
createdAt:
type: string
description:
type: string
id:
type: integer
name:
type: string
updatedAt:
type: string
warehouseId:
type: integer
type: object
models.Shelve:
properties:
cabinetId:
type: integer
createdAt:
type: string
description:
type: string
id:
type: integer
levelIndex:
type: integer
name:
type: string
updatedAt:
type: string
type: object
models.Warehouse:
properties:
address:
type: string
createdAt:
type: string
description:
type: string
id:
type: integer
name:
type: string
updatedAt:
type: string
type: object
requests.BodyRegisterRequest:
properties:
email:
type: string
fullName:
type: string
password:
minLength: 8
type: string
username:
type: string
required:
- email
- password
- username
type: object
requests.CreateCabinetRequest:
properties:
description:
type: string
name:
type: string
roomId:
type: integer
required:
- name
- roomId
type: object
requests.CreateRoomRequest:
properties:
description:
type: string
name:
type: string
warehouseId:
type: integer
required:
- name
- warehouseId
type: object
requests.CreateShelveRequest:
properties:
cabinetId:
type: integer
description:
type: string
levelIndex:
type: integer
name:
type: string
required:
- cabinetId
- levelIndex
- name
type: object
requests.CreateWarehouseRequest:
properties:
address:
type: string
description:
type: string
name:
type: string
required:
- address
- name
type: object
requests.UpdateCabinetRequest:
properties:
description:
type: string
name:
type: string
type: object
requests.UpdateRoomRequest:
properties:
description:
type: string
name:
type: string
type: object
requests.UpdateShelveRequest:
properties:
description:
type: string
levelIndex:
type: integer
name:
type: string
type: object
requests.UpdateWarehouseRequest:
properties:
address:
type: string
description:
type: string
name:
type: string
type: object
response.ErrorResponse:
properties:
code:
type: integer
message:
type: string
now:
type: integer
status:
type: integer
type: object
response.SuccessResponse:
properties:
data: {}
message:
type: string
option: {}
reason_status_code:
type: string
status:
type: integer
type: object
responses.BodyRegisterResponse:
properties:
id:
type: string
type: object
responses.CreateCabinetResponse:
properties:
id:
type: integer
type: object
responses.CreateRoomResponse:
properties:
id:
type: integer
type: object
responses.CreateShelveResponse:
properties:
id:
type: integer
type: object
responses.CreateWarehouseResponse:
properties:
id:
type: integer
type: object
responses.UpdateCabinetResponse:
properties:
description:
type: string
id:
type: integer
name:
type: string
roomId:
type: integer
type: object
responses.UpdateRoomResponse:
properties:
description:
type: string
id:
type: integer
name:
type: string
warehouseId:
type: integer
type: object
responses.UpdateShelveResponse:
properties:
cabinetId:
type: integer
description:
type: string
id:
type: integer
levelIndex:
type: integer
name:
type: string
type: object
responses.UpdateWarehouseResponse:
properties:
address:
type: string
description:
type: string
id:
type: integer
name:
type: string
type: object
host: localhost:3000
info:
contact: {}
description: This is the Warehouse Management API server.
title: Warehouse Management API
version: "1.0"
paths:
/auth/register:
post:
consumes:
- application/json
description: Register with email, username and password
parameters:
- description: Register request
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.BodyRegisterRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.BodyRegisterResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ErrorResponse'
"409":
description: Conflict
schema:
$ref: '#/definitions/response.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: Register a new user
tags:
- auth
/ping:
get:
consumes:
- application/json
description: Check server is running
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: string
type: object
summary: Health check
tags:
- health
/v1/cabinets:
get:
consumes:
- application/json
description: Retrieve a list of all cabinets ordered by creation date
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
items:
$ref: '#/definitions/models.Cabinet'
type: array
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: List all cabinets
tags:
- cabinet
post:
consumes:
- application/json
description: Create a new cabinet with the provided details
parameters:
- description: Cabinet request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.CreateCabinetRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.CreateCabinetResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: Create a new cabinet
tags:
- cabinet
/v1/cabinets/{id}:
delete:
consumes:
- application/json
description: Delete a cabinet by its unique identifier
parameters:
- description: Cabinet ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/response.SuccessResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: Delete cabinet
tags:
- cabinet
get:
consumes:
- application/json
description: Retrieve a single cabinet using its unique identifier
parameters:
- description: Cabinet ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/models.Cabinet'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: Get cabinet by ID
tags:
- cabinet
put:
consumes:
- application/json
description: Update an existing cabinet by its ID. Only non-empty fields will
be updated.
parameters:
- description: Cabinet ID
in: path
name: id
required: true
type: integer
- description: Cabinet request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.UpdateCabinetRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.UpdateCabinetResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: Update cabinet
tags:
- cabinet
/v1/rooms:
get:
consumes:
- application/json
description: Retrieve a list of all rooms ordered by creation date
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
items:
$ref: '#/definitions/models.Room'
type: array
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: List all rooms
tags:
- room
post:
consumes:
- application/json
description: Create a new room with the provided details
parameters:
- description: Room request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.CreateRoomRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.CreateRoomResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: Create a new room
tags:
- room
/v1/rooms/{id}:
delete:
consumes:
- application/json
description: Delete a room by its unique identifier
parameters:
- description: Room ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/response.SuccessResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: Delete room
tags:
- room
get:
consumes:
- application/json
description: Retrieve a single room using its unique identifier
parameters:
- description: Room ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/models.Room'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: Get room by ID
tags:
- room
put:
consumes:
- application/json
description: Update an existing room by its ID. Only non-empty fields will be
updated.
parameters:
- description: Room ID
in: path
name: id
required: true
type: integer
- description: Room request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.UpdateRoomRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.UpdateRoomResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: Update room
tags:
- room
/v1/shelves:
get:
consumes:
- application/json
description: Retrieve a list of all shelves ordered by creation date
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
items:
$ref: '#/definitions/models.Shelve'
type: array
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: List all shelves
tags:
- shelve
post:
consumes:
- application/json
description: Create a new shelve with the provided details
parameters:
- description: Shelve request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.CreateShelveRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.CreateShelveResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: Create a new shelve
tags:
- shelve
/v1/shelves/{id}:
delete:
consumes:
- application/json
description: Delete a shelve by its unique identifier
parameters:
- description: Shelve ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/response.SuccessResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: Delete shelve
tags:
- shelve
get:
consumes:
- application/json
description: Retrieve a single shelve using its unique identifier
parameters:
- description: Shelve ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/models.Shelve'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: Get shelve by ID
tags:
- shelve
put:
consumes:
- application/json
description: Update an existing shelve by its ID. Only non-empty fields will
be updated.
parameters:
- description: Shelve ID
in: path
name: id
required: true
type: integer
- description: Shelve request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.UpdateShelveRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.UpdateShelveResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: Update shelve
tags:
- shelve
/v1/warehouses:
get:
consumes:
- application/json
description: Retrieve a list of all warehouses ordered by creation date
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
items:
$ref: '#/definitions/models.Warehouse'
type: array
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: List all warehouses
tags:
- warehouse
post:
consumes:
- application/json
description: Create a new warehouse with the provided details
parameters:
- description: Warehouse request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.CreateWarehouseRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.CreateWarehouseResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: Create a new warehouse
tags:
- warehouse
/v1/warehouses/{id}:
delete:
consumes:
- application/json
description: Delete a warehouse by its unique identifier
parameters:
- description: Warehouse ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/response.SuccessResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: Delete warehouse
tags:
- warehouse
get:
consumes:
- application/json
description: Retrieve a single warehouse using its unique identifier
parameters:
- description: Warehouse ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/models.Warehouse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: Get warehouse by ID
tags:
- warehouse
put:
consumes:
- application/json
description: Update an existing warehouse by its ID with the provided details
parameters:
- description: Warehouse ID
in: path
name: id
required: true
type: integer
- description: Warehouse request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.UpdateWarehouseRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.UpdateWarehouseResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: Update warehouse
tags:
- warehouse
swagger: "2.0"