refactor (upload-file)
This commit is contained in:
No files matched your search
@@ -1,7 +1,7 @@
|
||||
package encounter_document
|
||||
|
||||
import (
|
||||
eru "simrs-vx/internal/domain/references/upload"
|
||||
ere "simrs-vx/internal/domain/references/encounter"
|
||||
// internal - domain - base-entities
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
type CreateDto struct {
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Type_Code eru.DocTypeCode `json:"type_code"`
|
||||
Type_Code ere.DocTypeCode `json:"type_code"`
|
||||
Name string `json:"name"`
|
||||
FilePath string `json:"filePath"`
|
||||
Filename string `json:"-"`
|
||||
@@ -25,7 +25,7 @@ type ReadListDto struct {
|
||||
|
||||
type FilterDto struct {
|
||||
Encounter_Id *uint `json:"encounter-id"`
|
||||
Type_Code eru.DocTypeCode `json:"type-code"`
|
||||
Type_Code ere.DocTypeCode `json:"type-code"`
|
||||
Upload_Employee_Id *string `json:"encounter-document-employee-id"`
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ type MetaDto struct {
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Type_Code eru.DocTypeCode `json:"type_code"`
|
||||
Type_Code ere.DocTypeCode `json:"type_code"`
|
||||
Name string `json:"name"`
|
||||
FilePath *string `json:"filePath"`
|
||||
FileName *string `json:"fileName"`
|
||||
|
||||
@@ -3,13 +3,13 @@ package encounter_document
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
eru "simrs-vx/internal/domain/references/upload"
|
||||
ere "simrs-vx/internal/domain/references/encounter"
|
||||
)
|
||||
|
||||
type EncounterDocument struct {
|
||||
ecore.Main
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Type_Code eru.DocTypeCode `json:"type_code"`
|
||||
Type_Code ere.DocTypeCode `json:"type_code"`
|
||||
Name string `json:"name"`
|
||||
FilePath *string `json:"filePath"`
|
||||
FileName *string `json:"fileName"`
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
epr "simrs-vx/internal/domain/main-entities/person-relative"
|
||||
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
eru "simrs-vx/internal/domain/references/upload"
|
||||
ere "simrs-vx/internal/domain/references/encounter"
|
||||
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
)
|
||||
@@ -68,7 +68,7 @@ type SearchDto struct {
|
||||
|
||||
type UploadDto struct {
|
||||
Id uint `json:"-"`
|
||||
Code eru.DocTypeCode `json:"-"`
|
||||
Code ere.DocTypeCode `json:"-"`
|
||||
File multipart.File `json:"-"`
|
||||
FileHeader *multipart.FileHeader `json:"-"`
|
||||
Filename string `json:"-"`
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
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.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 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.DocTypeCode `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.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
|
||||
}
|
||||
Reference in New Issue
Block a user