feat: add invoice-configs management functionality

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

View File

@@ -1873,6 +1873,279 @@ const docTemplate = `{
}
}
},
"/v1/invoice-configs": {
"get": {
"description": "Retrieve a list of all invoice configs ordered by creation date",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config"
],
"summary": "List all invoice configs",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.InvoiceConfig"
}
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
},
"post": {
"description": "Create a new invoice config with the provided details",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config"
],
"summary": "Create a new invoice config",
"parameters": [
{
"description": "Invoice config request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/requests.CreateInvoiceConfigRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.CreateInvoiceConfigResponse"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
}
},
"/v1/invoice-configs/{id}": {
"get": {
"description": "Retrieve a single invoice config using its unique identifier",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config"
],
"summary": "Get invoice config by ID",
"parameters": [
{
"type": "integer",
"description": "Invoice config ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.InvoiceConfig"
}
}
}
]
}
},
"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 by its ID. Only non-empty fields will be updated.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config"
],
"summary": "Update invoice config",
"parameters": [
{
"type": "integer",
"description": "Invoice config ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Invoice config request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/requests.UpdateInvoiceConfigRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.UpdateInvoiceConfigResponse"
}
}
}
]
}
},
"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 by its unique identifier",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config"
],
"summary": "Delete invoice config",
"parameters": [
{
"type": "integer",
"description": "Invoice config 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",
@@ -2906,6 +3179,38 @@ const docTemplate = `{
}
}
},
"models.InvoiceConfig": {
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"isActive": {
"type": "boolean"
},
"metadata": {
"type": "array",
"items": {
"type": "integer"
}
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"updatedAt": {
"type": "string"
}
}
},
"models.Room": {
"type": "object",
"properties": {
@@ -3158,6 +3463,27 @@ const docTemplate = `{
}
}
},
"requests.CreateInvoiceConfigRequest": {
"type": "object",
"required": [
"name",
"type"
],
"properties": {
"description": {
"type": "string"
},
"isActive": {
"type": "boolean"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"requests.CreateRoomRequest": {
"type": "object",
"required": [
@@ -3357,6 +3683,23 @@ const docTemplate = `{
}
}
},
"requests.UpdateInvoiceConfigRequest": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"isActive": {
"type": "boolean"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"requests.UpdateRoomRequest": {
"type": "object",
"properties": {
@@ -3485,6 +3828,14 @@ const docTemplate = `{
}
}
},
"responses.CreateInvoiceConfigResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer"
}
}
},
"responses.CreateRoomResponse": {
"type": "object",
"properties": {
@@ -3664,6 +4015,26 @@ const docTemplate = `{
}
}
},
"responses.UpdateInvoiceConfigResponse": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"isActive": {
"type": "boolean"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"responses.UpdateRoomResponse": {
"type": "object",
"properties": {

View File

@@ -1867,6 +1867,279 @@
}
}
},
"/v1/invoice-configs": {
"get": {
"description": "Retrieve a list of all invoice configs ordered by creation date",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config"
],
"summary": "List all invoice configs",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.InvoiceConfig"
}
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
},
"post": {
"description": "Create a new invoice config with the provided details",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config"
],
"summary": "Create a new invoice config",
"parameters": [
{
"description": "Invoice config request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/requests.CreateInvoiceConfigRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.CreateInvoiceConfigResponse"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.ErrorResponse"
}
}
}
}
},
"/v1/invoice-configs/{id}": {
"get": {
"description": "Retrieve a single invoice config using its unique identifier",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config"
],
"summary": "Get invoice config by ID",
"parameters": [
{
"type": "integer",
"description": "Invoice config ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.InvoiceConfig"
}
}
}
]
}
},
"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 by its ID. Only non-empty fields will be updated.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config"
],
"summary": "Update invoice config",
"parameters": [
{
"type": "integer",
"description": "Invoice config ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Invoice config request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/requests.UpdateInvoiceConfigRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.SuccessResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/responses.UpdateInvoiceConfigResponse"
}
}
}
]
}
},
"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 by its unique identifier",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"invoice-config"
],
"summary": "Delete invoice config",
"parameters": [
{
"type": "integer",
"description": "Invoice config 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",
@@ -2900,6 +3173,38 @@
}
}
},
"models.InvoiceConfig": {
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"isActive": {
"type": "boolean"
},
"metadata": {
"type": "array",
"items": {
"type": "integer"
}
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"updatedAt": {
"type": "string"
}
}
},
"models.Room": {
"type": "object",
"properties": {
@@ -3152,6 +3457,27 @@
}
}
},
"requests.CreateInvoiceConfigRequest": {
"type": "object",
"required": [
"name",
"type"
],
"properties": {
"description": {
"type": "string"
},
"isActive": {
"type": "boolean"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"requests.CreateRoomRequest": {
"type": "object",
"required": [
@@ -3351,6 +3677,23 @@
}
}
},
"requests.UpdateInvoiceConfigRequest": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"isActive": {
"type": "boolean"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"requests.UpdateRoomRequest": {
"type": "object",
"properties": {
@@ -3479,6 +3822,14 @@
}
}
},
"responses.CreateInvoiceConfigResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer"
}
}
},
"responses.CreateRoomResponse": {
"type": "object",
"properties": {
@@ -3658,6 +4009,26 @@
}
}
},
"responses.UpdateInvoiceConfigResponse": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"isActive": {
"type": "boolean"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"responses.UpdateRoomResponse": {
"type": "object",
"properties": {

View File

@@ -143,6 +143,27 @@ definitions:
warehouseName:
type: string
type: object
models.InvoiceConfig:
properties:
createdAt:
type: string
description:
type: string
id:
type: integer
isActive:
type: boolean
metadata:
items:
type: integer
type: array
name:
type: string
type:
type: string
updatedAt:
type: string
type: object
models.Room:
properties:
createdAt:
@@ -312,6 +333,20 @@ definitions:
- name
- shelfId
type: object
requests.CreateInvoiceConfigRequest:
properties:
description:
type: string
isActive:
type: boolean
name:
type: string
type:
type: string
required:
- name
- type
type: object
requests.CreateRoomRequest:
properties:
description:
@@ -444,6 +479,17 @@ definitions:
name:
type: string
type: object
requests.UpdateInvoiceConfigRequest:
properties:
description:
type: string
isActive:
type: boolean
name:
type: string
type:
type: string
type: object
requests.UpdateRoomRequest:
properties:
description:
@@ -526,6 +572,11 @@ definitions:
id:
type: integer
type: object
responses.CreateInvoiceConfigResponse:
properties:
id:
type: integer
type: object
responses.CreateRoomResponse:
properties:
id:
@@ -642,6 +693,19 @@ definitions:
shelfId:
type: integer
type: object
responses.UpdateInvoiceConfigResponse:
properties:
description:
type: string
id:
type: integer
isActive:
type: boolean
name:
type: string
type:
type: string
type: object
responses.UpdateRoomResponse:
properties:
description:
@@ -1844,6 +1908,176 @@ paths:
summary: Update container
tags:
- container
/v1/invoice-configs:
get:
consumes:
- application/json
description: Retrieve a list of all invoice configs ordered by creation date
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
items:
$ref: '#/definitions/models.InvoiceConfig'
type: array
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.ErrorResponse'
summary: List all invoice configs
tags:
- invoice-config
post:
consumes:
- application/json
description: Create a new invoice config with the provided details
parameters:
- description: Invoice config request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.CreateInvoiceConfigRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.CreateInvoiceConfigResponse'
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
tags:
- invoice-config
/v1/invoice-configs/{id}:
delete:
consumes:
- application/json
description: Delete an invoice config by its unique identifier
parameters:
- description: Invoice config 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
tags:
- invoice-config
get:
consumes:
- application/json
description: Retrieve a single invoice config using its unique identifier
parameters:
- description: Invoice config 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.InvoiceConfig'
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 by ID
tags:
- invoice-config
put:
consumes:
- application/json
description: Update an existing invoice config by its ID. Only non-empty fields
will be updated.
parameters:
- description: Invoice config ID
in: path
name: id
required: true
type: integer
- description: Invoice config request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/requests.UpdateInvoiceConfigRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.SuccessResponse'
- properties:
data:
$ref: '#/definitions/responses.UpdateInvoiceConfigResponse'
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
tags:
- invoice-config
/v1/rooms:
get:
consumes: