feat (general-consent): add crud

This commit is contained in:
dpurbosakti
2025-11-17 16:20:14 +07:00
parent e78ad5aa83
commit 8073236d06
14 changed files with 819 additions and 2 deletions
@@ -0,0 +1,64 @@
package generalconsent
import (
ecore "simrs-vx/internal/domain/base-entities/core"
)
type CreateDto struct {
Encounter_Id *uint `json:"-"`
Value *string `json:"value"`
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Pagination ecore.Pagination
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter-id"`
}
type ReadDetailDto struct {
Id uint `json:"id"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Encounter_Id *uint `json:"encounter_id"`
Value *string `json:"value"`
FileUrl *string `json:"fileUrl"`
}
func (d GeneralConsent) ToResponse() ResponseDto {
resp := ResponseDto{
Encounter_Id: d.Encounter_Id,
Value: d.Value,
FileUrl: d.FileUrl,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []GeneralConsent) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -1,4 +1,4 @@
package general_consent
package generalconsent
import (
"simrs-vx/internal/domain/base-entities/core"
@@ -17,6 +17,7 @@ type (
CrudCode string
DataApprovalCode string
ProcessStatusCode string
DocFormatTypeCode string
)
const (
@@ -106,6 +107,11 @@ const (
PSCSuccess ProcessStatusCode = "success"
PSCFailed ProcessStatusCode = "failed"
DFTCPDF DocFormatTypeCode = "pdf"
DFTCTXLSX DocFormatTypeCode = "xlsx"
DFTCTCSV DocFormatTypeCode = "csv"
DFTCTXLS DocFormatTypeCode = "xls"
)
func GetDayCodes() map[DayCode]string {