Merge branch 'migration-vanilia' of https://github.com/dikstub-rssa/simrs-be into feat/sync-source

This commit is contained in:
vanilia
2025-11-17 11:19:11 +07:00
29 changed files with 496 additions and 117 deletions
@@ -152,7 +152,6 @@ func SetRoutes() http.Handler {
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,
"GET /{id}": encounter.O.GetDetail,
@@ -211,7 +210,6 @@ func SetRoutes() http.Handler {
"DELETE /{id}": medication.O.Delete,
"PATCH /{id}/complete": medication.O.Complete,
})
hk.GroupRoutes("/v1/medication-item", r, auth.GuardMW, hk.MapHandlerFunc{
"GET /": medicationitem.O.GetList,
"GET /{id}": medicationitem.O.GetDetail,
@@ -220,7 +218,6 @@ func SetRoutes() http.Handler {
"DELETE /{id}": medicationitem.O.Delete,
"PATCH /{id}/redeem": medicationitem.O.Redeem,
})
hk.GroupRoutes("/v1/medication-item-dist", r, auth.GuardMW, hk.MapHandlerFunc{
"GET /": medicationitemdist.O.GetList,
"GET /{id}": medicationitemdist.O.GetDetail,
@@ -229,7 +226,6 @@ func SetRoutes() http.Handler {
"DELETE /{id}": medicationitemdist.O.Delete,
"PATCH /{id}/consume": medicationitemdist.O.Consume,
})
hk.GroupRoutes("/v1/device-order", r, auth.GuardMW, hk.MapHandlerFunc{
"GET /": deviceorder.O.GetList,
"GET /{id}": deviceorder.O.GetDetail,
@@ -238,7 +234,6 @@ func SetRoutes() http.Handler {
"DELETE /{id}": deviceorder.O.Delete,
"PATCH /{id}/complete": deviceorder.O.Complete,
})
hk.GroupRoutes("/v1/material-order", r, auth.GuardMW, hk.MapHandlerFunc{
"GET /": materialorder.O.GetList,
"GET /{id}": materialorder.O.GetDetail,
@@ -247,7 +242,6 @@ func SetRoutes() http.Handler {
"DELETE /{id}": materialorder.O.Delete,
"PATCH /{id}/complete": materialorder.O.Complete,
})
hk.GroupRoutes("/v1/consultation", r, auth.GuardMW, hk.MapHandlerFunc{
"GET /": consultation.O.GetList,
"GET /{id}": consultation.O.GetDetail,
@@ -256,7 +250,6 @@ func SetRoutes() http.Handler {
"DELETE /{id}": consultation.O.Delete,
"PATCH /{id}/reply": consultation.O.Reply,
})
hk.GroupRoutes("/v1/chemo", r, auth.GuardMW, hk.MapHandlerFunc{
"GET /": chemo.O.GetList,
"GET /{id}": chemo.O.GetDetail,
@@ -266,13 +259,20 @@ func SetRoutes() http.Handler {
"PATCH /{id}/verify": chemo.O.Verify,
"PATCH /{id}/reject": chemo.O.Reject,
})
hc.RegCrud(r, "/v1/control-letter", controlletter.O)
hc.RegCrud(r, "/v1/internal-reference", internalreference.O)
hc.RegCrud(r, "/v1/ambulance-transport-req", ambulancetransportrequest.O)
hc.RegCrud(r, "/v1/responsible-doctor-hist", responsibledoctorhist.O)
hc.RegCrud(r, "/v1/adm-employee-hist", admemployeehist.O)
hc.RegCrud(r, "/v1/therapy-protocol", therapyprotocol.O)
hk.GroupRoutes("/v1/therapy-protocol", r, auth.GuardMW, hk.MapHandlerFunc{
"GET /": therapyprotocol.O.GetList,
"GET /{id}": therapyprotocol.O.GetDetail,
"POST /": therapyprotocol.O.Create,
"PATCH /{id}": therapyprotocol.O.Update,
"DELETE /{id}": therapyprotocol.O.Delete,
"PATCH /{id}/verify": therapyprotocol.O.Verify,
"PATCH /{id}/reject": therapyprotocol.O.Reject,
})
hc.RegCrud(r, "/v1/chemo-protocol", chemoprotocol.O)
hc.RegCrud(r, "/v1/upload", upload.O)
hc.RegCrud(r, "/v1/encounter-document", encounterdocument.O)
@@ -297,7 +297,6 @@ 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{
"GET /": patient.O.GetList,
"GET /{id}": patient.O.GetDetail,
@@ -46,6 +46,7 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
return
}
dto := e.ReadDetailDto{}
sf.UrlQueryParam(&dto, *r.URL)
dto.Id = uint(id)
res, err := u.ReadDetail(dto)
rw.DataResponse(w, res, err)
@@ -9,7 +9,12 @@ import (
// ua "github.com/karincake/tumpeng/auth/svc"
e "simrs-vx/internal/domain/main-entities/therapy-protocol"
erc "simrs-vx/internal/domain/references/common"
u "simrs-vx/internal/use-case/main-use-case/therapy-protocol"
d "github.com/karincake/dodol"
pa "simrs-vx/internal/lib/auth"
)
type myBase struct{}
@@ -71,3 +76,44 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
res, err := u.Delete(dto)
rw.DataResponse(w, res, err)
}
func (obj myBase) Verify(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id"))
if id <= 0 {
return
}
dto := e.VerifyDto{}
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return
}
dto.Id = uint(id)
authInfo, err := pa.GetAuthInfo(r)
if err != nil {
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
}
dto.AuthInfo = *authInfo
dto.Status_Code = erc.DVCVerified
res, err := u.Verify(dto)
rw.DataResponse(w, res, err)
}
func (obj myBase) Reject(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id"))
if id <= 0 {
return
}
dto := e.VerifyDto{}
dto.Id = uint(id)
authInfo, err := pa.GetAuthInfo(r)
if err != nil {
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
}
dto.AuthInfo = *authInfo
dto.Status_Code = erc.DVCRejected
res, err := u.Verify(dto)
rw.DataResponse(w, res, err)
}
+1 -1
View File
@@ -32,7 +32,7 @@ func getEntities(input string) []any {
case "satusehat":
return getSatuSehatEntities()
case "simgossync":
return getSimgosSyncEntities()
return getSyncEntities()
}
return nil
}
@@ -2,11 +2,14 @@ package migration
import (
/************** Source ***************/
division "simrs-vx/internal/domain/sync-entities/division"
installation "simrs-vx/internal/domain/sync-entities/installation"
specialist "simrs-vx/internal/domain/sync-entities/specialist"
subspecialist "simrs-vx/internal/domain/sync-entities/subspecialist"
unit "simrs-vx/internal/domain/sync-entities/unit"
)
func getSimgosSyncEntities() []any {
func getSyncEntities() []any {
return []any{
&installation.InstallationLink{},
&installation.InstallationSimxLog{},
@@ -14,5 +17,14 @@ func getSimgosSyncEntities() []any {
&unit.UnitLink{},
&unit.UnitSimxLog{},
&unit.UnitSimgosLog{},
&division.DivisionLink{},
&division.DivisionSimxLog{},
&division.DivisionSimgosLog{},
&specialist.SpecialistLink{},
&specialist.SpecialistSimxLog{},
&specialist.SpecialistSimgosLog{},
&subspecialist.SubspecialistLink{},
&subspecialist.SubspecialistSimxLog{},
&subspecialist.SubspecialistSimgosLog{},
}
}