FIX[BE]: delete redudant kandang response on projectflockkandang getone API

This commit is contained in:
aguhh18
2025-11-03 09:29:00 +07:00
parent 86f37a89c1
commit c72db5bd18
2 changed files with 1 additions and 17 deletions
@@ -28,7 +28,6 @@ type ProjectFlockCustomDTO struct {
Category string `json:"category"`
Fcr *fcrDTO.FcrBaseDTO `json:"fcr,omitempty"`
Location *locationDTO.LocationBaseDTO `json:"location,omitempty"`
Kandangs []KandangCustomDTO `json:"kandangs,omitempty"`
CreatedUser *userDTO.UserBaseDTO `json:"created_user,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
@@ -85,7 +84,6 @@ func toProjectFlockCustomDTO(pf *projectFlockDTO.ProjectFlockListDTO) *ProjectFl
Category: pf.Category,
Fcr: pf.Fcr,
Location: pf.Location,
Kandangs: buildKandangCustomDTOs(pf.Kandangs),
CreatedUser: pf.CreatedUser,
CreatedAt: pf.CreatedAt,
UpdatedAt: pf.UpdatedAt,
@@ -238,18 +236,6 @@ func buildCreatedUser(pf entity.ProjectFlock) *userDTO.UserBaseDTO {
return nil
}
func buildKandangCustomDTOs(kandangs []projectFlockDTO.KandangWithProjectFlockIdDTO) []KandangCustomDTO {
if len(kandangs) == 0 {
return nil
}
result := make([]KandangCustomDTO, len(kandangs))
for i, k := range kandangs {
result[i] = toKandangCustomDTO(k)
}
return result
}
func buildKandangFromEntity(kandang entity.Kandang) *KandangCustomDTO {
if kandang.Id == 0 {
return nil
@@ -115,20 +115,18 @@ func (s projectFlockKandangService) getAvailableQuantities(c *fiber.Ctx, project
var result []map[string]interface{}
for _, pw := range products {
if pw.Quantity > 0 {
// Build product data
productData := map[string]interface{}{
"id": pw.Product.Id,
"name": pw.Product.Name,
}
// Build warehouse data
warehouseData := map[string]interface{}{
"id": pw.Warehouse.Id,
"name": pw.Warehouse.Name,
"type": pw.Warehouse.Type,
}
// Build product warehouse data with nested product and warehouse
productWarehouseData := map[string]interface{}{
"id": pw.Id,
"quantity": pw.Quantity,