feat: add invoice-config-items management functionality

This commit is contained in:
Tran Anh Tuan
2026-05-12 09:52:25 +07:00
parent eac8a686d1
commit c39b010e5e
14 changed files with 1571 additions and 0 deletions

View File

@@ -1873,6 +1873,279 @@ const docTemplate = `{
}
}
},
"/v1/invoice-config-items": {
"get": {
"description": "Retrieve a list of all invoice config items",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config-item"
],
"summary": "List all invoice config items",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.InvoiceConfigItem"
}
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
},
"post": {
"description": "Create a new invoice config item with the provided details",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config-item"
],
"summary": "Create a new invoice config item",
"parameters": [
{
"description": "Invoice config item request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/requests.CreateInvoiceConfigItemRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.CreateInvoiceConfigItemResponse"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
}
},
"/v1/invoice-config-items/{id}": {
"get": {
"description": "Retrieve a single invoice config item using its unique identifier",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config-item"
],
"summary": "Get invoice config item by ID",
"parameters": [
{
"type": "integer",
"description": "Invoice config item ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.InvoiceConfigItem"
}
}
}
]
}
},
"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 config item by its ID. Only non-empty fields will be updated.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config-item"
],
"summary": "Update invoice config item",
"parameters": [
{
"type": "integer",
"description": "Invoice config item ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Invoice config item request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/requests.UpdateInvoiceConfigItemRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.UpdateInvoiceConfigItemResponse"
}
}
}
]
}
},
"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 config item by its unique identifier",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config-item"
],
"summary": "Delete invoice config item",
"parameters": [
{
"type": "integer",
"description": "Invoice config item 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/invoice-configs": {
"get": {
"description": "Retrieve a list of all invoice configs ordered by creation date",
@@ -3211,6 +3484,38 @@ const docTemplate = `{
}
}
},
"models.InvoiceConfigItem": {
"type": "object",
"properties": {
"allowAlternative": {
"type": "boolean"
},
"componentId": {
"type": "integer"
},
"id": {
"type": "integer"
},
"invoiceConfigId": {
"type": "integer"
},
"metadata": {
"type": "array",
"items": {
"type": "integer"
}
},
"note": {
"type": "string"
},
"priorityOrder": {
"type": "integer"
},
"requiredQuantity": {
"type": "integer"
}
}
},
"models.Room": {
"type": "object",
"properties": {
@@ -3463,6 +3768,35 @@ const docTemplate = `{
}
}
},
"requests.CreateInvoiceConfigItemRequest": {
"type": "object",
"required": [
"componentId",
"invoiceConfigId",
"priorityOrder",
"requiredQuantity"
],
"properties": {
"allowAlternative": {
"type": "boolean"
},
"componentId": {
"type": "integer"
},
"invoiceConfigId": {
"type": "integer"
},
"note": {
"type": "string"
},
"priorityOrder": {
"type": "integer"
},
"requiredQuantity": {
"type": "integer"
}
}
},
"requests.CreateInvoiceConfigRequest": {
"type": "object",
"required": [
@@ -3683,6 +4017,23 @@ const docTemplate = `{
}
}
},
"requests.UpdateInvoiceConfigItemRequest": {
"type": "object",
"properties": {
"allowAlternative": {
"type": "boolean"
},
"note": {
"type": "string"
},
"priorityOrder": {
"type": "integer"
},
"requiredQuantity": {
"type": "integer"
}
}
},
"requests.UpdateInvoiceConfigRequest": {
"type": "object",
"properties": {
@@ -3828,6 +4179,14 @@ const docTemplate = `{
}
}
},
"responses.CreateInvoiceConfigItemResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer"
}
}
},
"responses.CreateInvoiceConfigResponse": {
"type": "object",
"properties": {
@@ -4015,6 +4374,32 @@ const docTemplate = `{
}
}
},
"responses.UpdateInvoiceConfigItemResponse": {
"type": "object",
"properties": {
"allowAlternative": {
"type": "boolean"
},
"componentId": {
"type": "integer"
},
"id": {
"type": "integer"
},
"invoiceConfigId": {
"type": "integer"
},
"note": {
"type": "string"
},
"priorityOrder": {
"type": "integer"
},
"requiredQuantity": {
"type": "integer"
}
}
},
"responses.UpdateInvoiceConfigResponse": {
"type": "object",
"properties": {

View File

@@ -1867,6 +1867,279 @@
}
}
},
"/v1/invoice-config-items": {
"get": {
"description": "Retrieve a list of all invoice config items",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config-item"
],
"summary": "List all invoice config items",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.InvoiceConfigItem"
}
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
},
"post": {
"description": "Create a new invoice config item with the provided details",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config-item"
],
"summary": "Create a new invoice config item",
"parameters": [
{
"description": "Invoice config item request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/requests.CreateInvoiceConfigItemRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.CreateInvoiceConfigItemResponse"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
}
},
"/v1/invoice-config-items/{id}": {
"get": {
"description": "Retrieve a single invoice config item using its unique identifier",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config-item"
],
"summary": "Get invoice config item by ID",
"parameters": [
{
"type": "integer",
"description": "Invoice config item ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.InvoiceConfigItem"
}
}
}
]
}
},
"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 config item by its ID. Only non-empty fields will be updated.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config-item"
],
"summary": "Update invoice config item",
"parameters": [
{
"type": "integer",
"description": "Invoice config item ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Invoice config item request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/requests.UpdateInvoiceConfigItemRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.UpdateInvoiceConfigItemResponse"
}
}
}
]
}
},
"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 config item by its unique identifier",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config-item"
],
"summary": "Delete invoice config item",
"parameters": [
{
"type": "integer",
"description": "Invoice config item 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/invoice-configs": {
"get": {
"description": "Retrieve a list of all invoice configs ordered by creation date",
@@ -3205,6 +3478,38 @@
}
}
},
"models.InvoiceConfigItem": {
"type": "object",
"properties": {
"allowAlternative": {
"type": "boolean"
},
"componentId": {
"type": "integer"
},
"id": {
"type": "integer"
},
"invoiceConfigId": {
"type": "integer"
},
"metadata": {
"type": "array",
"items": {
"type": "integer"
}
},
"note": {
"type": "string"
},
"priorityOrder": {
"type": "integer"
},
"requiredQuantity": {
"type": "integer"
}
}
},
"models.Room": {
"type": "object",
"properties": {
@@ -3457,6 +3762,35 @@
}
}
},
"requests.CreateInvoiceConfigItemRequest": {
"type": "object",
"required": [
"componentId",
"invoiceConfigId",
"priorityOrder",
"requiredQuantity"
],
"properties": {
"allowAlternative": {
"type": "boolean"
},
"componentId": {
"type": "integer"
},
"invoiceConfigId": {
"type": "integer"
},
"note": {
"type": "string"
},
"priorityOrder": {
"type": "integer"
},
"requiredQuantity": {
"type": "integer"
}
}
},
"requests.CreateInvoiceConfigRequest": {
"type": "object",
"required": [
@@ -3677,6 +4011,23 @@
}
}
},
"requests.UpdateInvoiceConfigItemRequest": {
"type": "object",
"properties": {
"allowAlternative": {
"type": "boolean"
},
"note": {
"type": "string"
},
"priorityOrder": {
"type": "integer"
},
"requiredQuantity": {
"type": "integer"
}
}
},
"requests.UpdateInvoiceConfigRequest": {
"type": "object",
"properties": {
@@ -3822,6 +4173,14 @@
}
}
},
"responses.CreateInvoiceConfigItemResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer"
}
}
},
"responses.CreateInvoiceConfigResponse": {
"type": "object",
"properties": {
@@ -4009,6 +4368,32 @@
}
}
},
"responses.UpdateInvoiceConfigItemResponse": {
"type": "object",
"properties": {
"allowAlternative": {
"type": "boolean"
},
"componentId": {
"type": "integer"
},
"id": {
"type": "integer"
},
"invoiceConfigId": {
"type": "integer"
},
"note": {
"type": "string"
},
"priorityOrder": {
"type": "integer"
},
"requiredQuantity": {
"type": "integer"
}
}
},
"responses.UpdateInvoiceConfigResponse": {
"type": "object",
"properties": {

View File

@@ -164,6 +164,27 @@ definitions:
updatedAt:
type: string
type: object
models.InvoiceConfigItem:
properties:
allowAlternative:
type: boolean
componentId:
type: integer
id:
type: integer
invoiceConfigId:
type: integer
metadata:
items:
type: integer
type: array
note:
type: string
priorityOrder:
type: integer
requiredQuantity:
type: integer
type: object
models.Room:
properties:
createdAt:
@@ -333,6 +354,26 @@ definitions:
- name
- shelfId
type: object
requests.CreateInvoiceConfigItemRequest:
properties:
allowAlternative:
type: boolean
componentId:
type: integer
invoiceConfigId:
type: integer
note:
type: string
priorityOrder:
type: integer
requiredQuantity:
type: integer
required:
- componentId
- invoiceConfigId
- priorityOrder
- requiredQuantity
type: object
requests.CreateInvoiceConfigRequest:
properties:
description:
@@ -479,6 +520,17 @@ definitions:
name:
type: string
type: object
requests.UpdateInvoiceConfigItemRequest:
properties:
allowAlternative:
type: boolean
note:
type: string
priorityOrder:
type: integer
requiredQuantity:
type: integer
type: object
requests.UpdateInvoiceConfigRequest:
properties:
description:
@@ -572,6 +624,11 @@ definitions:
id:
type: integer
type: object
responses.CreateInvoiceConfigItemResponse:
properties:
id:
type: integer
type: object
responses.CreateInvoiceConfigResponse:
properties:
id:
@@ -693,6 +750,23 @@ definitions:
shelfId:
type: integer
type: object
responses.UpdateInvoiceConfigItemResponse:
properties:
allowAlternative:
type: boolean
componentId:
type: integer
id:
type: integer
invoiceConfigId:
type: integer
note:
type: string
priorityOrder:
type: integer
requiredQuantity:
type: integer
type: object
responses.UpdateInvoiceConfigResponse:
properties:
description:
@@ -1908,6 +1982,176 @@ paths:
summary: Update container
tags:
- container
/v1/invoice-config-items:
get:
consumes:
- application/json
description: Retrieve a list of all invoice config items
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
items:
$ref: '#/definitions/models.InvoiceConfigItem'
type: array
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: List all invoice config items
tags:
- invoice-config-item
post:
consumes:
- application/json
description: Create a new invoice config item with the provided details
parameters:
- description: Invoice config item request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.CreateInvoiceConfigItemRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.CreateInvoiceConfigItemResponse'
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 config item
tags:
- invoice-config-item
/v1/invoice-config-items/{id}:
delete:
consumes:
- application/json
description: Delete an invoice config item by its unique identifier
parameters:
- description: Invoice config item 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 config item
tags:
- invoice-config-item
get:
consumes:
- application/json
description: Retrieve a single invoice config item using its unique identifier
parameters:
- description: Invoice config item 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.InvoiceConfigItem'
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 config item by ID
tags:
- invoice-config-item
put:
consumes:
- application/json
description: Update an existing invoice config item by its ID. Only non-empty
fields will be updated.
parameters:
- description: Invoice config item ID
in: path
name: id
required: true
type: integer
- description: Invoice config item request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.UpdateInvoiceConfigItemRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.UpdateInvoiceConfigItemResponse'
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 config item
tags:
- invoice-config-item
/v1/invoice-configs:
get:
consumes: