enhancement update encounter status code
This commit is contained in:
@@ -10,6 +10,8 @@ import (
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/encounter"
|
||||
u "simrs-vx/internal/use-case/main-use-case/encounter"
|
||||
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
@@ -83,3 +85,63 @@ func (obj myBase) CheckOut(w http.ResponseWriter, r *http.Request) {
|
||||
res, err := u.CheckOut(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Process(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.UpdateStatusDto{
|
||||
Id: uint16(id),
|
||||
StatusCode: erc.DSCProcess,
|
||||
}
|
||||
|
||||
res, err := u.UpdateStatusCode(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Cancel(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.UpdateStatusDto{
|
||||
Id: uint16(id),
|
||||
StatusCode: erc.DSCCancel,
|
||||
}
|
||||
|
||||
res, err := u.UpdateStatusCode(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Reject(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.UpdateStatusDto{
|
||||
Id: uint16(id),
|
||||
StatusCode: erc.DSCRejected,
|
||||
}
|
||||
|
||||
res, err := u.UpdateStatusCode(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Skip(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.UpdateStatusDto{
|
||||
Id: uint16(id),
|
||||
StatusCode: erc.DSCSkipped,
|
||||
}
|
||||
|
||||
res, err := u.UpdateStatusCode(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user