fix(BE): adjust dto and project flock, master data, and marketing

This commit is contained in:
Hafizh A. Y
2025-11-21 09:53:33 +07:00
parent cd752f19f4
commit 53b226f243
6 changed files with 101 additions and 84 deletions
@@ -11,12 +11,12 @@ import (
// === DTO Structs ===
type KandangRelationDTO struct {
Id uint `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
Capacity float64 `json:"capacity"`
Location locationDTO.LocationRelationDTO `json:"location,omitempty"`
Pic userDTO.UserRelationDTO `json:"pic,omitempty"`
Id uint `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
Capacity float64 `json:"capacity"`
Location *locationDTO.LocationRelationDTO `json:"location,omitempty"`
Pic *userDTO.UserRelationDTO `json:"pic,omitempty"`
}
type KandangListDTO struct {
@@ -38,16 +38,16 @@ type KandangDetailDTO struct {
// === Mapper Functions ===
func ToKandangRelationDTO(e entity.Kandang) KandangRelationDTO {
var location locationDTO.LocationRelationDTO
var location *locationDTO.LocationRelationDTO
if e.Location.Id != 0 {
mapped := locationDTO.ToLocationRelationDTO(e.Location)
location = mapped
location = &mapped
}
var pic userDTO.UserRelationDTO
var pic *userDTO.UserRelationDTO
if e.Pic.Id != 0 {
mapped := userDTO.ToUserRelationDTO(e.Pic)
pic = mapped
pic = &mapped
}
return KandangRelationDTO{