mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-24 07:15:43 +00:00
feat(BE-229,234,235,230,231,232,233): purchase request and purchase order and fix master data dto
This commit is contained in:
@@ -16,16 +16,21 @@ type WarehouseBaseDTO struct {
|
||||
Id uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Area *areaDTO.AreaBaseDTO `json:"area"`
|
||||
Location *locationDTO.LocationBaseDTO `json:"location"`
|
||||
Kandang *kandangDTO.KandangBaseDTO `json:"kandang"`
|
||||
Area *areaDTO.AreaBaseDTO `json:"area,omitempty"`
|
||||
Location *locationDTO.LocationBaseDTO `json:"location,omitempty"`
|
||||
Kandang *kandangDTO.KandangBaseDTO `json:"kandang,omitempty"`
|
||||
}
|
||||
|
||||
type WarehouseListDTO struct {
|
||||
WarehouseBaseDTO
|
||||
CreatedUser *userDTO.UserBaseDTO `json:"created_user"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
Id uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Area *areaDTO.AreaBaseDTO `json:"area"`
|
||||
Location *locationDTO.LocationBaseDTO `json:"location"`
|
||||
Kandang *kandangDTO.KandangBaseDTO `json:"kandang"`
|
||||
CreatedUser *userDTO.UserBaseDTO `json:"created_user"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type WarehouseDetailDTO struct {
|
||||
@@ -70,11 +75,34 @@ func ToWarehouseListDTO(e entity.Warehouse) WarehouseListDTO {
|
||||
createdUser = &mapped
|
||||
}
|
||||
|
||||
var area *areaDTO.AreaBaseDTO
|
||||
if e.Area.Id != 0 {
|
||||
mapped := areaDTO.ToAreaBaseDTO(e.Area)
|
||||
area = &mapped
|
||||
}
|
||||
|
||||
var location *locationDTO.LocationBaseDTO
|
||||
if e.Location != nil && e.Location.Id != 0 {
|
||||
mapped := locationDTO.ToLocationBaseDTO(*e.Location)
|
||||
location = &mapped
|
||||
}
|
||||
|
||||
var kandang *kandangDTO.KandangBaseDTO
|
||||
if e.Kandang != nil && e.Kandang.Id != 0 {
|
||||
mapped := kandangDTO.ToKandangBaseDTO(*e.Kandang)
|
||||
kandang = &mapped
|
||||
}
|
||||
|
||||
return WarehouseListDTO{
|
||||
WarehouseBaseDTO: ToWarehouseBaseDTO(e),
|
||||
CreatedAt: e.CreatedAt,
|
||||
UpdatedAt: e.UpdatedAt,
|
||||
CreatedUser: createdUser,
|
||||
Id: e.Id,
|
||||
Name: e.Name,
|
||||
Type: e.Type,
|
||||
Area: area,
|
||||
Location: location,
|
||||
Kandang: kandang,
|
||||
CreatedAt: e.CreatedAt,
|
||||
UpdatedAt: e.UpdatedAt,
|
||||
CreatedUser: createdUser,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user