add sync installation
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user