Merge branch 'migration' of https://github.com/dikstub-rssa/simrs-be into migration-vanilia
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
package mcusrccategory
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
rw "github.com/karincake/risoles"
|
||||
sf "github.com/karincake/semprit"
|
||||
|
||||
// ua "github.com/karincake/tumpeng/auth/svc"
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/mcu-src-category"
|
||||
u "simrs-vx/internal/use-case/main-use-case/mcu-src-category"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
|
||||
var O myBase
|
||||
|
||||
func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.CreateDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
res, err := u.Create(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
intId := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if intId <= 0 {
|
||||
return
|
||||
}
|
||||
id := uint16(intId)
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = &id
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
intId := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if intId <= 0 {
|
||||
return
|
||||
}
|
||||
id := uint16(intId)
|
||||
|
||||
dto := e.UpdateDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = &id
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
intId := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if intId <= 0 {
|
||||
return
|
||||
}
|
||||
id := uint16(intId)
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = &id
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package antibioticsrc
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
rw "github.com/karincake/risoles"
|
||||
sf "github.com/karincake/semprit"
|
||||
|
||||
// ua "github.com/karincake/tumpeng/auth/svc"
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/antibiotic-src"
|
||||
u "simrs-vx/internal/use-case/main-use-case/antibiotic-src"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
|
||||
var O myBase
|
||||
|
||||
func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.CreateDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
res, err := u.Create(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.UpdateDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint16(id)
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package controlplan
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
e "simrs-vx/internal/domain/bpjs-entities/control-plan"
|
||||
u "simrs-vx/internal/use-case/bpjs-use-case/control-plan"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
rw "github.com/karincake/risoles"
|
||||
)
|
||||
|
||||
func GetList(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue1 := rw.ValidateString(w, "controlType", r.PathValue("controlType"))
|
||||
if pValue1 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "controlType is required"}, nil)
|
||||
}
|
||||
pValue2 := rw.ValidateString(w, "polyCode", r.PathValue("polyCode"))
|
||||
if pValue2 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "polyCode is required"}, nil)
|
||||
}
|
||||
pValue3 := rw.ValidateString(w, "date", r.PathValue("date"))
|
||||
if pValue3 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "date is required"}, nil)
|
||||
}
|
||||
dto.PathValue1 = pValue1
|
||||
dto.PathValue2 = pValue2
|
||||
dto.PathValue3 = pValue3
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -64,12 +64,17 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
dto.Id = uint16(id)
|
||||
dto.Id = uint(id)
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
@@ -79,30 +84,40 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint16(id)
|
||||
dto.Id = uint(id)
|
||||
dto.AuthInfo = *authInfo
|
||||
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Id = uint(id)
|
||||
dto.AuthInfo = *authInfo
|
||||
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) CheckOut(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.DischargeDto{}
|
||||
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
@@ -118,12 +133,20 @@ func (obj myBase) CheckOut(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
dto.Id = uint(id)
|
||||
dto.AuthInfo = *authInfo
|
||||
|
||||
res, err := u.CheckOut(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) CheckIn(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.CheckinDto{}
|
||||
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
@@ -139,6 +162,8 @@ func (obj myBase) CheckIn(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
dto.Id = uint(id)
|
||||
dto.AuthInfo = *authInfo
|
||||
|
||||
res, err := u.CheckIn(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -149,9 +174,15 @@ func (obj myBase) Process(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
dto := e.UpdateStatusDto{
|
||||
Id: uint16(id),
|
||||
Id: uint(id),
|
||||
StatusCode: erc.DSCProcess,
|
||||
AuthInfo: *authInfo,
|
||||
}
|
||||
|
||||
res, err := u.UpdateStatusCode(dto)
|
||||
@@ -170,11 +201,11 @@ func (obj myBase) Cancel(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
dto := e.UpdateStatusDto{
|
||||
Id: uint16(id),
|
||||
Id: uint(id),
|
||||
StatusCode: erc.DSCCancel,
|
||||
AuthInfo: *authInfo,
|
||||
}
|
||||
|
||||
dto.AuthInfo = *authInfo
|
||||
res, err := u.UpdateStatusCode(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -186,7 +217,7 @@ func (obj myBase) Reject(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
dto := e.UpdateStatusDto{
|
||||
Id: uint16(id),
|
||||
Id: uint(id),
|
||||
StatusCode: erc.DSCRejected,
|
||||
}
|
||||
|
||||
@@ -201,7 +232,7 @@ func (obj myBase) Skip(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
dto := e.UpdateStatusDto{
|
||||
Id: uint16(id),
|
||||
Id: uint(id),
|
||||
StatusCode: erc.DSCSkipped,
|
||||
}
|
||||
|
||||
@@ -225,13 +256,19 @@ func (obj myBase) RequestSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
dto.AuthInfo = *authInfo
|
||||
dto.Id = uint(id)
|
||||
res, err := u.RequestSwitchUnit(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) ApproveSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ApproveUnitDto{}
|
||||
dto := e.ApproveCancelUnitDto{}
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
@@ -241,7 +278,37 @@ func (obj myBase) ApproveSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
dto.AuthInfo = *authInfo
|
||||
dto.Id = uint(id)
|
||||
|
||||
res, err := u.ApproveSwitchUnit(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) CancelSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ApproveCancelUnitDto{}
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
dto.AuthInfo = *authInfo
|
||||
dto.Id = uint(id)
|
||||
|
||||
res, err := u.CancelSwitchUnit(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -59,6 +59,22 @@ func validateRequestCheckIn(w http.ResponseWriter, i e.CheckinDto) (valid bool)
|
||||
}
|
||||
|
||||
func validateRequestSwitchUnit(w http.ResponseWriter, i e.SwitchUnitDto) (valid bool) {
|
||||
// validate poly-switch-code
|
||||
if i.PolySwitchCode == nil {
|
||||
rw.DataResponse(w, nil, d.FieldError{
|
||||
Code: dataValidationFail,
|
||||
Message: fmt.Sprintf("polySwitchCode required"),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if *i.PolySwitchCode != ere.PSCConsulPoly && *i.PolySwitchCode != ere.PSCConsulExecutive {
|
||||
rw.DataResponse(w, nil, d.FieldError{
|
||||
Code: dataValidationFail,
|
||||
Message: "invalid PolySwitchCode",
|
||||
})
|
||||
}
|
||||
|
||||
if i.InternalReferences == nil {
|
||||
rw.DataResponse(w, nil, d.FieldError{
|
||||
Code: dataValidationFail,
|
||||
|
||||
@@ -39,7 +39,7 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
dto := eir.ReadDetailDto{}
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
dto.Id = uint16(id)
|
||||
dto.Id = uint(id)
|
||||
res, err := uir.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -54,7 +54,7 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint16(id)
|
||||
dto.Id = uint(id)
|
||||
res, err := uir.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -66,7 +66,7 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
dto := eir.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Id = uint(id)
|
||||
res, err := uir.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import (
|
||||
prescription "simrs-vx/internal/interface/main-handler/prescription"
|
||||
prescriptionitem "simrs-vx/internal/interface/main-handler/prescription-item"
|
||||
responsibledoctorhist "simrs-vx/internal/interface/main-handler/responsible-doctor-hist"
|
||||
resume "simrs-vx/internal/interface/main-handler/resume"
|
||||
sbar "simrs-vx/internal/interface/main-handler/sbar"
|
||||
soapi "simrs-vx/internal/interface/main-handler/soapi"
|
||||
uploadfile "simrs-vx/internal/interface/main-handler/upload-file"
|
||||
@@ -74,6 +75,8 @@ import (
|
||||
zlc "simrs-vx/pkg/zerolog-ctx"
|
||||
|
||||
/******************** sources ********************/
|
||||
antibioticsrc "simrs-vx/internal/interface/main-handler/antibiotic-src"
|
||||
antibioticsrccat "simrs-vx/internal/interface/main-handler/antibiotic-src-category"
|
||||
device "simrs-vx/internal/interface/main-handler/device"
|
||||
diagnosesrc "simrs-vx/internal/interface/main-handler/diagnose-src"
|
||||
division "simrs-vx/internal/interface/main-handler/division"
|
||||
@@ -117,9 +120,19 @@ import (
|
||||
regency "simrs-vx/internal/interface/main-handler/regency"
|
||||
village "simrs-vx/internal/interface/main-handler/village"
|
||||
|
||||
///// Internal
|
||||
/******************** Internal ********************/
|
||||
validation "simrs-vx/internal/interface/main-handler/helper/validation"
|
||||
"simrs-vx/internal/interface/main-handler/home"
|
||||
|
||||
/******************** BPJS ********************/
|
||||
controlplan "simrs-vx/internal/interface/main-handler/control-plan"
|
||||
member "simrs-vx/internal/interface/main-handler/member"
|
||||
monitoring "simrs-vx/internal/interface/main-handler/monitoring"
|
||||
reference "simrs-vx/internal/interface/main-handler/reference"
|
||||
referral "simrs-vx/internal/interface/main-handler/referral"
|
||||
vclaimsep "simrs-vx/internal/interface/main-handler/vclaim-sep"
|
||||
vclaimsephist "simrs-vx/internal/interface/main-handler/vclaim-sep-hist"
|
||||
vclaimsepprint "simrs-vx/internal/interface/main-handler/vclaim-sep-print"
|
||||
)
|
||||
|
||||
// One place route to relatively easier to manage, ESPECIALLY in tracking
|
||||
@@ -135,6 +148,7 @@ func SetRoutes() http.Handler {
|
||||
a.RegisterExtCall(validation.RegisterValidation)
|
||||
a.RegisterExtCall(simgossync.SetConfig)
|
||||
a.RegisterExtCall(docscfg.ParseCfg)
|
||||
a.RegisterExtCall(ibpjs.SetConfig)
|
||||
|
||||
r := http.NewServeMux()
|
||||
|
||||
@@ -150,11 +164,14 @@ func SetRoutes() http.Handler {
|
||||
hc.RegCrudByCode(r, "/v1/medicine-form", medicineform.O)
|
||||
hc.RegCrud(r, "/v1/medicine-mix", medicicinemix.O)
|
||||
hc.RegCrud(r, "/v1/medicine-mix-item", medicicinemixitem.O)
|
||||
hc.RegCrud(r, "/v1/antibiotic-src-category", antibioticsrccat.O)
|
||||
hc.RegCrud(r, "/v1/antibiotic-src", antibioticsrc.O)
|
||||
hc.RegCrud(r, "/v1/soapi", auth.GuardMW, soapi.O)
|
||||
hc.RegCrud(r, "/v1/adime", auth.GuardMW, adime.O)
|
||||
hc.RegCrud(r, "/v1/sbar", auth.GuardMW, sbar.O)
|
||||
hc.RegCrud(r, "/v1/prescription-item", prescriptionitem.O)
|
||||
hc.RegCrud(r, "/v1/device-order-item", deviceorderitem.O)
|
||||
|
||||
hc.RegCrud(r, "/v1/material-order-item", materialorderitem.O)
|
||||
hk.GroupRoutes("/v1/encounter", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"GET /": encounter.O.GetList,
|
||||
@@ -170,6 +187,7 @@ func SetRoutes() http.Handler {
|
||||
"PATCH /{id}/skip": encounter.O.Skip,
|
||||
"PATCH /{id}/req-switch-unit": encounter.O.RequestSwitchUnit,
|
||||
"PATCH /{id}/approve-switch-unit": encounter.O.ApproveSwitchUnit,
|
||||
"PATCH /{id}/cancel-switch-unit": encounter.O.CancelSwitchUnit,
|
||||
})
|
||||
hk.GroupRoutes("/v1/mcu-order", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"GET /": mcuorder.O.GetList,
|
||||
@@ -177,6 +195,7 @@ func SetRoutes() http.Handler {
|
||||
"POST /": mcuorder.O.Create,
|
||||
"PATCH /{id}": mcuorder.O.Update,
|
||||
"DELETE /{id}": mcuorder.O.Delete,
|
||||
"PATCH /{id}/submit": mcuorder.O.Submit,
|
||||
"PATCH /{id}/complete": mcuorder.O.Complete,
|
||||
"PATCH /{id}/set-schedule": mcuorder.O.SetSchedule,
|
||||
})
|
||||
@@ -282,6 +301,15 @@ func SetRoutes() http.Handler {
|
||||
hc.RegCrud(r, "/v1/encounter-document", encounterdocument.O)
|
||||
hc.RegCrud(r, "/v1/general-consent", generalconsent.O)
|
||||
r.HandleFunc("POST /v1/generate-file", generatefile.Generate)
|
||||
hk.GroupRoutes("/v1/resume", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"POST /": resume.Create,
|
||||
"GET /": resume.GetList,
|
||||
"GET /{id}": resume.GetDetail,
|
||||
"PATCH /{id}": resume.Update,
|
||||
"DELETE /{id}": resume.Delete,
|
||||
"PATCH /{id}/verify": resume.Verify,
|
||||
"PATCH /{id}/validate": resume.Validate,
|
||||
})
|
||||
|
||||
/******************** actor ********************/
|
||||
hc.RegCrud(r, "/v1/person", person.O)
|
||||
@@ -303,7 +331,7 @@ func SetRoutes() http.Handler {
|
||||
"PATCH /{id}/active": user.O.Active,
|
||||
})
|
||||
hc.RegCrud(r, "/v1/user-fes", userfes.O)
|
||||
hk.GroupRoutes("/v1/patient", r, hk.MapHandlerFunc{
|
||||
hk.GroupRoutes("/v1/patient", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"GET /": patient.O.GetList,
|
||||
"GET /{id}": patient.O.GetDetail,
|
||||
"POST /": patient.O.Create,
|
||||
@@ -355,6 +383,51 @@ func SetRoutes() http.Handler {
|
||||
hc.RegCrudByCode(r, "/v1/province", province.O)
|
||||
hc.RegCrudByCode(r, "/v1/postal-region", postalregion.O)
|
||||
|
||||
/******************** BPJS ********************/
|
||||
hk.GroupRoutes("/v1/vclaim-sep", r, hk.MapHandlerFunc{
|
||||
"POST /": vclaimsep.O.Create,
|
||||
"GET /{number}": vclaimsep.O.GetDetail,
|
||||
"DELETE /{number}": vclaimsep.O.Delete,
|
||||
})
|
||||
|
||||
hk.GroupRoutes("/v1/vclaim-sep-hist", r, hk.MapHandlerFunc{
|
||||
"GET /": vclaimsephist.O.GetList,
|
||||
})
|
||||
|
||||
hk.GroupRoutes("/v1/vclaim-sep-print", r, hk.MapHandlerFunc{
|
||||
"POST /": vclaimsepprint.O.Create,
|
||||
})
|
||||
|
||||
hk.GroupRoutes("/v1/reference", r, hk.MapHandlerFunc{
|
||||
"GET /province": reference.GetListProvince,
|
||||
"GET /regency/{provinceCode}": reference.GetListCities,
|
||||
"GET /district/{regencyCode}": reference.GetListDistrict,
|
||||
"GET /diagnose/{keyword}": reference.GetListDiagnose,
|
||||
"GET /diagnose-prb": reference.GetListDiagnosePrb,
|
||||
"GET /medicine-prb/{keyword}": reference.GetListMedicinePrb,
|
||||
"GET /unit/{unitCode}": reference.GetListUnit,
|
||||
"GET /healthcare/{healthcare}/{healthcareType}": reference.GetListHealthcare,
|
||||
"GET /responsible-doctor/{serviceType}/{serviceDate}/{specialistCode}": reference.GetListDoctor,
|
||||
})
|
||||
|
||||
hk.GroupRoutes("/v1/member", r, hk.MapHandlerFunc{
|
||||
"GET /bpjs/{cardNumber}/{sepDate}": member.GetListByBpjsNumber,
|
||||
"GET /nik/{nik}/{sepDate}": member.GetListByNik,
|
||||
})
|
||||
|
||||
hk.GroupRoutes("/v1/monitoring", r, hk.MapHandlerFunc{
|
||||
"GET /visit/{date}/{serviceType}": monitoring.GetListVisit,
|
||||
"GET /hist/{cardNumber}/{startDate}/{endDate}": monitoring.GetListHist,
|
||||
})
|
||||
|
||||
hk.GroupRoutes("/v1/control-plan", r, hk.MapHandlerFunc{
|
||||
"GET /{controlType}/{polyCode}/{date}": controlplan.GetList,
|
||||
})
|
||||
|
||||
hk.GroupRoutes("/v1/referral", r, hk.MapHandlerFunc{
|
||||
"GET /{number}": referral.GetList,
|
||||
})
|
||||
|
||||
/////
|
||||
return cmw.SetCors(handlerlogger.SetLog(r))
|
||||
}
|
||||
|
||||
@@ -85,6 +85,18 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Submit(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint(id)
|
||||
res, err := u.Submit(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Complete(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package member
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
e "simrs-vx/internal/domain/bpjs-entities/member"
|
||||
u "simrs-vx/internal/use-case/bpjs-use-case/member"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
rw "github.com/karincake/risoles"
|
||||
)
|
||||
|
||||
func GetListByBpjsNumber(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue1 := rw.ValidateString(w, "cardNumber", r.PathValue("cardNumber"))
|
||||
if pValue1 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "cardNumber is required"}, nil)
|
||||
}
|
||||
pValue2 := rw.ValidateString(w, "sepDate", r.PathValue("sepDate"))
|
||||
if pValue2 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "sepDate is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTBpjs
|
||||
dto.PathValue1 = pValue1
|
||||
dto.PathValue2 = pValue2
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func GetListByNik(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue1 := rw.ValidateString(w, "nik", r.PathValue("nik"))
|
||||
if pValue1 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "nik is required"}, nil)
|
||||
}
|
||||
pValue2 := rw.ValidateString(w, "sepDate", r.PathValue("sepDate"))
|
||||
if pValue2 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "sepDate is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTNik
|
||||
dto.PathValue1 = pValue1
|
||||
dto.PathValue2 = pValue2
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package monitoring
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
e "simrs-vx/internal/domain/bpjs-entities/monitoring"
|
||||
u "simrs-vx/internal/use-case/bpjs-use-case/monitoring"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
rw "github.com/karincake/risoles"
|
||||
)
|
||||
|
||||
func GetListVisit(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue1 := rw.ValidateString(w, "date", r.PathValue("date"))
|
||||
if pValue1 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "date is required"}, nil)
|
||||
}
|
||||
pValue2 := rw.ValidateString(w, "serviceType", r.PathValue("serviceType"))
|
||||
if pValue2 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "serviceType is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTVisit
|
||||
dto.PathValue1 = pValue1
|
||||
dto.PathValue2 = pValue2
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func GetListHist(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue1 := rw.ValidateString(w, "cardNumber", r.PathValue("cardNumber"))
|
||||
if pValue1 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "cardNumber is required"}, nil)
|
||||
}
|
||||
pValue2 := rw.ValidateString(w, "startDate", r.PathValue("startDate"))
|
||||
if pValue2 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "startDate is required"}, nil)
|
||||
}
|
||||
pValue3 := rw.ValidateString(w, "endDate", r.PathValue("endDate"))
|
||||
if pValue3 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "endDate is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTHist
|
||||
dto.PathValue1 = pValue1
|
||||
dto.PathValue2 = pValue2
|
||||
dto.PathValue3 = pValue3
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package patient
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
rw "github.com/karincake/risoles"
|
||||
sf "github.com/karincake/semprit"
|
||||
@@ -19,10 +20,17 @@ type myBase struct{}
|
||||
var O myBase
|
||||
|
||||
func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
dto := e.CreateDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
dto.AuthInfo = *authInfo
|
||||
res, err := u.Create(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
package reference
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
e "simrs-vx/internal/domain/bpjs-entities/reference"
|
||||
u "simrs-vx/internal/use-case/bpjs-use-case/reference"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
rw "github.com/karincake/risoles"
|
||||
)
|
||||
|
||||
func GetListProvince(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
dto.ReferenceType = e.RTProvince
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func GetListCities(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue := rw.ValidateString(w, "provinceCode", r.PathValue("provinceCode"))
|
||||
if pValue == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "provinceCode is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTCities
|
||||
dto.PathValue1 = pValue
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func GetListDistrict(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue := rw.ValidateString(w, "regencyCode", r.PathValue("regencyCode"))
|
||||
if pValue == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "regencyCode is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTDistrict
|
||||
dto.PathValue1 = pValue
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func GetListDiagnose(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue := rw.ValidateString(w, "keyword", r.PathValue("keyword"))
|
||||
if pValue == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "keyword is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTDiagnose
|
||||
dto.PathValue1 = pValue
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func GetListDiagnosePrb(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
dto.ReferenceType = e.RTDiagnosePrb
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func GetListMedicinePrb(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue := rw.ValidateString(w, "keyword", r.PathValue("keyword"))
|
||||
if pValue == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "keyword is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTMedicinePrb
|
||||
dto.PathValue1 = pValue
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func GetListUnit(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue := rw.ValidateString(w, "unitCode", r.PathValue("unitCode"))
|
||||
if pValue == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "unitCode is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTUnit
|
||||
dto.PathValue1 = pValue
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func GetListHealthcare(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue1 := rw.ValidateString(w, "healthcare", r.PathValue("healthcare"))
|
||||
if pValue1 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "healthcare is required"}, nil)
|
||||
}
|
||||
pValue2 := rw.ValidateString(w, "healthcareType", r.PathValue("healthcareType"))
|
||||
if pValue2 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "healthcareType is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTHealthcare
|
||||
dto.PathValue1 = pValue1
|
||||
dto.PathValue2 = pValue2
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func GetListDoctor(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue1 := rw.ValidateString(w, "serviceType", r.PathValue("serviceType"))
|
||||
if pValue1 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "serviceType is required"}, nil)
|
||||
}
|
||||
pValue2 := rw.ValidateString(w, "serviceDate", r.PathValue("serviceDate"))
|
||||
if pValue2 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "serviceDate is required"}, nil)
|
||||
}
|
||||
pValue3 := rw.ValidateString(w, "specialistCode", r.PathValue("specialistCode"))
|
||||
if pValue3 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "specialistCode is required"}, nil)
|
||||
}
|
||||
dto.PathValue1 = pValue1
|
||||
dto.PathValue2 = pValue2
|
||||
dto.PathValue3 = pValue3
|
||||
dto.ReferenceType = e.RTDoctor
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package referral
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
e "simrs-vx/internal/domain/bpjs-entities/referral"
|
||||
u "simrs-vx/internal/use-case/bpjs-use-case/referral"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
rw "github.com/karincake/risoles"
|
||||
)
|
||||
|
||||
func GetList(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadDetailDto{}
|
||||
number := rw.ValidateString(w, "number", r.PathValue("number"))
|
||||
if number == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "number is required"}, nil)
|
||||
}
|
||||
dto.Number = &number
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package resume
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
rw "github.com/karincake/risoles"
|
||||
sf "github.com/karincake/semprit"
|
||||
|
||||
// ua "github.com/karincake/tumpeng/auth/svc"
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/resume"
|
||||
u "simrs-vx/internal/use-case/main-use-case/resume"
|
||||
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
)
|
||||
|
||||
func Create(w http.ResponseWriter, r *http.Request) {
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
dto := e.CreateDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
dto.AuthInfo = *authInfo
|
||||
res, err := u.Create(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func GetList(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
dto.Id = uint(id)
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func Update(w http.ResponseWriter, r *http.Request) {
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.UpdateDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint(id)
|
||||
dto.AuthInfo = *authInfo
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func Delete(w http.ResponseWriter, r *http.Request) {
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint(id)
|
||||
dto.AuthInfo = *authInfo
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func Verify(w http.ResponseWriter, r *http.Request) {
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.UpdateDto{}
|
||||
dto.Id = uint(id)
|
||||
dto.Status_Code = erc.DVCVerified
|
||||
dto.AuthInfo = *authInfo
|
||||
res, err := u.UpdateStatusCode(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func Validate(w http.ResponseWriter, r *http.Request) {
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.UpdateDto{}
|
||||
dto.Id = uint(id)
|
||||
dto.Status_Code = erc.DVCValidated
|
||||
dto.AuthInfo = *authInfo
|
||||
res, err := u.UpdateStatusCode(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package vclaimsephist
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
e "simrs-vx/internal/domain/bpjs-entities/vclaim-sep-hist"
|
||||
u "simrs-vx/internal/use-case/bpjs-use-case/vclaim-sep-hist"
|
||||
|
||||
rw "github.com/karincake/risoles"
|
||||
sf "github.com/karincake/semprit"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
|
||||
var O myBase
|
||||
|
||||
func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package vclaimsepprint
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
e "simrs-vx/internal/domain/bpjs-entities/vclaim-sep-print"
|
||||
u "simrs-vx/internal/use-case/bpjs-use-case/vclaim-sep-print"
|
||||
|
||||
rw "github.com/karincake/risoles"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
|
||||
var O myBase
|
||||
|
||||
func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.CreateDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
res, err := u.Create(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package vclaimsep
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
rw "github.com/karincake/risoles"
|
||||
|
||||
e "simrs-vx/internal/domain/bpjs-entities/vclaim-sep"
|
||||
u "simrs-vx/internal/use-case/bpjs-use-case/vclaim-sep"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
|
||||
var O myBase
|
||||
|
||||
func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.CreateDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
res, err := u.Create(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
// func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
// dto := e.ReadListDto{}
|
||||
// sf.UrlQueryParam(&dto, *r.URL)
|
||||
// res, err := u.ReadList(dto)
|
||||
// rw.DataResponse(w, res, err)
|
||||
// }
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
number := rw.ValidateString(w, "number", r.PathValue("number"))
|
||||
if number <= "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Number = &number
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
// func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
// number := rw.ValidateString(w, "number", r.PathValue("number"))
|
||||
// if number != "" {
|
||||
// return
|
||||
// }
|
||||
|
||||
// dto := e.UpdateDto{}
|
||||
// if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
// return
|
||||
// }
|
||||
// dto.Number = &number
|
||||
// res, err := u.Update(dto)
|
||||
// rw.DataResponse(w, res, err)
|
||||
// }
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint(id)
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
Reference in New Issue
Block a user