add master data config checklist

This commit is contained in:
MacBook Air M1
2026-01-07 21:37:51 +07:00
parent c3f8ae5887
commit a4840fc98a
12 changed files with 537 additions and 13 deletions
@@ -0,0 +1,61 @@
package dto
import (
"time"
entity "gitlab.com/mbugroup/lti-api.git/internal/entities"
)
// === DTO Structs ===
type ConfigChecklistRelationDTO struct {
Id uint `json:"id"`
Date time.Time `json:"date"`
}
type ConfigChecklistListDTO struct {
Id uint `json:"id"`
Date time.Time `json:"date"`
PercentageThresholdBad int `json:"percentage_threshold_bad"`
PercentageThresholdEnough int `json:"percentage_threshold_enough"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type ConfigChecklistDetailDTO struct {
ConfigChecklistListDTO
}
// === Mapper Functions ===
func ToConfigChecklistRelationDTO(e entity.ConfigChecklist) ConfigChecklistRelationDTO {
return ConfigChecklistRelationDTO{
Id: e.Id,
Date: e.Date,
}
}
func ToConfigChecklistListDTO(e entity.ConfigChecklist) ConfigChecklistListDTO {
return ConfigChecklistListDTO{
Id: e.Id,
Date: e.Date,
PercentageThresholdBad: e.PercentageThresholdBad,
PercentageThresholdEnough: e.PercentageThresholdEnough,
CreatedAt: e.CreatedAt,
UpdatedAt: e.UpdatedAt,
}
}
func ToConfigChecklistListDTOs(e []entity.ConfigChecklist) []ConfigChecklistListDTO {
result := make([]ConfigChecklistListDTO, len(e))
for i, r := range e {
result[i] = ToConfigChecklistListDTO(r)
}
return result
}
func ToConfigChecklistDetailDTO(e entity.ConfigChecklist) ConfigChecklistDetailDTO {
return ConfigChecklistDetailDTO{
ConfigChecklistListDTO: ToConfigChecklistListDTO(e),
}
}