feat: add container management functionality

This commit is contained in:
Tran Anh Tuan
2026-05-11 09:42:19 +07:00
parent 9f27436d5d
commit 7c9a0d4670
15 changed files with 1654 additions and 1 deletions

View File

@@ -15,6 +15,29 @@ definitions:
updatedAt:
type: string
type: object
models.Container:
properties:
containerType:
type: string
createdAt:
type: string
description:
type: string
id:
type: integer
maxCapacity:
type: integer
metadata:
items:
type: integer
type: array
name:
type: string
shelfId:
type: integer
updatedAt:
type: string
type: object
models.Room:
properties:
createdAt:
@@ -90,6 +113,27 @@ definitions:
- name
- roomId
type: object
requests.CreateContainerRequest:
properties:
containerType:
type: string
description:
type: string
maxCapacity:
type: integer
metadata:
items:
type: integer
type: array
name:
type: string
shelfId:
type: integer
required:
- containerType
- name
- shelfId
type: object
requests.CreateRoomRequest:
properties:
description:
@@ -136,6 +180,21 @@ definitions:
name:
type: string
type: object
requests.UpdateContainerRequest:
properties:
containerType:
type: string
description:
type: string
maxCapacity:
type: integer
metadata:
items:
type: integer
type: array
name:
type: string
type: object
requests.UpdateRoomRequest:
properties:
description:
@@ -193,6 +252,11 @@ definitions:
id:
type: integer
type: object
responses.CreateContainerResponse:
properties:
id:
type: integer
type: object
responses.CreateRoomResponse:
properties:
id:
@@ -219,6 +283,25 @@ definitions:
roomId:
type: integer
type: object
responses.UpdateContainerResponse:
properties:
containerType:
type: string
description:
type: string
id:
type: integer
maxCapacity:
type: integer
metadata:
items:
type: integer
type: array
name:
type: string
shelfId:
type: integer
type: object
responses.UpdateRoomResponse:
properties:
description:
@@ -487,6 +570,176 @@ paths:
summary: Update cabinet
tags:
- cabinet
/v1/containers:
get:
consumes:
- application/json
description: Retrieve a list of all containers ordered by creation date
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
items:
$ref: '#/definitions/models.Container'
type: array
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: List all containers
tags:
- container
post:
consumes:
- application/json
description: Create a new container with the provided details
parameters:
- description: Container request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.CreateContainerRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.CreateContainerResponse'
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 container
tags:
- container
/v1/containers/{id}:
delete:
consumes:
- application/json
description: Delete a container by its unique identifier
parameters:
- description: Container 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 container
tags:
- container
get:
consumes:
- application/json
description: Retrieve a single container using its unique identifier
parameters:
- description: Container 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.Container'
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 container by ID
tags:
- container
put:
consumes:
- application/json
description: Update an existing container by its ID. Only non-empty fields will
be updated.
parameters:
- description: Container ID
in: path
name: id
required: true
type: integer
- description: Container request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.UpdateContainerRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.UpdateContainerResponse'
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 container
tags:
- container
/v1/rooms:
get:
consumes: