Merge pull request #166 from dikstub-rssa/feat/trx-orders

feat/trx-orders: fix doctor_code + id type
This commit is contained in:
Munawwirul Jamal
2025-11-24 11:41:27 +07:00
committed by GitHub
2 changed files with 14 additions and 11 deletions
@@ -33,39 +33,42 @@ 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 {
intId := rw.ValidateInt(w, "id", r.PathValue("id"))
if intId <= 0 {
return
}
id := uint16(intId)
dto := e.ReadDetailDto{}
dto.Id = uint16(id)
dto.Id = &id
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 {
intId := rw.ValidateInt(w, "id", r.PathValue("id"))
if intId <= 0 {
return
}
id := uint16(intId)
dto := e.UpdateDto{}
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return
}
dto.Id = uint16(id)
dto.Id = &id
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 {
intId := rw.ValidateInt(w, "id", r.PathValue("id"))
if intId <= 0 {
return
}
id := uint16(intId)
dto := e.DeleteDto{}
dto.Id = uint16(id)
dto.Id = &id
res, err := u.Delete(dto)
rw.DataResponse(w, res, err)
}