feat(BE): update expense DTO and service to directly use location from expense

This commit is contained in:
aguhh18
2025-12-30 19:30:42 +07:00
parent 471fd1dbbf
commit b988f45a0b
2 changed files with 10 additions and 10 deletions
+3 -5
View File
@@ -105,11 +105,9 @@ func ToExpenseBaseDTO(e *entity.Expense) ExpenseBaseDTO {
realizationDate = &e.RealizationDate
}
if len(e.Nonstocks) > 0 && e.Nonstocks[0].Kandang != nil {
if e.Nonstocks[0].Kandang.Location.Id != 0 {
mapped := locationDTO.ToLocationRelationDTO(e.Nonstocks[0].Kandang.Location)
location = &mapped
}
if e.Location != nil && e.Location.Id != 0 {
mapped := locationDTO.ToLocationRelationDTO(*e.Location)
location = &mapped
}
if e.Supplier != nil && e.Supplier.Id != 0 {