Merge branch 'migration' of github.com:dikstub-rssa/simrs-be into fix/anything-moko
This commit is contained in:
@@ -91,6 +91,7 @@ import (
|
||||
medicalactionsrc "simrs-vx/internal/interface/main-handler/medical-action-src"
|
||||
medicalactionsrcitem "simrs-vx/internal/interface/main-handler/medical-action-src-item"
|
||||
medicine "simrs-vx/internal/interface/main-handler/medicine"
|
||||
medicineform "simrs-vx/internal/interface/main-handler/medicine-form"
|
||||
medicinegroup "simrs-vx/internal/interface/main-handler/medicine-group"
|
||||
medicinemethod "simrs-vx/internal/interface/main-handler/medicine-method"
|
||||
pharmacycompany "simrs-vx/internal/interface/main-handler/pharmacy-company"
|
||||
@@ -140,6 +141,7 @@ func SetRoutes() http.Handler {
|
||||
hc.RegCrud(r, "/v1/auth-partner", authpartner.O)
|
||||
hc.RegCrud(r, "/v1/practice-schedule", practiceschedule.O)
|
||||
hc.RegCrud(r, "/v1/counter", counter.O)
|
||||
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/soapi", auth.GuardMW, soapi.O)
|
||||
@@ -188,6 +190,7 @@ func SetRoutes() http.Handler {
|
||||
"POST /": prescription.O.Create,
|
||||
"PATCH /{id}": prescription.O.Update,
|
||||
"DELETE /{id}": prescription.O.Delete,
|
||||
"PATCH /{id}/submit": prescription.O.Submit,
|
||||
"PATCH /{id}/approve": prescription.O.Approve,
|
||||
})
|
||||
hk.GroupRoutes("/v1/mcu-order-sub-item", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package medicineform
|
||||
|
||||
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/medicine-form"
|
||||
u "simrs-vx/internal/use-case/main-use-case/medicine-form"
|
||||
)
|
||||
|
||||
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) {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Code = &code
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.UpdateDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Code = &code
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -78,6 +78,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) Approve(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
|
||||
@@ -57,6 +57,7 @@ import (
|
||||
medicationitem "simrs-vx/internal/domain/main-entities/medication-item"
|
||||
medicationitemdist "simrs-vx/internal/domain/main-entities/medication-item-dist"
|
||||
medicine "simrs-vx/internal/domain/main-entities/medicine"
|
||||
medicineform "simrs-vx/internal/domain/main-entities/medicine-form"
|
||||
medicinegroup "simrs-vx/internal/domain/main-entities/medicine-group"
|
||||
medicinemethod "simrs-vx/internal/domain/main-entities/medicine-method"
|
||||
medicinemix "simrs-vx/internal/domain/main-entities/medicine-mix"
|
||||
@@ -145,6 +146,7 @@ func getMainEntities() []any {
|
||||
ðnic.Ethnic{},
|
||||
&insurancecompany.InsuranceCompany{},
|
||||
&medicine.Medicine{},
|
||||
&medicineform.MedicineForm{},
|
||||
&medicinemix.MedicineMix{},
|
||||
&medicinemixitem.MedicineMixItem{},
|
||||
&medicalactionsrc.MedicalActionSrc{},
|
||||
|
||||
@@ -31,6 +31,8 @@ func getEntities(input string) []any {
|
||||
return getMainEntities()
|
||||
case "satusehat":
|
||||
return getSatuSehatEntities()
|
||||
case "simgossync":
|
||||
return getSimgosSyncEntities()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package migration
|
||||
|
||||
import (
|
||||
/************** Source ***************/
|
||||
installation "simrs-vx/internal/domain/sync-entities/installation"
|
||||
)
|
||||
|
||||
func getSimgosSyncEntities() []any {
|
||||
return []any{
|
||||
&installation.InstallationLink{},
|
||||
&installation.InstallationSimxLog{},
|
||||
&installation.InstallationSimgosLog{},
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
package migration
|
||||
|
||||
const (
|
||||
Main = "main"
|
||||
SatuSehat = "satusehat"
|
||||
Main = "main"
|
||||
SatuSehat = "satusehat"
|
||||
SimgosSync = "simgossync"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user