Merge branch 'dev' into refactor/unit-dropping

This commit is contained in:
2025-12-12 09:54:40 +07:00
38 changed files with 800 additions and 63 deletions
@@ -71,3 +71,12 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
res, err := u.Delete(dto)
rw.DataResponse(w, res, err)
}
func (obj myBase) CreateBulk(w http.ResponseWriter, r *http.Request) {
dto := e.CreateBulkDto{}
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return
}
res, err := u.CreateBulk(dto)
rw.DataResponse(w, res, err)
}
@@ -366,10 +366,31 @@ func SetRoutes() http.Handler {
/******************** sources ********************/
hc.RegCrudByCode(r, "/v1/division", division.O)
hc.RegCrudByCode(r, "/v1/division-position", divisionposition.O)
hc.RegCrudByCode(r, "/v1/installation", installation.O)
hk.GroupRoutes("/v1/installation", r, hk.MapHandlerFunc{
"GET /": installation.O.GetList,
"GET /{id}": installation.O.GetDetail,
"POST /": installation.O.Create,
"PATCH /{id}": installation.O.Update,
"DELETE /{id}": installation.O.Delete,
"POST /bulk": installation.O.CreateBulk,
})
hc.RegCrudByCode(r, "/v1/installation-position", installationposition.O)
hc.RegCrudByCode(r, "/v1/specialist", specialist.O)
hc.RegCrudByCode(r, "/v1/subspecialist", subspecialist.O)
hk.GroupRoutes("/v1/specialist", r, hk.MapHandlerFunc{
"GET /": specialist.O.GetList,
"GET /{id}": specialist.O.GetDetail,
"POST /": specialist.O.Create,
"PATCH /{id}": specialist.O.Update,
"DELETE /{id}": specialist.O.Delete,
"POST /bulk": specialist.O.CreateBulk,
})
hk.GroupRoutes("/v1/subspecialist", r, hk.MapHandlerFunc{
"GET /": subspecialist.O.GetList,
"GET /{id}": subspecialist.O.GetDetail,
"POST /": subspecialist.O.Create,
"PATCH /{id}": subspecialist.O.Update,
"DELETE /{id}": subspecialist.O.Delete,
"POST /bulk": subspecialist.O.CreateBulk,
})
hc.RegCrudByCode(r, "/v1/specialist-position", specialistposition.O)
hc.RegCrudByCode(r, "/v1/subspecialist-position", subspecialistposition.O)
hc.RegCrudByCode(r, "/v1/infra", infra.O)
@@ -71,3 +71,12 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
res, err := u.Delete(dto)
rw.DataResponse(w, res, err)
}
func (obj myBase) CreateBulk(w http.ResponseWriter, r *http.Request) {
dto := e.CreateBulkDto{}
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return
}
res, err := u.CreateBulk(dto)
rw.DataResponse(w, res, err)
}
@@ -71,3 +71,12 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
res, err := u.Delete(dto)
rw.DataResponse(w, res, err)
}
func (obj myBase) CreateBulk(w http.ResponseWriter, r *http.Request) {
dto := e.CreateBulkDto{}
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return
}
res, err := u.CreateBulk(dto)
rw.DataResponse(w, res, err)
}
@@ -5,6 +5,7 @@ import (
/******************** infra ********************/
gs "simrs-vx/internal/infra/gorm-setting"
satudb "simrs-vx/internal/infra/satu-db"
simgosdb "simrs-vx/internal/infra/simgos-db"
sync "simrs-vx/internal/infra/sync-cfg"
@@ -43,6 +44,7 @@ func SetRoutes() http.Handler {
a.RegisterExtCall(lh.Populate)
a.RegisterExtCall(sync.SetConfig)
a.RegisterExtCall(simgosdb.SetInstance)
a.RegisterExtCall(satudb.SetInstance)
r := http.NewServeMux()