mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 05:21:57 +00:00
FIX[BE]: delete redudant kandang response on projectflockkandang getone API
This commit is contained in:
@@ -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
|
||||
|
||||
+1
-3
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user