From 0a9381065fc0acb946ea7ca91ee0193d89d1378a Mon Sep 17 00:00:00 2001 From: anbuiselly <105765792+anbuiselly@users.noreply.github.com> Date: Fri, 18 Nov 2022 17:47:26 +0700 Subject: [PATCH] edit get staff-info --- client/staff.go | 8 ++++---- model/staff_request.go | 8 +++----- model/staff_response.go | 8 +++----- subject/staff.go | 4 ++-- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/client/staff.go b/client/staff.go index 7bcd91d..e2eac0c 100644 --- a/client/staff.go +++ b/client/staff.go @@ -16,16 +16,16 @@ func GetStaff() Staff { } // GetListStaffInfoByNotificationAction ... -func (s Staff) GetListStaffInfoByNotificationAction(p model.GetListStaffByNotificationActionRequest) (*model.ResponseListStaffInfoByNotificationAction, error) { - msg, err := natsio.GetServer().Request(subject.Staff.GetListStaffInfoByNotificationAction, toBytes(p)) +func (s Staff) GetListStaffInfoByNotificationAction(p model.GetListStaffRequest) (*model.ResponseListStaffInfo, error) { + msg, err := natsio.GetServer().Request(subject.Staff.GetListStaffInfo, toBytes(p)) if err != nil { return nil, err } var r struct { - Data *model.ResponseListStaffInfoByNotificationAction `json:"data"` - Error string `json:"error"` + Data *model.ResponseListStaffInfo `json:"data"` + Error string `json:"error"` } if err := json.Unmarshal(msg.Data, &r); err != nil { diff --git a/model/staff_request.go b/model/staff_request.go index 904f617..8ee7b67 100644 --- a/model/staff_request.go +++ b/model/staff_request.go @@ -1,8 +1,6 @@ package model -// GetListStaffByNotificationActionRequest ... -type GetListStaffByNotificationActionRequest struct { - CreatedBys []string `json:"createdBys"` - ApprovedBys []string `json:"approvedBys"` - CancelledBys []string `json:"cancelledBys"` +// GetListStaffRequest ... +type GetListStaffRequest struct { + Staffs []string `json:"Staffs"` } diff --git a/model/staff_response.go b/model/staff_response.go index cd471a2..5076d0c 100644 --- a/model/staff_response.go +++ b/model/staff_response.go @@ -1,10 +1,8 @@ package model -// ResponseListStaffInfoByNotificationAction ... -type ResponseListStaffInfoByNotificationAction struct { - CreatedBys []ResponseStaffInfo `json:"CreatedBys"` - ApprovedBys []ResponseStaffInfo `json:"ApprovedBys"` - CancelledBys []ResponseStaffInfo `json:"CancelledBys"` +// ResponseListStaffInfo ... +type ResponseListStaffInfo struct { + Staffs []ResponseStaffInfo `json:"staffs"` } // ResponseStaffInfo ... diff --git a/subject/staff.go b/subject/staff.go index 0cdbcf0..86e72e9 100644 --- a/subject/staff.go +++ b/subject/staff.go @@ -7,7 +7,7 @@ func getStaffValue(val string) string { } var Staff = struct { - GetListStaffInfoByNotificationAction string + GetListStaffInfo string }{ - GetListStaffInfoByNotificationAction: getStaffValue("get_list_staff_info_by_notification_info"), + GetListStaffInfo: getStaffValue("get_list_staff_info_by_notification_info"), }