Skip to content

Commit

Permalink
fix: create invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
NLNM-0-0 committed Jan 13, 2024
1 parent 605809b commit c0742f2
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
28 changes: 28 additions & 0 deletions backend/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5038,6 +5038,22 @@ const docTemplate = `{
}
}
},
"invoicedetailmodel.InvoiceDetail": {
"type": "object",
"properties": {
"book": {
"$ref": "#/definitions/bookmodel.SimpleBook"
},
"qty": {
"type": "integer",
"example": 2
},
"unitPrice": {
"type": "integer",
"example": 60000
}
}
},
"invoicedetailmodel.ReqCreateInvoiceDetail": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -5083,6 +5099,12 @@ const docTemplate = `{
"customer": {
"$ref": "#/definitions/invoicemodel.SimpleCustomer"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/invoicedetailmodel.InvoiceDetail"
}
},
"id": {
"type": "string",
"example": "123"
Expand Down Expand Up @@ -5112,11 +5134,17 @@ const docTemplate = `{
"invoicemodel.ReqCreateInvoice": {
"type": "object",
"properties": {
"customerId": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/invoicedetailmodel.ReqCreateInvoiceDetail"
}
},
"isUsePoint": {
"type": "boolean"
}
}
},
Expand Down
28 changes: 28 additions & 0 deletions backend/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -5032,6 +5032,22 @@
}
}
},
"invoicedetailmodel.InvoiceDetail": {
"type": "object",
"properties": {
"book": {
"$ref": "#/definitions/bookmodel.SimpleBook"
},
"qty": {
"type": "integer",
"example": 2
},
"unitPrice": {
"type": "integer",
"example": 60000
}
}
},
"invoicedetailmodel.ReqCreateInvoiceDetail": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -5077,6 +5093,12 @@
"customer": {
"$ref": "#/definitions/invoicemodel.SimpleCustomer"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/invoicedetailmodel.InvoiceDetail"
}
},
"id": {
"type": "string",
"example": "123"
Expand Down Expand Up @@ -5106,11 +5128,17 @@
"invoicemodel.ReqCreateInvoice": {
"type": "object",
"properties": {
"customerId": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/invoicedetailmodel.ReqCreateInvoiceDetail"
}
},
"isUsePoint": {
"type": "boolean"
}
}
},
Expand Down
19 changes: 19 additions & 0 deletions backend/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,17 @@ definitions:
description: Data contains the detailed information about inventory check
note details.
type: object
invoicedetailmodel.InvoiceDetail:
properties:
book:
$ref: '#/definitions/bookmodel.SimpleBook'
qty:
example: 2
type: integer
unitPrice:
example: 60000
type: integer
type: object
invoicedetailmodel.ReqCreateInvoiceDetail:
properties:
bookId:
Expand Down Expand Up @@ -1030,6 +1041,10 @@ definitions:
$ref: '#/definitions/usermodel.SimpleUser'
customer:
$ref: '#/definitions/invoicemodel.SimpleCustomer'
details:
items:
$ref: '#/definitions/invoicedetailmodel.InvoiceDetail'
type: array
id:
example: "123"
type: string
Expand All @@ -1051,10 +1066,14 @@ definitions:
type: object
invoicemodel.ReqCreateInvoice:
properties:
customerId:
type: string
details:
items:
$ref: '#/definitions/invoicedetailmodel.ReqCreateInvoiceDetail'
type: array
isUsePoint:
type: boolean
type: object
invoicemodel.ResCreateInvoice:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"book-store-management-backend/component/generator"
"book-store-management-backend/middleware"
"book-store-management-backend/module/book/bookstore"
"book-store-management-backend/module/customer/customerstore"
"book-store-management-backend/module/invoice/invoicebiz"
"book-store-management-backend/module/invoice/invoicemodel"
"book-store-management-backend/module/invoice/invoicerepo"
Expand Down Expand Up @@ -42,13 +43,15 @@ func CreateInvoice(appCtx appctx.AppContext) gin.HandlerFunc {

invoiceStore := invoicestore.NewSQLStore(db)
invoiceDetailStore := invoicedetailstore.NewSQLStore(db)
customerStore := customerstore.NewSQLStore(db)
bookStore := bookstore.NewSQLStore(db)
stockChangeHistoryStore := stockchangehistorystore.NewSQLStore(db)
shopGeneralStore := shopgeneralstore.NewSQLStore(db)

repo := invoicerepo.NewCreateInvoiceRepo(
invoiceStore,
invoiceDetailStore,
customerStore,
bookStore,
stockChangeHistoryStore,
shopGeneralStore,
Expand Down

0 comments on commit c0742f2

Please sign in to comment.