mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-24 07:15:43 +00:00
add master data config checklist
This commit is contained in:
@@ -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),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user