feat(inventory_receipt): Add status field to inventory receipt entity and update DTO and service methods
Deploy Application / deploy (push) Successful in 22s
Details
Deploy Application / deploy (push) Successful in 22s
Details
This commit is contained in:
parent
cfe9cb4e77
commit
466c49167e
|
|
@ -16,6 +16,7 @@ type TInventoryReceiptEntity struct {
|
|||
ReceiptDate time.Time `gorm:"type:timestamp;" json:"receipt_date"`
|
||||
Source string `gorm:"type:varchar(50);" json:"source"`
|
||||
QrCodeFile string `gorm:"type:text;" json:"qr_code_file"`
|
||||
Status string `gorm:"type:varchar(50);default:'draft';" json:"status"`
|
||||
|
||||
ClientID uuid.UUID `gorm:"type:uuid;index;" json:"client_id"`
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ type InventoryReceiptCreateRequest struct {
|
|||
Source string `json:"source"`
|
||||
QrCodeFile string `json:"qr_code_file"`
|
||||
ClientID string `json:"client_id" binding:"required"`
|
||||
Status string `json:"status" binding:"required"`
|
||||
ReceiptLines []InventoryReceiptLineCreateRequest `json:"inventory_lines,omitempty" binding:"dive"`
|
||||
}
|
||||
|
||||
|
|
@ -43,6 +44,7 @@ type InventoryReceiptUpdateRequest struct {
|
|||
ReceiptDate string `json:"receipt_date"`
|
||||
Source string `json:"source"`
|
||||
QrCodeFile string `json:"qr_code_file"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
type InventoryReceiptResponse struct {
|
||||
|
|
@ -52,6 +54,7 @@ type InventoryReceiptResponse struct {
|
|||
ReceiptDate string `json:"receipt_date"`
|
||||
Source string `json:"source"`
|
||||
QrCodeFile string `json:"qr_code_file"`
|
||||
Status string `json:"status"`
|
||||
Client pkgdto.IdNameResponse `json:"client"`
|
||||
ReceiptLines []InventoryReceiptLineResponse `json:"inventory_lines"`
|
||||
LineCount int `json:"line_count"`
|
||||
|
|
|
|||
|
|
@ -221,6 +221,7 @@ func (s *inventoryReceiptService) Create(ctx context.Context, req dtodomain.Inve
|
|||
Source: req.Source,
|
||||
QrCodeFile: req.QrCodeFile,
|
||||
ClientID: clientUUID,
|
||||
Status: req.Status,
|
||||
}
|
||||
created, err := s.receiptRepo.Create(ctx, tx, receipt)
|
||||
if err != nil {
|
||||
|
|
@ -322,6 +323,7 @@ func (s *inventoryReceiptService) Update(ctx context.Context, req dtodomain.Inve
|
|||
receipt.ReceiptDate = utils.StringToDateTime(req.ReceiptDate)
|
||||
receipt.Source = req.Source
|
||||
receipt.QrCodeFile = req.QrCodeFile
|
||||
receipt.Status = req.Status
|
||||
updated, err := s.receiptRepo.Update(ctx, tx, receipt)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
|
|
|
|||
Loading…
Reference in New Issue