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

@@ -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: