feat/trx-orders: fix doctor_code + id type

This commit is contained in:
2025-11-24 11:37:57 +07:00
parent 13b0ea571e
commit f54a2b5b75
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)
}