fix(BE-273): add object nonstock and supplier in response get one and fix name base to relation in dto

This commit is contained in:
Hafizh A. Y
2025-11-20 14:59:50 +07:00
parent b4b860b9d4
commit 228aedc215
64 changed files with 964 additions and 3576 deletions
+10 -10
View File
@@ -9,17 +9,17 @@ import (
// === DTO Structs ===
type UomBaseDTO struct {
type UomRelationDTO struct {
Id uint `json:"id"`
Name string `json:"name"`
}
type UomListDTO struct {
Id uint `json:"id"`
Name string `json:"name"`
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"`
CreatedUser *userDTO.UserRelationDTO `json:"created_user"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type UomDetailDTO struct {
@@ -28,17 +28,17 @@ type UomDetailDTO struct {
// === Mapper Functions ===
func ToUomBaseDTO(e entity.Uom) UomBaseDTO {
return UomBaseDTO{
func ToUomRelationDTO(e entity.Uom) UomRelationDTO {
return UomRelationDTO{
Id: e.Id,
Name: e.Name,
}
}
func ToUomListDTO(e entity.Uom) UomListDTO {
var createdUser *userDTO.UserBaseDTO
var createdUser *userDTO.UserRelationDTO
if e.CreatedUser.Id != 0 {
mapped := userDTO.ToUserBaseDTO(e.CreatedUser)
mapped := userDTO.ToUserRelationDTO(e.CreatedUser)
createdUser = &mapped
}