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

@@ -372,6 +372,279 @@
}
}
},
"/v1/containers": {
"get": {
"description": "Retrieve a list of all containers ordered by creation date",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"container"
],
"summary": "List all containers",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Container"
}
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
},
"post": {
"description": "Create a new container with the provided details",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"container"
],
"summary": "Create a new container",
"parameters": [
{
"description": "Container request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/requests.CreateContainerRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.CreateContainerResponse"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
}
},
"/v1/containers/{id}": {
"get": {
"description": "Retrieve a single container using its unique identifier",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"container"
],
"summary": "Get container by ID",
"parameters": [
{
"type": "integer",
"description": "Container ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.Container"
}
}
}
]
}
},
"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"
}
}
}
},
"put": {
"description": "Update an existing container by its ID. Only non-empty fields will be updated.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"container"
],
"summary": "Update container",
"parameters": [
{
"type": "integer",
"description": "Container ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Container request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/requests.UpdateContainerRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.UpdateContainerResponse"
}
}
}
]
}
},
"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"
}
}
}
},
"delete": {
"description": "Delete a container by its unique identifier",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"container"
],
"summary": "Delete container",
"parameters": [
{
"type": "integer",
"description": "Container ID",
"name": "id",
"in": "path",
"required": true
}
],
"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"
}
}
}
}
},
"/v1/rooms": {
"get": {
"description": "Retrieve a list of all rooms ordered by creation date",
@@ -1210,6 +1483,41 @@
}
}
},
"models.Container": {
"type": "object",
"properties": {
"containerType": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"maxCapacity": {
"type": "integer"
},
"metadata": {
"type": "array",
"items": {
"type": "integer"
}
},
"name": {
"type": "string"
},
"shelfId": {
"type": "integer"
},
"updatedAt": {
"type": "string"
}
}
},
"models.Room": {
"type": "object",
"properties": {
@@ -1323,6 +1631,37 @@
}
}
},
"requests.CreateContainerRequest": {
"type": "object",
"required": [
"containerType",
"name",
"shelfId"
],
"properties": {
"containerType": {
"type": "string"
},
"description": {
"type": "string"
},
"maxCapacity": {
"type": "integer"
},
"metadata": {
"type": "array",
"items": {
"type": "integer"
}
},
"name": {
"type": "string"
},
"shelfId": {
"type": "integer"
}
}
},
"requests.CreateRoomRequest": {
"type": "object",
"required": [
@@ -1392,6 +1731,29 @@
}
}
},
"requests.UpdateContainerRequest": {
"type": "object",
"properties": {
"containerType": {
"type": "string"
},
"description": {
"type": "string"
},
"maxCapacity": {
"type": "integer"
},
"metadata": {
"type": "array",
"items": {
"type": "integer"
}
},
"name": {
"type": "string"
}
}
},
"requests.UpdateRoomRequest": {
"type": "object",
"properties": {
@@ -1480,6 +1842,14 @@
}
}
},
"responses.CreateContainerResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer"
}
}
},
"responses.CreateRoomResponse": {
"type": "object",
"properties": {
@@ -1521,6 +1891,35 @@
}
}
},
"responses.UpdateContainerResponse": {
"type": "object",
"properties": {
"containerType": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"maxCapacity": {
"type": "integer"
},
"metadata": {
"type": "array",
"items": {
"type": "integer"
}
},
"name": {
"type": "string"
},
"shelfId": {
"type": "integer"
}
}
},
"responses.UpdateRoomResponse": {
"type": "object",
"properties": {