seed complete

This commit is contained in:
vanilia
2025-12-12 07:47:28 +07:00
parent 125c43bc66
commit 158e57f6f2
3 changed files with 9 additions and 8 deletions
@@ -7,10 +7,10 @@ import (
)
type CreateDto struct {
Id *uint `json:"id"`
Installation_Code string `json:"installation_code"`
Code string `json:"code" validate:"maxLength=10"`
Name string `json:"name" validate:"maxLength=50"`
Id *uint `json:"id"`
Installation_Code *string `json:"installation_code"`
Code string `json:"code" validate:"maxLength=10"`
Name string `json:"name" validate:"maxLength=50"`
}
type ReadListDto struct {
@@ -25,8 +25,9 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Specialist) {
func setBulkData(input []e.CreateDto) (data []e.Specialist) {
for _, i := range input {
data = append(data, e.Specialist{
Code: i.Code,
Name: i.Name,
Code: i.Code,
Name: i.Name,
Installation_Code: i.Installation_Code,
})
}
@@ -36,10 +36,10 @@ func SeedSpecialist(event *pl.Event, tx *db.Dualtx) error {
speCode := strconv.Itoa(int(v.No))
var insCode string
var insCode *string
if v.KdUnit != 0 {
code := strconv.Itoa(v.KdUnit)
insCode = code
insCode = &code
}
speData = append(speData, es.CreateDto{