add delete and update internal reference

This commit is contained in:
vanilia
2025-10-14 10:56:25 +07:00
parent bd6c76fee9
commit 6c6ad16af9
5 changed files with 315 additions and 53 deletions
@@ -32,39 +32,39 @@ 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 {
// return
//}
//dto := e.ReadDetailDto{}
//dto.Id = uint16(id)
//res, err := u.ReadDetail(dto)
//rw.DataResponse(w, res, err)
id := rw.ValidateInt(w, "id", r.PathValue("id"))
if id <= 0 {
return
}
dto := eir.ReadDetailDto{}
dto.Id = uint16(id)
res, err := uir.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 {
// return
//}
//
//dto := e.UpdateDto{}
//if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
// return
//}
//dto.Id = uint16(id)
//res, err := u.Update(dto)
//rw.DataResponse(w, res, err)
id := rw.ValidateInt(w, "id", r.PathValue("id"))
if id <= 0 {
return
}
dto := eir.UpdateDto{}
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return
}
dto.Id = uint16(id)
res, err := uir.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 {
// return
//}
//
//dto := e.DeleteDto{}
//dto.Id = uint16(id)
//res, err := u.Delete(dto)
//rw.DataResponse(w, res, err)
id := rw.ValidateInt(w, "id", r.PathValue("id"))
if id <= 0 {
return
}
dto := eir.DeleteDto{}
dto.Id = uint16(id)
res, err := uir.Delete(dto)
rw.DataResponse(w, res, err)
}
@@ -24,7 +24,7 @@ import (
inpatient "simrs-vx/internal/domain/main-entities/inpatient"
installation "simrs-vx/internal/domain/main-entities/installation"
insurancecompany "simrs-vx/internal/domain/main-entities/insurance-company"
checkoutpolies "simrs-vx/internal/domain/main-entities/internal-reference"
internalreference "simrs-vx/internal/domain/main-entities/internal-reference"
item "simrs-vx/internal/domain/main-entities/item"
itemprice "simrs-vx/internal/domain/main-entities/item-price"
laborant "simrs-vx/internal/domain/main-entities/laborant"
@@ -152,6 +152,6 @@ func getMainEntities() []any {
&chemo.Chemo{},
&midwife.Midwife{},
&postalregion.PostalRegion{},
&checkoutpolies.CheckoutPolies{},
&internalreference.InternalReference{},
}
}