mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-23 06:45:43 +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"`
|
Category string `json:"category"`
|
||||||
Fcr *fcrDTO.FcrBaseDTO `json:"fcr,omitempty"`
|
Fcr *fcrDTO.FcrBaseDTO `json:"fcr,omitempty"`
|
||||||
Location *locationDTO.LocationBaseDTO `json:"location,omitempty"`
|
Location *locationDTO.LocationBaseDTO `json:"location,omitempty"`
|
||||||
Kandangs []KandangCustomDTO `json:"kandangs,omitempty"`
|
|
||||||
CreatedUser *userDTO.UserBaseDTO `json:"created_user,omitempty"`
|
CreatedUser *userDTO.UserBaseDTO `json:"created_user,omitempty"`
|
||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
UpdatedAt time.Time `json:"updated_at"`
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
@@ -85,7 +84,6 @@ func toProjectFlockCustomDTO(pf *projectFlockDTO.ProjectFlockListDTO) *ProjectFl
|
|||||||
Category: pf.Category,
|
Category: pf.Category,
|
||||||
Fcr: pf.Fcr,
|
Fcr: pf.Fcr,
|
||||||
Location: pf.Location,
|
Location: pf.Location,
|
||||||
Kandangs: buildKandangCustomDTOs(pf.Kandangs),
|
|
||||||
CreatedUser: pf.CreatedUser,
|
CreatedUser: pf.CreatedUser,
|
||||||
CreatedAt: pf.CreatedAt,
|
CreatedAt: pf.CreatedAt,
|
||||||
UpdatedAt: pf.UpdatedAt,
|
UpdatedAt: pf.UpdatedAt,
|
||||||
@@ -238,18 +236,6 @@ func buildCreatedUser(pf entity.ProjectFlock) *userDTO.UserBaseDTO {
|
|||||||
return nil
|
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 {
|
func buildKandangFromEntity(kandang entity.Kandang) *KandangCustomDTO {
|
||||||
if kandang.Id == 0 {
|
if kandang.Id == 0 {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
+1
-3
@@ -115,20 +115,18 @@ func (s projectFlockKandangService) getAvailableQuantities(c *fiber.Ctx, project
|
|||||||
var result []map[string]interface{}
|
var result []map[string]interface{}
|
||||||
for _, pw := range products {
|
for _, pw := range products {
|
||||||
if pw.Quantity > 0 {
|
if pw.Quantity > 0 {
|
||||||
// Build product data
|
|
||||||
productData := map[string]interface{}{
|
productData := map[string]interface{}{
|
||||||
"id": pw.Product.Id,
|
"id": pw.Product.Id,
|
||||||
"name": pw.Product.Name,
|
"name": pw.Product.Name,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build warehouse data
|
|
||||||
warehouseData := map[string]interface{}{
|
warehouseData := map[string]interface{}{
|
||||||
"id": pw.Warehouse.Id,
|
"id": pw.Warehouse.Id,
|
||||||
"name": pw.Warehouse.Name,
|
"name": pw.Warehouse.Name,
|
||||||
"type": pw.Warehouse.Type,
|
"type": pw.Warehouse.Type,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build product warehouse data with nested product and warehouse
|
|
||||||
productWarehouseData := map[string]interface{}{
|
productWarehouseData := map[string]interface{}{
|
||||||
"id": pw.Id,
|
"id": pw.Id,
|
||||||
"quantity": pw.Quantity,
|
"quantity": pw.Quantity,
|
||||||
|
|||||||
Reference in New Issue
Block a user