feat: update QuarantineResponse and QuarantineLineResponse to use pkgdto.IdNameResponse for better structure
Deploy Application / deploy (push) Successful in 20s
Details
Deploy Application / deploy (push) Successful in 20s
Details
This commit is contained in:
parent
6fb7218de7
commit
0abdc2ae6f
|
|
@ -2,6 +2,7 @@ package dto
|
|||
|
||||
import (
|
||||
"github.com/Caknoooo/go-gin-clean-starter/database/entities"
|
||||
pkgdto "github.com/Caknoooo/go-gin-clean-starter/pkg/dto"
|
||||
"github.com/Caknoooo/go-gin-clean-starter/pkg/utils"
|
||||
)
|
||||
|
||||
|
|
@ -72,13 +73,10 @@ type QuarantineResponse struct {
|
|||
DocumentNumber string `json:"document_number"`
|
||||
DocumentDate string `json:"document_date"`
|
||||
Status string `json:"status"`
|
||||
WarehouseID string `json:"warehouse_id"`
|
||||
ZonaID string `json:"zona_id"`
|
||||
ClientID string `json:"client_id"`
|
||||
Warehouse string `json:"warehouse"`
|
||||
Zona string `json:"zona"`
|
||||
Client string `json:"client"`
|
||||
QuarantineLines []QuarantineLineResponse `json:"quarantine_lines,omitempty"`
|
||||
Warehouse pkgdto.IdNameResponse `json:"warehouse"`
|
||||
Zona pkgdto.IdNameResponse `json:"zona"`
|
||||
Client pkgdto.IdNameResponse `json:"client"`
|
||||
// QuarantineLines []QuarantineLineResponse `json:"quarantine_lines,omitempty"`
|
||||
}
|
||||
|
||||
type QuarantineLineResponse struct {
|
||||
|
|
@ -87,10 +85,10 @@ type QuarantineLineResponse struct {
|
|||
StorageID string `json:"storage_id"`
|
||||
ProductID string `json:"product_id"`
|
||||
ClientID string `json:"client_id"`
|
||||
Product string `json:"product"`
|
||||
Storage string `json:"storage"`
|
||||
Quarantine string `json:"quarantine"`
|
||||
Client string `json:"client"`
|
||||
Product pkgdto.IdNameResponse `json:"product"`
|
||||
Storage pkgdto.IdNameResponse `json:"storage"`
|
||||
Quarantine pkgdto.IdNameResponse `json:"quarantine"`
|
||||
Client pkgdto.IdNameResponse `json:"client"`
|
||||
}
|
||||
|
||||
func MapQuarantineToResponse(entity entities.TInventoryQuarantineEntity, lines []entities.TInventoryQuarantineLineEntity) QuarantineResponse {
|
||||
|
|
@ -99,12 +97,9 @@ func MapQuarantineToResponse(entity entities.TInventoryQuarantineEntity, lines [
|
|||
DocumentNumber: entity.DocumentNumber,
|
||||
DocumentDate: utils.DateTimeToString(entity.DocumentDate),
|
||||
Status: entity.Status,
|
||||
WarehouseID: entity.WarehouseID.String(),
|
||||
ZonaID: entity.ZonaID.String(),
|
||||
ClientID: entity.ClientID.String(),
|
||||
Warehouse: entity.Warehouse.Name,
|
||||
Zona: entity.Zona.Name,
|
||||
Client: entity.Client.Name,
|
||||
Warehouse: pkgdto.IdNameResponse{ID: entity.WarehouseID.String(), Name: entity.Warehouse.Name},
|
||||
Zona: pkgdto.IdNameResponse{ID: entity.ZonaID.String(), Name: entity.Zona.Name},
|
||||
Client: pkgdto.IdNameResponse{ID: entity.ClientID.String(), Name: entity.Client.Name},
|
||||
}
|
||||
return resp
|
||||
}
|
||||
|
|
@ -116,10 +111,10 @@ func MapQuarantineLineToResponse(line entities.TInventoryQuarantineLineEntity) Q
|
|||
StorageID: line.StorageID.String(),
|
||||
ProductID: line.ProductID.String(),
|
||||
ClientID: line.ClientID.String(),
|
||||
Product: line.Product.Name,
|
||||
Storage: line.StorageID.String(), // gunakan StorageID, karena field Name tidak ada
|
||||
Quarantine: line.Quarantine.DocumentNumber,
|
||||
Client: line.Client.Name,
|
||||
Product: pkgdto.IdNameResponse{ID: line.ProductID.String(), Name: line.Product.Name},
|
||||
Storage: pkgdto.IdNameResponse{ID: line.StorageID.String(), Name: "line.Storage.Name"},
|
||||
Quarantine: pkgdto.IdNameResponse{ID: line.QuarantineID.String(), Name: line.Quarantine.DocumentNumber},
|
||||
Client: pkgdto.IdNameResponse{ID: line.ClientID.String(), Name: line.Client.Name},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue