59 lines
2.1 KiB
Go
59 lines
2.1 KiB
Go
/*
|
|
DESCRIPTION:
|
|
A sample, part of the package that contains type, constants, and/or variables.
|
|
|
|
In this sample it also provides type and variable regarding the needs of the
|
|
middleware to separate from main use-case which has the basic CRUD
|
|
functionality. The purpose of this is to make the code more maintainable.
|
|
*/
|
|
package uploadfile
|
|
|
|
import (
|
|
"mime/multipart"
|
|
ere "simrs-vx/internal/domain/references/encounter"
|
|
)
|
|
|
|
type CreateDto struct {
|
|
EntityType_Code ere.EntityTypeCode `form:"entityType_code"`
|
|
Ref_Id *uint `form:"ref_id"`
|
|
Type_Code ere.DocTypeCode `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 ResponseDto struct {
|
|
EntityType_Code ere.EntityTypeCode `json:"entityType_code"`
|
|
Ref_Id *uint `json:"ref_id"`
|
|
Type_Code ere.DocTypeCode `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
|
|
}
|