feat: add invoice and alternative_componen management functionality

This commit is contained in:
Tran Anh Tuan
2026-05-12 11:57:11 +07:00
parent c39b010e5e
commit e81a248a61
23 changed files with 3325 additions and 2 deletions

View File

@@ -1327,6 +1327,279 @@ const docTemplate = `{
}
}
},
"/v1/alternative-components": {
"get": {
"description": "Retrieve a list of all alternative components",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"alternative-component"
],
"summary": "List all alternative components",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.AlternativeComponent"
}
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
},
"post": {
"description": "Create a new alternative component with the provided details",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"alternative-component"
],
"summary": "Create a new alternative component",
"parameters": [
{
"description": "Alternative component request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/requests.CreateAlternativeComponentRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.CreateAlternativeComponentResponse"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
}
},
"/v1/alternative-components/{id}": {
"get": {
"description": "Retrieve a single alternative component using its unique identifier",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"alternative-component"
],
"summary": "Get alternative component by ID",
"parameters": [
{
"type": "integer",
"description": "Alternative component ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.AlternativeComponent"
}
}
}
]
}
},
"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 alternative component by its ID. Only non-empty fields will be updated.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"alternative-component"
],
"summary": "Update alternative component",
"parameters": [
{
"type": "integer",
"description": "Alternative component ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Alternative component request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/requests.UpdateAlternativeComponentRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.UpdateAlternativeComponentResponse"
}
}
}
]
}
},
"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 an alternative component by its unique identifier",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"alternative-component"
],
"summary": "Delete alternative component",
"parameters": [
{
"type": "integer",
"description": "Alternative component 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/cabinets": {
"get": {
"description": "Retrieve a list of all cabinets ordered by creation date",
@@ -2419,6 +2692,279 @@ const docTemplate = `{
}
}
},
"/v1/invoices": {
"get": {
"description": "Retrieve a list of all invoices ordered by creation date",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice"
],
"summary": "List all invoices",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Invoice"
}
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
},
"post": {
"description": "Create a new invoice with the provided details",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice"
],
"summary": "Create a new invoice",
"parameters": [
{
"description": "Invoice request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/requests.CreateInvoiceRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.CreateInvoiceResponse"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
}
},
"/v1/invoices/{id}": {
"get": {
"description": "Retrieve a single invoice using its unique identifier",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice"
],
"summary": "Get invoice by ID",
"parameters": [
{
"type": "integer",
"description": "Invoice ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.Invoice"
}
}
}
]
}
},
"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 invoice by its ID. Only non-empty fields will be updated.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice"
],
"summary": "Update invoice",
"parameters": [
{
"type": "integer",
"description": "Invoice ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Invoice request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/requests.UpdateInvoiceRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.UpdateInvoiceResponse"
}
}
}
]
}
},
"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 an invoice by its unique identifier",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice"
],
"summary": "Delete invoice",
"parameters": [
{
"type": "integer",
"description": "Invoice 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",
@@ -3234,6 +3780,35 @@ const docTemplate = `{
}
},
"definitions": {
"models.AlternativeComponent": {
"type": "object",
"properties": {
"alternativeComponentId": {
"type": "integer"
},
"conversionRatio": {
"type": "string"
},
"id": {
"type": "integer"
},
"invoiceConfigItemId": {
"type": "integer"
},
"metadata": {
"type": "array",
"items": {
"type": "integer"
}
},
"note": {
"type": "string"
},
"priority": {
"type": "integer"
}
}
},
"models.Cabinet": {
"type": "object",
"properties": {
@@ -3452,6 +4027,53 @@ const docTemplate = `{
}
}
},
"models.Invoice": {
"type": "object",
"properties": {
"approvedBy": {
"type": "string"
},
"completedAt": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"id": {
"type": "integer"
},
"invoiceCode": {
"type": "string"
},
"invoiceConfigId": {
"type": "integer"
},
"metadata": {
"type": "array",
"items": {
"type": "integer"
}
},
"note": {
"type": "string"
},
"status": {
"type": "string"
},
"totalItems": {
"type": "integer"
},
"type": {
"type": "string"
},
"updatedAt": {
"type": "string"
}
}
},
"models.InvoiceConfig": {
"type": "object",
"properties": {
@@ -3611,6 +4233,32 @@ const docTemplate = `{
}
}
},
"requests.CreateAlternativeComponentRequest": {
"type": "object",
"required": [
"alternativeComponentId",
"conversionRatio",
"invoiceConfigItemId",
"priority"
],
"properties": {
"alternativeComponentId": {
"type": "integer"
},
"conversionRatio": {
"type": "string"
},
"invoiceConfigItemId": {
"type": "integer"
},
"note": {
"type": "string"
},
"priority": {
"type": "integer"
}
}
},
"requests.CreateCabinetRequest": {
"type": "object",
"required": [
@@ -3818,6 +4466,36 @@ const docTemplate = `{
}
}
},
"requests.CreateInvoiceRequest": {
"type": "object",
"required": [
"status",
"type"
],
"properties": {
"approvedBy": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"invoiceConfigId": {
"type": "integer"
},
"note": {
"type": "string"
},
"status": {
"type": "string"
},
"totalItems": {
"type": "integer"
},
"type": {
"type": "string"
}
}
},
"requests.CreateRoomRequest": {
"type": "object",
"required": [
@@ -3876,6 +4554,26 @@ const docTemplate = `{
}
}
},
"requests.UpdateAlternativeComponentRequest": {
"type": "object",
"properties": {
"alternativeComponentId": {
"type": "integer"
},
"conversionRatio": {
"type": "string"
},
"invoiceConfigItemId": {
"type": "integer"
},
"note": {
"type": "string"
},
"priority": {
"type": "integer"
}
}
},
"requests.UpdateCabinetRequest": {
"type": "object",
"properties": {
@@ -4051,6 +4749,26 @@ const docTemplate = `{
}
}
},
"requests.UpdateInvoiceRequest": {
"type": "object",
"properties": {
"invoiceConfigId": {
"type": "integer"
},
"note": {
"type": "string"
},
"status": {
"type": "string"
},
"totalItems": {
"type": "integer"
},
"type": {
"type": "string"
}
}
},
"requests.UpdateRoomRequest": {
"type": "object",
"properties": {
@@ -4131,6 +4849,14 @@ const docTemplate = `{
}
}
},
"responses.CreateAlternativeComponentResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer"
}
}
},
"responses.CreateCabinetResponse": {
"type": "object",
"properties": {
@@ -4195,6 +4921,17 @@ const docTemplate = `{
}
}
},
"responses.CreateInvoiceResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"invoiceCode": {
"type": "string"
}
}
},
"responses.CreateRoomResponse": {
"type": "object",
"properties": {
@@ -4219,6 +4956,29 @@ const docTemplate = `{
}
}
},
"responses.UpdateAlternativeComponentResponse": {
"type": "object",
"properties": {
"alternativeComponentId": {
"type": "integer"
},
"conversionRatio": {
"type": "string"
},
"id": {
"type": "integer"
},
"invoiceConfigItemId": {
"type": "integer"
},
"note": {
"type": "string"
},
"priority": {
"type": "integer"
}
}
},
"responses.UpdateCabinetResponse": {
"type": "object",
"properties": {
@@ -4420,6 +5180,32 @@ const docTemplate = `{
}
}
},
"responses.UpdateInvoiceResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"invoiceCode": {
"type": "string"
},
"invoiceConfigId": {
"type": "integer"
},
"note": {
"type": "string"
},
"status": {
"type": "string"
},
"totalItems": {
"type": "integer"
},
"type": {
"type": "string"
}
}
},
"responses.UpdateRoomResponse": {
"type": "object",
"properties": {

View File

@@ -1321,6 +1321,279 @@
}
}
},
"/v1/alternative-components": {
"get": {
"description": "Retrieve a list of all alternative components",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"alternative-component"
],
"summary": "List all alternative components",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.AlternativeComponent"
}
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
},
"post": {
"description": "Create a new alternative component with the provided details",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"alternative-component"
],
"summary": "Create a new alternative component",
"parameters": [
{
"description": "Alternative component request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/requests.CreateAlternativeComponentRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.CreateAlternativeComponentResponse"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
}
},
"/v1/alternative-components/{id}": {
"get": {
"description": "Retrieve a single alternative component using its unique identifier",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"alternative-component"
],
"summary": "Get alternative component by ID",
"parameters": [
{
"type": "integer",
"description": "Alternative component ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.AlternativeComponent"
}
}
}
]
}
},
"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 alternative component by its ID. Only non-empty fields will be updated.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"alternative-component"
],
"summary": "Update alternative component",
"parameters": [
{
"type": "integer",
"description": "Alternative component ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Alternative component request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/requests.UpdateAlternativeComponentRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.UpdateAlternativeComponentResponse"
}
}
}
]
}
},
"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 an alternative component by its unique identifier",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"alternative-component"
],
"summary": "Delete alternative component",
"parameters": [
{
"type": "integer",
"description": "Alternative component 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/cabinets": {
"get": {
"description": "Retrieve a list of all cabinets ordered by creation date",
@@ -2413,6 +2686,279 @@
}
}
},
"/v1/invoices": {
"get": {
"description": "Retrieve a list of all invoices ordered by creation date",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice"
],
"summary": "List all invoices",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Invoice"
}
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
},
"post": {
"description": "Create a new invoice with the provided details",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice"
],
"summary": "Create a new invoice",
"parameters": [
{
"description": "Invoice request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/requests.CreateInvoiceRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.CreateInvoiceResponse"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
}
},
"/v1/invoices/{id}": {
"get": {
"description": "Retrieve a single invoice using its unique identifier",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice"
],
"summary": "Get invoice by ID",
"parameters": [
{
"type": "integer",
"description": "Invoice ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.Invoice"
}
}
}
]
}
},
"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 invoice by its ID. Only non-empty fields will be updated.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice"
],
"summary": "Update invoice",
"parameters": [
{
"type": "integer",
"description": "Invoice ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Invoice request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/requests.UpdateInvoiceRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.UpdateInvoiceResponse"
}
}
}
]
}
},
"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 an invoice by its unique identifier",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice"
],
"summary": "Delete invoice",
"parameters": [
{
"type": "integer",
"description": "Invoice 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",
@@ -3228,6 +3774,35 @@
}
},
"definitions": {
"models.AlternativeComponent": {
"type": "object",
"properties": {
"alternativeComponentId": {
"type": "integer"
},
"conversionRatio": {
"type": "string"
},
"id": {
"type": "integer"
},
"invoiceConfigItemId": {
"type": "integer"
},
"metadata": {
"type": "array",
"items": {
"type": "integer"
}
},
"note": {
"type": "string"
},
"priority": {
"type": "integer"
}
}
},
"models.Cabinet": {
"type": "object",
"properties": {
@@ -3446,6 +4021,53 @@
}
}
},
"models.Invoice": {
"type": "object",
"properties": {
"approvedBy": {
"type": "string"
},
"completedAt": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"id": {
"type": "integer"
},
"invoiceCode": {
"type": "string"
},
"invoiceConfigId": {
"type": "integer"
},
"metadata": {
"type": "array",
"items": {
"type": "integer"
}
},
"note": {
"type": "string"
},
"status": {
"type": "string"
},
"totalItems": {
"type": "integer"
},
"type": {
"type": "string"
},
"updatedAt": {
"type": "string"
}
}
},
"models.InvoiceConfig": {
"type": "object",
"properties": {
@@ -3605,6 +4227,32 @@
}
}
},
"requests.CreateAlternativeComponentRequest": {
"type": "object",
"required": [
"alternativeComponentId",
"conversionRatio",
"invoiceConfigItemId",
"priority"
],
"properties": {
"alternativeComponentId": {
"type": "integer"
},
"conversionRatio": {
"type": "string"
},
"invoiceConfigItemId": {
"type": "integer"
},
"note": {
"type": "string"
},
"priority": {
"type": "integer"
}
}
},
"requests.CreateCabinetRequest": {
"type": "object",
"required": [
@@ -3812,6 +4460,36 @@
}
}
},
"requests.CreateInvoiceRequest": {
"type": "object",
"required": [
"status",
"type"
],
"properties": {
"approvedBy": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"invoiceConfigId": {
"type": "integer"
},
"note": {
"type": "string"
},
"status": {
"type": "string"
},
"totalItems": {
"type": "integer"
},
"type": {
"type": "string"
}
}
},
"requests.CreateRoomRequest": {
"type": "object",
"required": [
@@ -3870,6 +4548,26 @@
}
}
},
"requests.UpdateAlternativeComponentRequest": {
"type": "object",
"properties": {
"alternativeComponentId": {
"type": "integer"
},
"conversionRatio": {
"type": "string"
},
"invoiceConfigItemId": {
"type": "integer"
},
"note": {
"type": "string"
},
"priority": {
"type": "integer"
}
}
},
"requests.UpdateCabinetRequest": {
"type": "object",
"properties": {
@@ -4045,6 +4743,26 @@
}
}
},
"requests.UpdateInvoiceRequest": {
"type": "object",
"properties": {
"invoiceConfigId": {
"type": "integer"
},
"note": {
"type": "string"
},
"status": {
"type": "string"
},
"totalItems": {
"type": "integer"
},
"type": {
"type": "string"
}
}
},
"requests.UpdateRoomRequest": {
"type": "object",
"properties": {
@@ -4125,6 +4843,14 @@
}
}
},
"responses.CreateAlternativeComponentResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer"
}
}
},
"responses.CreateCabinetResponse": {
"type": "object",
"properties": {
@@ -4189,6 +4915,17 @@
}
}
},
"responses.CreateInvoiceResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"invoiceCode": {
"type": "string"
}
}
},
"responses.CreateRoomResponse": {
"type": "object",
"properties": {
@@ -4213,6 +4950,29 @@
}
}
},
"responses.UpdateAlternativeComponentResponse": {
"type": "object",
"properties": {
"alternativeComponentId": {
"type": "integer"
},
"conversionRatio": {
"type": "string"
},
"id": {
"type": "integer"
},
"invoiceConfigItemId": {
"type": "integer"
},
"note": {
"type": "string"
},
"priority": {
"type": "integer"
}
}
},
"responses.UpdateCabinetResponse": {
"type": "object",
"properties": {
@@ -4414,6 +5174,32 @@
}
}
},
"responses.UpdateInvoiceResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"invoiceCode": {
"type": "string"
},
"invoiceConfigId": {
"type": "integer"
},
"note": {
"type": "string"
},
"status": {
"type": "string"
},
"totalItems": {
"type": "integer"
},
"type": {
"type": "string"
}
}
},
"responses.UpdateRoomResponse": {
"type": "object",
"properties": {

View File

@@ -1,5 +1,24 @@
basePath: /api/v1
definitions:
models.AlternativeComponent:
properties:
alternativeComponentId:
type: integer
conversionRatio:
type: string
id:
type: integer
invoiceConfigItemId:
type: integer
metadata:
items:
type: integer
type: array
note:
type: string
priority:
type: integer
type: object
models.Cabinet:
properties:
createdAt:
@@ -143,6 +162,37 @@ definitions:
warehouseName:
type: string
type: object
models.Invoice:
properties:
approvedBy:
type: string
completedAt:
type: string
createdAt:
type: string
createdBy:
type: string
id:
type: integer
invoiceCode:
type: string
invoiceConfigId:
type: integer
metadata:
items:
type: integer
type: array
note:
type: string
status:
type: string
totalItems:
type: integer
type:
type: string
updatedAt:
type: string
type: object
models.InvoiceConfig:
properties:
createdAt:
@@ -248,6 +298,24 @@ definitions:
- password
- username
type: object
requests.CreateAlternativeComponentRequest:
properties:
alternativeComponentId:
type: integer
conversionRatio:
type: string
invoiceConfigItemId:
type: integer
note:
type: string
priority:
type: integer
required:
- alternativeComponentId
- conversionRatio
- invoiceConfigItemId
- priority
type: object
requests.CreateCabinetRequest:
properties:
description:
@@ -388,6 +456,26 @@ definitions:
- name
- type
type: object
requests.CreateInvoiceRequest:
properties:
approvedBy:
type: string
createdBy:
type: string
invoiceConfigId:
type: integer
note:
type: string
status:
type: string
totalItems:
type: integer
type:
type: string
required:
- status
- type
type: object
requests.CreateRoomRequest:
properties:
description:
@@ -427,6 +515,19 @@ definitions:
- address
- name
type: object
requests.UpdateAlternativeComponentRequest:
properties:
alternativeComponentId:
type: integer
conversionRatio:
type: string
invoiceConfigItemId:
type: integer
note:
type: string
priority:
type: integer
type: object
requests.UpdateCabinetRequest:
properties:
description:
@@ -542,6 +643,19 @@ definitions:
type:
type: string
type: object
requests.UpdateInvoiceRequest:
properties:
invoiceConfigId:
type: integer
note:
type: string
status:
type: string
totalItems:
type: integer
type:
type: string
type: object
requests.UpdateRoomRequest:
properties:
description:
@@ -594,6 +708,11 @@ definitions:
id:
type: string
type: object
responses.CreateAlternativeComponentResponse:
properties:
id:
type: integer
type: object
responses.CreateCabinetResponse:
properties:
id:
@@ -634,6 +753,13 @@ definitions:
id:
type: integer
type: object
responses.CreateInvoiceResponse:
properties:
id:
type: integer
invoiceCode:
type: string
type: object
responses.CreateRoomResponse:
properties:
id:
@@ -649,6 +775,21 @@ definitions:
id:
type: integer
type: object
responses.UpdateAlternativeComponentResponse:
properties:
alternativeComponentId:
type: integer
conversionRatio:
type: string
id:
type: integer
invoiceConfigItemId:
type: integer
note:
type: string
priority:
type: integer
type: object
responses.UpdateCabinetResponse:
properties:
description:
@@ -780,6 +921,23 @@ definitions:
type:
type: string
type: object
responses.UpdateInvoiceResponse:
properties:
id:
type: integer
invoiceCode:
type: string
invoiceConfigId:
type: integer
note:
type: string
status:
type: string
totalItems:
type: integer
type:
type: string
type: object
responses.UpdateRoomResponse:
properties:
description:
@@ -1642,6 +1800,176 @@ paths:
summary: Health check
tags:
- health
/v1/alternative-components:
get:
consumes:
- application/json
description: Retrieve a list of all alternative components
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
items:
$ref: '#/definitions/models.AlternativeComponent'
type: array
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: List all alternative components
tags:
- alternative-component
post:
consumes:
- application/json
description: Create a new alternative component with the provided details
parameters:
- description: Alternative component request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.CreateAlternativeComponentRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.CreateAlternativeComponentResponse'
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 alternative component
tags:
- alternative-component
/v1/alternative-components/{id}:
delete:
consumes:
- application/json
description: Delete an alternative component by its unique identifier
parameters:
- description: Alternative component 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 alternative component
tags:
- alternative-component
get:
consumes:
- application/json
description: Retrieve a single alternative component using its unique identifier
parameters:
- description: Alternative component 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.AlternativeComponent'
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 alternative component by ID
tags:
- alternative-component
put:
consumes:
- application/json
description: Update an existing alternative component by its ID. Only non-empty
fields will be updated.
parameters:
- description: Alternative component ID
in: path
name: id
required: true
type: integer
- description: Alternative component request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.UpdateAlternativeComponentRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.UpdateAlternativeComponentResponse'
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 alternative component
tags:
- alternative-component
/v1/cabinets:
get:
consumes:
@@ -2322,6 +2650,176 @@ paths:
summary: Update invoice config
tags:
- invoice-config
/v1/invoices:
get:
consumes:
- application/json
description: Retrieve a list of all invoices ordered by creation date
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
items:
$ref: '#/definitions/models.Invoice'
type: array
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: List all invoices
tags:
- invoice
post:
consumes:
- application/json
description: Create a new invoice with the provided details
parameters:
- description: Invoice request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.CreateInvoiceRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.CreateInvoiceResponse'
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 invoice
tags:
- invoice
/v1/invoices/{id}:
delete:
consumes:
- application/json
description: Delete an invoice by its unique identifier
parameters:
- description: Invoice 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 invoice
tags:
- invoice
get:
consumes:
- application/json
description: Retrieve a single invoice using its unique identifier
parameters:
- description: Invoice 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.Invoice'
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 invoice by ID
tags:
- invoice
put:
consumes:
- application/json
description: Update an existing invoice by its ID. Only non-empty fields will
be updated.
parameters:
- description: Invoice ID
in: path
name: id
required: true
type: integer
- description: Invoice request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.UpdateInvoiceRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.UpdateInvoiceResponse'
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 invoice
tags:
- invoice
/v1/rooms:
get:
consumes: