feat (generate-file): resume table is done

This commit is contained in:
dpurbosakti
2025-11-26 17:23:48 +07:00
parent d88d376112
commit 04add70ac5
5 changed files with 452 additions and 153 deletions
@@ -52,6 +52,10 @@ func GetDetail(w http.ResponseWriter, r *http.Request) {
}
func Update(w http.ResponseWriter, r *http.Request) {
authInfo, err := pa.GetAuthInfo(r)
if err != nil {
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
}
id := rw.ValidateInt(w, "id", r.PathValue("id"))
if id <= 0 {
return
@@ -62,11 +66,16 @@ func Update(w http.ResponseWriter, r *http.Request) {
return
}
dto.Id = uint(id)
dto.AuthInfo = *authInfo
res, err := u.Update(dto)
rw.DataResponse(w, res, err)
}
func Delete(w http.ResponseWriter, r *http.Request) {
authInfo, err := pa.GetAuthInfo(r)
if err != nil {
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
}
id := rw.ValidateInt(w, "id", r.PathValue("id"))
if id <= 0 {
return
@@ -74,6 +83,7 @@ func Delete(w http.ResponseWriter, r *http.Request) {
dto := e.DeleteDto{}
dto.Id = uint(id)
dto.AuthInfo = *authInfo
res, err := u.Delete(dto)
rw.DataResponse(w, res, err)
}