refactor (doctor,nurse,specialist-intern): done
This commit is contained in:
@@ -9,10 +9,10 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Person_Id *uint `json:"person_id"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||
User_Id *uint `json:"user_id"`
|
||||
Person_Id *uint `json:"person_id"`
|
||||
Specialist_Code *string `json:"specialist_code"`
|
||||
Subspecialist_Code *string `json:"subspecialist_code"`
|
||||
User_Id *uint `json:"user_id"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -22,10 +22,10 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Person_Id *uint `json:"person-id"`
|
||||
Specialist_Id *uint16 `json:"specialist-id"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist-id"`
|
||||
User_Id *uint `json:"user-id"`
|
||||
Person_Id *uint `json:"person-id"`
|
||||
Specialist_Code *string `json:"specialist-code"`
|
||||
Subspecialist_Code *string `json:"subspecialist-code"`
|
||||
User_Id *uint `json:"user-id"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
@@ -50,26 +50,26 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
Person_Id *uint `json:"person_id"`
|
||||
Person *ep.Person `json:"person,omitempty"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"`
|
||||
User_Id *uint `json:"user_id"`
|
||||
User *eu.User `json:"user,omitempty"`
|
||||
Person_Id *uint `json:"person_id"`
|
||||
Person *ep.Person `json:"person,omitempty"`
|
||||
Specialist_Code *string `json:"specialist_code"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty"`
|
||||
Subspecialist_Code *string `json:"subspecialist_code"`
|
||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"`
|
||||
User_Id *uint `json:"user_id"`
|
||||
User *eu.User `json:"user,omitempty"`
|
||||
}
|
||||
|
||||
func (d SpecialistIntern) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Person_Id: d.Person_Id,
|
||||
Person: d.Person,
|
||||
Specialist_Id: d.Specialist_Id,
|
||||
Specialist: d.Specialist,
|
||||
Subspecialist_Id: d.Subspecialist_Id,
|
||||
Subspecialist: d.Subspecialist,
|
||||
User_Id: d.User_Id,
|
||||
User: d.User,
|
||||
Person_Id: d.Person_Id,
|
||||
Person: d.Person,
|
||||
Specialist_Code: d.Specialist_Code,
|
||||
Specialist: d.Specialist,
|
||||
Subspecialist_Code: d.Subspecialist_Code,
|
||||
Subspecialist: d.Subspecialist,
|
||||
User_Id: d.User_Id,
|
||||
User: d.User,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
|
||||
@@ -33,7 +33,7 @@ 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"))
|
||||
id := rw.ValidateInt(w, "code", r.PathValue("code"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
@@ -44,7 +44,7 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
id := rw.ValidateInt(w, "code", r.PathValue("code"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
@@ -59,7 +59,7 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
id := rw.ValidateInt(w, "code", r.PathValue("code"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -35,9 +35,8 @@ import (
|
||||
soapi "simrs-vx/internal/interface/main-handler/soapi"
|
||||
|
||||
/******************** actor ********************/
|
||||
doctor "simrs-vx/internal/interface/main-handler/doctor"
|
||||
|
||||
employee "simrs-vx/internal/interface/main-handler/employee"
|
||||
nurse "simrs-vx/internal/interface/main-handler/nurse"
|
||||
nutritionist "simrs-vx/internal/interface/main-handler/nutritionist"
|
||||
patient "simrs-vx/internal/interface/main-handler/patient"
|
||||
person "simrs-vx/internal/interface/main-handler/person"
|
||||
@@ -268,8 +267,6 @@ func SetRoutes() http.Handler {
|
||||
hc.RegCrud(r, "/v1/person-contact", personcontact.O)
|
||||
hc.RegCrud(r, "/v1/person-insurance", personinsurance.O)
|
||||
hc.RegCrud(r, "/v1/employee", employee.O)
|
||||
hc.RegCrud(r, "/v1/doctor", doctor.O)
|
||||
hc.RegCrud(r, "/v1/nurse", nurse.O)
|
||||
hc.RegCrud(r, "/v1/nutritionist", nutritionist.O)
|
||||
hc.RegCrud(r, "/v1/pharmacist", pharmacist.O)
|
||||
hk.GroupRoutes("/v1/user", r, hk.MapHandlerFunc{
|
||||
|
||||
@@ -33,7 +33,7 @@ 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"))
|
||||
id := rw.ValidateInt(w, "code", r.PathValue("code"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
@@ -44,7 +44,7 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
id := rw.ValidateInt(w, "code", r.PathValue("code"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
@@ -59,7 +59,7 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
id := rw.ValidateInt(w, "code", r.PathValue("code"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.SpecialistIntern) {
|
||||
}
|
||||
|
||||
data.Person_Id = inputSrc.Person_Id
|
||||
data.Specialist_Id = inputSrc.Specialist_Id
|
||||
data.Subspecialist_Id = inputSrc.Subspecialist_Id
|
||||
data.Specialist_Code = inputSrc.Specialist_Code
|
||||
data.Subspecialist_Code = inputSrc.Subspecialist_Code
|
||||
data.User_Id = inputSrc.User_Id
|
||||
}
|
||||
|
||||
@@ -87,10 +87,10 @@ func Create(input e.CreateDto) (*d.Data, error) {
|
||||
|
||||
if input.ContractPosition_Code == ero.CSCInt {
|
||||
createInt := esi.CreateDto{
|
||||
Person_Id: input.Person_Id,
|
||||
Specialist_Id: input.Specialist_Id,
|
||||
Subspecialist_Id: input.Subspecialist_Id,
|
||||
User_Id: &data.Id,
|
||||
Person_Id: input.Person_Id,
|
||||
Specialist_Code: input.Specialist_Code,
|
||||
Subspecialist_Code: input.Subspecialist_Code,
|
||||
User_Id: &data.Id,
|
||||
}
|
||||
if _, err := usi.CreateData(createInt, &event, tx); err != nil {
|
||||
return err
|
||||
@@ -359,10 +359,10 @@ func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
return err
|
||||
}
|
||||
createInt := esi.CreateDto{
|
||||
User_Id: &data.Id,
|
||||
Person_Id: input.Person_Id,
|
||||
Specialist_Id: input.Specialist_Id,
|
||||
Subspecialist_Id: input.Subspecialist_Id,
|
||||
User_Id: &data.Id,
|
||||
Person_Id: input.Person_Id,
|
||||
Specialist_Code: input.Specialist_Code,
|
||||
Subspecialist_Code: input.Subspecialist_Code,
|
||||
}
|
||||
if readIntData != nil {
|
||||
if err := usi.UpdateData(esi.UpdateDto{CreateDto: createInt}, readIntData, &event, tx); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user