mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-24 15:25:43 +00:00
Merge branch 'feat/BE/Sprint-8' of https://gitlab.com/mbugroup/lti-api into dev/teguh
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
// === DTO Structs ===
|
||||
|
||||
type ProductionStandardListDTO struct {
|
||||
type ProductionStandardRelationDTO struct {
|
||||
Id uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
ProjectCategory string `json:"project_category"`
|
||||
@@ -15,7 +15,7 @@ type ProductionStandardListDTO struct {
|
||||
}
|
||||
|
||||
type ProductionStandardDetailDTO struct {
|
||||
ProductionStandardListDTO
|
||||
ProductionStandardRelationDTO
|
||||
Details []WeeklyProductionStandardDTO `json:"details"`
|
||||
}
|
||||
|
||||
@@ -44,14 +44,14 @@ type WeeklyProductionStandardDTO struct {
|
||||
|
||||
// === Mapper Functions ===
|
||||
|
||||
func ToProductionStandardListDTO(e entity.ProductionStandard) ProductionStandardListDTO {
|
||||
func ToProductionStandardListDTO(e entity.ProductionStandard) ProductionStandardRelationDTO {
|
||||
var createdUser *userDTO.UserRelationDTO
|
||||
if e.CreatedUser.Id != 0 {
|
||||
mapped := userDTO.ToUserRelationDTO(e.CreatedUser)
|
||||
createdUser = &mapped
|
||||
}
|
||||
|
||||
return ProductionStandardListDTO{
|
||||
return ProductionStandardRelationDTO{
|
||||
Id: e.Id,
|
||||
Name: e.Name,
|
||||
ProjectCategory: e.ProjectCategory,
|
||||
@@ -59,8 +59,16 @@ func ToProductionStandardListDTO(e entity.ProductionStandard) ProductionStandard
|
||||
}
|
||||
}
|
||||
|
||||
func ToProductionStandardListDTOs(e []entity.ProductionStandard) []ProductionStandardListDTO {
|
||||
result := make([]ProductionStandardListDTO, len(e))
|
||||
func ToProductionStandardRelationDTO(e entity.ProductionStandard) ProductionStandardRelationDTO {
|
||||
return ProductionStandardRelationDTO{
|
||||
Id: e.Id,
|
||||
Name: e.Name,
|
||||
ProjectCategory: e.ProjectCategory,
|
||||
}
|
||||
}
|
||||
|
||||
func ToProductionStandardListDTOs(e []entity.ProductionStandard) []ProductionStandardRelationDTO {
|
||||
result := make([]ProductionStandardRelationDTO, len(e))
|
||||
for i, r := range e {
|
||||
result[i] = ToProductionStandardListDTO(r)
|
||||
}
|
||||
@@ -152,7 +160,7 @@ func ToProductionStandardDetailDTO(
|
||||
productionStandardDetails []entity.ProductionStandardDetail,
|
||||
) ProductionStandardDetailDTO {
|
||||
return ProductionStandardDetailDTO{
|
||||
ProductionStandardListDTO: ToProductionStandardListDTO(standard),
|
||||
ProductionStandardRelationDTO: ToProductionStandardRelationDTO(standard),
|
||||
Details: ToWeeklyProductionStandardDTOsWithDetails(growthDetails, productionStandardDetails),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user