feat: add shelve management functionality

This commit is contained in:
Tran Anh Tuan
2026-05-08 18:17:07 +07:00
parent 8562d39071
commit 9f27436d5d
14 changed files with 2682 additions and 1074 deletions

View File

@@ -30,6 +30,23 @@ definitions:
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:
@@ -85,6 +102,21 @@ definitions:
- 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:
@@ -111,6 +143,15 @@ definitions:
name:
type: string
type: object
requests.UpdateShelveRequest:
properties:
description:
type: string
levelIndex:
type: integer
name:
type: string
type: object
requests.UpdateWarehouseRequest:
properties:
address:
@@ -157,6 +198,11 @@ definitions:
id:
type: integer
type: object
responses.CreateShelveResponse:
properties:
id:
type: integer
type: object
responses.CreateWarehouseResponse:
properties:
id:
@@ -184,6 +230,19 @@ definitions:
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:
@@ -598,6 +657,176 @@ paths:
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: