unit, unit-position,installation-position removes ids

This commit is contained in:
dpurbosakti
2025-11-06 15:48:32 +07:00
parent 42b1b48e36
commit 6ed038eb54
21 changed files with 121 additions and 114 deletions
@@ -33,21 +33,21 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
}
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id"))
if id <= 0 {
code := rw.ValidateString(w, "code", r.PathValue("code"))
if code == "" {
return
}
dto := e.ReadDetailDto{}
sf.UrlQueryParam(&dto, *r.URL)
dto.Id = uint16(id)
dto.Code = &code
res, err := u.ReadDetail(dto)
rw.DataResponse(w, res, err)
}
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id"))
if id <= 0 {
code := rw.ValidateString(w, "code", r.PathValue("code"))
if code == "" {
return
}
@@ -55,19 +55,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return
}
dto.Id = uint16(id)
dto.Code = code
res, err := u.Update(dto)
rw.DataResponse(w, res, err)
}
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id"))
if id <= 0 {
code := rw.ValidateString(w, "code", r.PathValue("code"))
if code == "" {
return
}
dto := e.DeleteDto{}
dto.Id = uint16(id)
dto.Code = &code
res, err := u.Delete(dto)
rw.DataResponse(w, res, err)
}