mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
Feat[BE]: update update dto for transfer document
This commit is contained in:
@@ -85,7 +85,7 @@ type TransferDeliveryDTO struct {
|
|||||||
ShippingCostItem float64 `json:"shipping_cost_item"`
|
ShippingCostItem float64 `json:"shipping_cost_item"`
|
||||||
ShippingCostTotal float64 `json:"shipping_cost_total"`
|
ShippingCostTotal float64 `json:"shipping_cost_total"`
|
||||||
Items []TransferDeliveryItemDTO `json:"items"`
|
Items []TransferDeliveryItemDTO `json:"items"`
|
||||||
Documents []DocumentDTO `json:"documents"`
|
Document *DocumentDTO `json:"document,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type TransferDeliveryItemDTO struct {
|
type TransferDeliveryItemDTO struct {
|
||||||
@@ -174,15 +174,16 @@ func ToTransferListDTO(e entity.StockTransfer) TransferListDTO {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var documents []DocumentDTO
|
var document *DocumentDTO
|
||||||
for _, doc := range del.Documents {
|
if len(del.Documents) > 0 {
|
||||||
documents = append(documents, DocumentDTO{
|
doc := del.Documents[0] // Take first document
|
||||||
|
document = &DocumentDTO{
|
||||||
Id: doc.Id,
|
Id: doc.Id,
|
||||||
Path: doc.Path,
|
Path: doc.Path,
|
||||||
Name: doc.Name,
|
Name: doc.Name,
|
||||||
Ext: doc.Ext,
|
Ext: doc.Ext,
|
||||||
Size: doc.Size,
|
Size: doc.Size,
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deliveries = append(deliveries, TransferDeliveryDTO{
|
deliveries = append(deliveries, TransferDeliveryDTO{
|
||||||
@@ -197,7 +198,7 @@ func ToTransferListDTO(e entity.StockTransfer) TransferListDTO {
|
|||||||
ShippingCostItem: del.ShippingCostItem,
|
ShippingCostItem: del.ShippingCostItem,
|
||||||
ShippingCostTotal: del.ShippingCostTotal,
|
ShippingCostTotal: del.ShippingCostTotal,
|
||||||
Items: items,
|
Items: items,
|
||||||
Documents: documents,
|
Document: document,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,15 +235,16 @@ func ToTransferDetailDTO(e entity.StockTransfer) TransferDetailDTO {
|
|||||||
|
|
||||||
var deliveries []TransferDeliveryDTO
|
var deliveries []TransferDeliveryDTO
|
||||||
for _, del := range e.Deliveries {
|
for _, del := range e.Deliveries {
|
||||||
var documents []DocumentDTO
|
var document *DocumentDTO
|
||||||
for _, doc := range del.Documents {
|
if len(del.Documents) > 0 {
|
||||||
documents = append(documents, DocumentDTO{
|
doc := del.Documents[0] // Take first document
|
||||||
|
document = &DocumentDTO{
|
||||||
Id: doc.Id,
|
Id: doc.Id,
|
||||||
Path: doc.Path,
|
Path: doc.Path,
|
||||||
Name: doc.Name,
|
Name: doc.Name,
|
||||||
Ext: doc.Ext,
|
Ext: doc.Ext,
|
||||||
Size: doc.Size,
|
Size: doc.Size,
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deliveries = append(deliveries, TransferDeliveryDTO{
|
deliveries = append(deliveries, TransferDeliveryDTO{
|
||||||
@@ -256,7 +258,7 @@ func ToTransferDetailDTO(e entity.StockTransfer) TransferDetailDTO {
|
|||||||
DocumentNumber: del.DocumentNumber,
|
DocumentNumber: del.DocumentNumber,
|
||||||
ShippingCostItem: del.ShippingCostItem,
|
ShippingCostItem: del.ShippingCostItem,
|
||||||
ShippingCostTotal: del.ShippingCostTotal,
|
ShippingCostTotal: del.ShippingCostTotal,
|
||||||
Documents: documents,
|
Document: document,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user