feat (prescription): add approve + create medication
This commit is contained in:
@@ -116,7 +116,6 @@ func SetRoutes() http.Handler {
|
||||
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", prescription.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)
|
||||
@@ -138,6 +137,14 @@ func SetRoutes() http.Handler {
|
||||
"PATCH /{id}/complete": mcuorderitem.O.Complete,
|
||||
"PATCH /{id}/set-schedule": mcuorderitem.O.SetSchedule,
|
||||
})
|
||||
hk.GroupRoutes("/v1/prescription", r, hk.MapHandlerFunc{
|
||||
"GET /": prescription.O.GetList,
|
||||
"GET /{id}": prescription.O.GetDetail,
|
||||
"POST /": prescription.O.Create,
|
||||
"PATCH /{id}": prescription.O.Update,
|
||||
"DELETE /{id}": prescription.O.Delete,
|
||||
"PATCH /{id}/approve": prescription.O.Approve,
|
||||
})
|
||||
hk.GroupRoutes("/v1/mcu-order-sub-item", r, hk.MapHandlerFunc{
|
||||
"GET /": mcuordersubitem.O.GetList,
|
||||
"GET /{id}": mcuordersubitem.O.GetDetail,
|
||||
|
||||
@@ -69,3 +69,15 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
res, err := u.Delete(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 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint(id)
|
||||
res, err := u.Approve(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user