add sync installation

This commit is contained in:
vanilia
2025-11-14 09:52:50 +07:00
parent 8f41c965b4
commit 9e4357780b
8 changed files with 442 additions and 441 deletions
@@ -2,6 +2,7 @@ package installation
import (
"net/http"
"strconv"
rw "github.com/karincake/risoles"
// ua "github.com/karincake/tumpeng/auth/svc"
@@ -34,28 +35,35 @@ func (obj myBase) CreateLog(w http.ResponseWriter, r *http.Request) {
}
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)
id := rw.ValidateString(w, "id", r.PathValue("id"))
if id == "" {
return
}
dto := e.UpdateDto{}
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return
}
val, _ := strconv.ParseUint(id, 10, 16)
valUint := uint16(val)
dto.Id = &valUint
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)
id := rw.ValidateString(w, "id", r.PathValue("id"))
if id == "" {
return
}
dto := e.DeleteDto{}
val, _ := strconv.ParseUint(id, 10, 16)
valUint := uint16(val)
dto.Id = &valUint
res, err := u.Delete(dto)
rw.DataResponse(w, res, err)
}