87 lines
2.0 KiB
Go
87 lines
2.0 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 patient
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
|
|
e "simrs-vx/internal/domain/main-entities/patient"
|
|
elog "simrs-vx/internal/domain/sync-entities/log"
|
|
)
|
|
|
|
type createMw struct {
|
|
Name string
|
|
Func func(input *e.CreateDto, data *e.Patient, tx *gorm.DB) error
|
|
}
|
|
|
|
type createSyncMw struct {
|
|
Name string
|
|
Func func(input *e.Patient) error
|
|
}
|
|
|
|
type createLogMw struct {
|
|
Name string
|
|
Func func(input *elog.SimxLogDto) error
|
|
}
|
|
|
|
type updateMw struct {
|
|
Name string
|
|
Func func(input *e.Patient) error
|
|
}
|
|
|
|
type deleteMw struct {
|
|
Name string
|
|
Func func(input *e.DeleteDto) error
|
|
}
|
|
|
|
type readListMw struct {
|
|
Name string
|
|
Func func(input *e.ReadListDto, data *e.Patient, tx *gorm.DB) error
|
|
}
|
|
|
|
type readDetailMw struct {
|
|
Name string
|
|
Func func(input *e.ReadDetailDto, data *e.Patient, tx *gorm.DB) error
|
|
}
|
|
|
|
type generateNumberMw struct {
|
|
Name string
|
|
Func func() (*string, error)
|
|
}
|
|
|
|
type UpdateMw = updateMw
|
|
type DeleteMw = deleteMw
|
|
|
|
var createPreMw []createMw // preprocess middleware
|
|
var createPostMw []createMw // postprocess middleware
|
|
var createSimxSyncMw []createSyncMw // postprocess middleware
|
|
var createSimxLogMw []createLogMw
|
|
var readListPreMw []readListMw // ..
|
|
var readListPostMw []readListMw // ..
|
|
var readDetailPreMw []readDetailMw
|
|
var readDetailPostMw []readDetailMw
|
|
var updatePreMw []updateMw
|
|
var updatePostMw []readDetailMw
|
|
var deletePreMw []deleteMw
|
|
var deletePostMw []readDetailMw
|
|
var generatePatientNumber generateNumberMw
|
|
|
|
type BPJSResponse struct {
|
|
MetaData struct {
|
|
Code string `json:"code"`
|
|
Message string `json:"message"`
|
|
} `json:"metaData"`
|
|
Response *struct {
|
|
Peserta struct {
|
|
NoKartu string `json:"noKartu"`
|
|
NIK string `json:"nik"`
|
|
} `json:"peserta"`
|
|
} `json:"response"`
|
|
}
|