Files
simrsx-be/internal/domain/main-entities/upload/dto.go
T
2025-11-12 09:03:56 +07:00

89 lines
2.7 KiB
Go

package upload
import (
"mime/multipart"
eru "simrs-vx/internal/domain/references/upload"
// internal - domain - base-entities
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
EntityType_Code eru.EntityTypeCode `form:"entityType_code"`
Ref_Id *uint `form:"ref_id"`
Type_Code eru.UploadCode `form:"type_code"`
Name string `form:"name"`
Upload_Employee_Id *uint `form:"upload_employee_id"`
FilePath string `json:"-"`
File multipart.File `json:"-"`
FileHeader *multipart.FileHeader `json:"-"`
Filename string `json:"filename"`
Size int64 `json:"-"`
MimeType string `json:"-"`
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Pagination ecore.Pagination
}
type FilterDto struct {
EntityType_Code eru.EntityTypeCode `json:"entityType-code"`
Ref_Id *uint `json:"ref-id"`
Type_Code eru.UploadCode `json:"type-code"`
Name string `json:"name"`
FilePath *string `json:"filePath"`
FileName *string `json:"fileName"`
Upload_Employee_Id *string `json:"encounter-document-employee-id"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Includes string `json:"includes"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
EntityType_Code eru.EntityTypeCode `json:"entityType_code"`
Ref_Id *uint `json:"ref_id"`
Type_Code eru.UploadCode `json:"type_code"`
Name string `json:"name"`
Upload_Employee_Id *uint `json:"upload_employee_id"`
FilePath string `json:"filePath"`
Filename string `json:"filename"`
FileHeader *multipart.FileHeader `json:"fileHeader"`
Size int64 `json:"size"`
MimeType string `json:"mimeType"`
}
func (d CreateDto) ToResponse() ResponseDto {
resp := ResponseDto{
EntityType_Code: d.EntityType_Code,
Ref_Id: d.Ref_Id,
Type_Code: d.Type_Code,
Name: d.Name,
Upload_Employee_Id: d.Upload_Employee_Id,
FilePath: d.FilePath,
Filename: d.Filename,
FileHeader: d.FileHeader,
Size: d.Size,
MimeType: d.MimeType,
}
return resp
}