package installation_position import ( ecore "simrs-vx/internal/domain/base-entities/core" ee "simrs-vx/internal/domain/main-entities/employee" ei "simrs-vx/internal/domain/main-entities/installation" ) type CreateDto struct { Installation_Code *string `json:"installation_code" validate:"required"` Code string `json:"code" validate:"maxLength=10;required"` Name string `json:"name" validate:"maxLength=30;required"` HeadStatus bool `json:"headStatus"` Employee_Id *uint `json:"employee_id"` } type ReadListDto struct { FilterDto Includes string `json:"includes"` Sort string `json:"sort"` Pagination ecore.Pagination } type FilterDto struct { Installation_Code *string `json:"installation-code"` Code string `json:"code"` Name string `json:"name"` HeadStatus *bool `json:"head-status"` Employee_Id *uint `json:"employee-id"` Search string `json:"search" gormhelper:"searchColumns=Code,Name"` } type ReadDetailDto struct { Id *uint16 `json:"id"` Code *string `json:"code"` } type UpdateDto struct { Id *uint16 `json:"id"` CreateDto } type DeleteDto struct { Id *uint16 `json:"id"` Code *string `json:"code"` } type MetaDto struct { PageNumber int `json:"page_number"` PageSize int `json:"page_size"` Count int `json:"count"` } type ResponseDto struct { ecore.SmallMain Installation_Code *string `json:"installation_code"` Installation *ei.Installation `json:"installation,omitempty"` Code string `json:"code"` Name string `json:"name"` HeadStatus bool `json:"headStatus"` Employee_Id *uint `json:"employee_id"` Employee *ee.Employee `json:"employee,omitempty"` } func (d InstallationPosition) ToResponse() ResponseDto { resp := ResponseDto{ Installation_Code: d.Installation_Code, Installation: d.Installation, Code: d.Code, Name: d.Name, HeadStatus: d.HeadStatus, Employee_Id: d.Employee_Id, Employee: d.Employee, } resp.SmallMain = d.SmallMain return resp } func ToResponseList(data []InstallationPosition) []ResponseDto { resp := make([]ResponseDto, len(data)) for i, u := range data { resp[i] = u.ToResponse() } return resp }