feat/things-munaja: device and mcu order

This commit is contained in:
2025-11-20 13:39:51 +07:00
parent 279636682d
commit 7c600dce5f
7 changed files with 85 additions and 3 deletions
@@ -173,6 +173,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,
})
@@ -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 {