From a94138e574348fa065f6bde233173ed84e490f22 Mon Sep 17 00:00:00 2001 From: Nam Huynh Date: Sun, 4 Dec 2022 17:18:49 +0700 Subject: [PATCH] switch to v3 --- client/bank.go | 55 ---------- client/bank_branch.go | 39 ------- client/campaign.go | 36 ------- client/communication.go | 27 ----- client/location.go | 106 ------------------ client/news.go | 36 ------- client/order.go | 121 --------------------- client/segmnet.go | 41 ------- client/seller.go | 87 --------------- client/social_post.go | 65 ----------- client/staff.go | 41 ------- client/supplier.go | 180 ------------------------------- client/supplier_role.go | 58 ---------- client/supplier_user.go | 140 ------------------------ client/util.go | 21 ---- client/warehouse.go | 184 -------------------------------- client/warehouse_dao.go | 85 --------------- go.mod | 16 ++- go.sum | 6 ++ jestream_name.go | 4 - jetstream_consumer.go | 11 +- js/consumer/selly.go | 12 --- js/model/selly.go | 65 ----------- js/subject/config.go | 10 -- js/subject/selly.go | 21 ---- json_encoder.go | 44 -------- model/bank_branch_reponse.go | 11 -- model/bank_branch_request.go | 6 -- model/bank_response.go | 21 ---- model/campaign_request.go | 14 --- model/campaign_response.go | 52 --------- model/common_request.go | 22 ---- model/common_response.go | 18 ---- model/communication_request.go | 17 --- model/communication_response.go | 25 ----- model/file_response.go | 56 ---------- model/location_request.go | 23 ---- model/location_response.go | 43 -------- model/news_request.go | 6 -- model/news_response.go | 38 ------- model/order_request.go | 51 --------- model/order_response.go | 35 ------ model/segment_request.go | 6 -- model/segment_response.go | 12 --- model/seller_request.go | 18 ---- model/seller_response.go | 90 ---------------- model/social_post_request.go | 13 --- model/social_post_response.go | 61 ----------- model/staff_request.go | 6 -- model/staff_response.go | 12 --- model/supplier_request.go | 54 ---------- model/supplier_response.go | 35 ------ model/supplier_role_request.go | 14 --- model/supplier_role_response.go | 5 - model/supplier_user_request.go | 51 --------- model/supplier_user_response.go | 13 --- model/warehouse_request.go | 115 -------------------- model/warehouse_response.go | 172 ----------------------------- server_reqres.go | 10 -- subject/bank.go | 17 --- subject/campaign.go | 15 --- subject/communication.go | 15 --- subject/config.go | 33 ------ subject/location.go | 19 ---- subject/news.go | 13 --- subject/order.go | 23 ---- subject/segment.go | 15 --- subject/seller.go | 23 ---- subject/social_post.go | 17 --- subject/staff.go | 14 --- subject/supplier.go | 21 ---- subject/supplier_role.go | 15 --- subject/supplier_user.go | 25 ----- subject/warehouse.go | 49 --------- 74 files changed, 21 insertions(+), 2929 deletions(-) delete mode 100644 client/bank.go delete mode 100644 client/bank_branch.go delete mode 100644 client/campaign.go delete mode 100644 client/communication.go delete mode 100644 client/location.go delete mode 100644 client/news.go delete mode 100644 client/order.go delete mode 100644 client/segmnet.go delete mode 100644 client/seller.go delete mode 100644 client/social_post.go delete mode 100644 client/staff.go delete mode 100644 client/supplier.go delete mode 100644 client/supplier_role.go delete mode 100644 client/supplier_user.go delete mode 100644 client/util.go delete mode 100644 client/warehouse.go delete mode 100644 client/warehouse_dao.go delete mode 100644 jestream_name.go delete mode 100644 js/consumer/selly.go delete mode 100644 js/model/selly.go delete mode 100644 js/subject/config.go delete mode 100644 js/subject/selly.go delete mode 100644 json_encoder.go delete mode 100644 model/bank_branch_reponse.go delete mode 100644 model/bank_branch_request.go delete mode 100644 model/bank_response.go delete mode 100644 model/campaign_request.go delete mode 100644 model/campaign_response.go delete mode 100644 model/common_request.go delete mode 100644 model/common_response.go delete mode 100644 model/communication_request.go delete mode 100644 model/communication_response.go delete mode 100644 model/file_response.go delete mode 100644 model/location_request.go delete mode 100644 model/location_response.go delete mode 100644 model/news_request.go delete mode 100644 model/news_response.go delete mode 100644 model/order_request.go delete mode 100644 model/order_response.go delete mode 100644 model/segment_request.go delete mode 100644 model/segment_response.go delete mode 100644 model/seller_request.go delete mode 100644 model/seller_response.go delete mode 100644 model/social_post_request.go delete mode 100644 model/social_post_response.go delete mode 100644 model/staff_request.go delete mode 100644 model/staff_response.go delete mode 100644 model/supplier_request.go delete mode 100644 model/supplier_response.go delete mode 100644 model/supplier_role_request.go delete mode 100644 model/supplier_role_response.go delete mode 100644 model/supplier_user_request.go delete mode 100644 model/supplier_user_response.go delete mode 100644 model/warehouse_request.go delete mode 100644 model/warehouse_response.go delete mode 100644 subject/bank.go delete mode 100644 subject/campaign.go delete mode 100644 subject/communication.go delete mode 100644 subject/config.go delete mode 100644 subject/location.go delete mode 100644 subject/news.go delete mode 100644 subject/order.go delete mode 100644 subject/segment.go delete mode 100644 subject/seller.go delete mode 100644 subject/social_post.go delete mode 100644 subject/staff.go delete mode 100644 subject/supplier.go delete mode 100644 subject/supplier_role.go delete mode 100644 subject/supplier_user.go delete mode 100644 subject/warehouse.go diff --git a/client/bank.go b/client/bank.go deleted file mode 100644 index 3391911..0000000 --- a/client/bank.go +++ /dev/null @@ -1,55 +0,0 @@ -package client - -import ( - "encoding/json" - "errors" - - "git.selly.red/Selly-Modules/natsio" - "git.selly.red/Selly-Modules/natsio/model" - "git.selly.red/Selly-Modules/natsio/subject" -) - -// Bank ... -type Bank struct{} - -// GetBank ... -func GetBank() Bank { - return Bank{} -} - -func (s Bank) GetBankById(bankID string) (*model.BankBrief, error) { - msg, err := natsio.GetServer().Request(subject.Bank.GetBankById, toBytes(bankID)) - if err != nil { - return nil, err - } - - var r struct { - Data *model.BankBrief `json:"data"` - Error string `json:"error"` - } - - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - - return r.Data, nil -} - -func (s Bank) CheckBankAndBranchByID(p model.BankBranchRequest) bool { - msg, err := natsio.GetServer().Request(subject.Bank.CheckBankAndBranchByID, toBytes(p)) - if err != nil { - return false - } - - var r struct { - Error string `json:"error"` - } - - if err = json.Unmarshal(msg.Data, &r); err != nil { - return false - } - return r.Error == "" -} diff --git a/client/bank_branch.go b/client/bank_branch.go deleted file mode 100644 index 5890e75..0000000 --- a/client/bank_branch.go +++ /dev/null @@ -1,39 +0,0 @@ -package client - -import ( - "encoding/json" - "errors" - - "git.selly.red/Selly-Modules/natsio" - "git.selly.red/Selly-Modules/natsio/model" - "git.selly.red/Selly-Modules/natsio/subject" -) - -// BankBranch ... -type BankBranch struct{} - -// GetBankBranch ... -func GetBankBranch() BankBranch { - return BankBranch{} -} - -func (s BankBranch) GetBankBranchById(bankBranchID string) (*model.BankBranchBrief, error) { - msg, err := natsio.GetServer().Request(subject.Bank.GetBankBranchById, toBytes(bankBranchID)) - if err != nil { - return nil, err - } - - var r struct { - Data *model.BankBranchBrief `json:"data"` - Error string `json:"error"` - } - - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - - return r.Data, nil -} diff --git a/client/campaign.go b/client/campaign.go deleted file mode 100644 index 82649d3..0000000 --- a/client/campaign.go +++ /dev/null @@ -1,36 +0,0 @@ -package client - -import ( - "encoding/json" - "errors" - "git.selly.red/Selly-Modules/natsio" - "git.selly.red/Selly-Modules/natsio/model" - "git.selly.red/Selly-Modules/natsio/subject" -) - -// Campaign ... -type Campaign struct{} - -// GetCampaign ... -func GetCampaign() Campaign { - return Campaign{} -} - -// GetCampaignTransaction ... -func (c Campaign) GetCampaignTransaction(p model.GetCampaignTransactionsRequest) (*model.ResponseCampaignTransactionAll, error) { - msg, err := natsio.GetServer().Request(subject.Campaign.GetListCampaignTransactionAdminInfoByIDs, toBytes(p)) - if err != nil { - return nil, err - } - var r struct { - Data *model.ResponseCampaignTransactionAll `json:"data"` - Error string `json:"error"` - } - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - return r.Data, nil -} diff --git a/client/communication.go b/client/communication.go deleted file mode 100644 index 1d8254d..0000000 --- a/client/communication.go +++ /dev/null @@ -1,27 +0,0 @@ -package client - -import ( - "encoding/json" - - "git.selly.red/Selly-Modules/natsio" - "git.selly.red/Selly-Modules/natsio/model" - "git.selly.red/Selly-Modules/natsio/subject" -) - -// Communication ... -type Communication struct{} - -// GetCommunication ... -func GetCommunication() Communication { - return Communication{} -} - -// RequestHttp ... -func (c Communication) RequestHttp(p model.CommunicationRequestHttp) (r *model.CommunicationHttpResponse, err error) { - msg, err := natsio.GetServer().Request(subject.Communication.RequestHTTP, toBytes(p)) - if err != nil { - return nil, err - } - err = json.Unmarshal(msg.Data, &r) - return r, err -} diff --git a/client/location.go b/client/location.go deleted file mode 100644 index 18be423..0000000 --- a/client/location.go +++ /dev/null @@ -1,106 +0,0 @@ -package client - -import ( - "encoding/json" - "errors" - - "git.selly.red/Selly-Modules/natsio" - "git.selly.red/Selly-Modules/natsio/model" - "git.selly.red/Selly-Modules/natsio/subject" -) - -// Location ... -type Location struct{} - -// GetLocation ... -func GetLocation() Location { - return Location{} -} - -// GetLocationByCode ... -func (l Location) GetLocationByCode(payload model.LocationRequestPayload) (*model.ResponseLocationAddress, error) { - msg, err := natsio.GetServer().Request(subject.Location.GetLocationByCode, toBytes(payload)) - if err != nil { - return nil, err - } - - var r struct { - Data *model.ResponseLocationAddress `json:"data"` - Error string `json:"error"` - } - if err := json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - - if r.Error != "" { - return nil, errors.New(r.Error) - } - return r.Data, nil -} - -// GetProvincesByCodes ... ... -func (l Location) GetProvincesByCodes(p model.ProvinceRequestPayload) (*model.LocationProvinceResponse, error) { - msg, err := natsio.GetServer().Request(subject.Location.GetProvincesByCodes, toBytes(p)) - if err != nil { - return nil, err - } - - var r struct { - Data *model.LocationProvinceResponse `json:"data"'` - Error string `json:"error"` - } - - if err := json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - - if r.Error != "" { - return nil, errors.New(r.Error) - } - return r.Data, nil -} - -// GetDistrictsByCodes ... -func (l Location) GetDistrictsByCodes(p model.DistrictRequestPayload) (*model.LocationDistrictResponse, error) { - msg, err := natsio.GetServer().Request(subject.Location.GetDistrictsByCodes, toBytes(p)) - if err != nil { - return nil, err - } - var r struct { - Data *model.LocationDistrictResponse `json:"data"` - Error string `json:"error"` - } - - if err := json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - - if r.Error != "" { - return nil, errors.New(r.Error) - } - - return r.Data, nil -} - -// GetWardsByCodes ... -func (l Location) GetWardsByCodes(p model.WardRequestPayload) (*model.LocationWardResponse, error) { - msg, err := natsio.GetServer().Request(subject.Location.GetWardsByCodes, toBytes(p)) - if err != nil { - return nil, err - } - - var r struct { - Data *model.LocationWardResponse `json:"data"` - Error string `json:"error"` - } - - if err := json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - - if r.Error != "" { - return nil, errors.New(r.Error) - } - - return r.Data, nil -} diff --git a/client/news.go b/client/news.go deleted file mode 100644 index d33787a..0000000 --- a/client/news.go +++ /dev/null @@ -1,36 +0,0 @@ -package client - -import ( - "encoding/json" - "errors" - "git.selly.red/Selly-Modules/natsio" - "git.selly.red/Selly-Modules/natsio/model" - "git.selly.red/Selly-Modules/natsio/subject" -) - -// News ... -type News struct{} - -// GetNews ... -func GetNews() News { - return News{} -} - -// GetProductNoticesByInventory ... -func (n News) GetProductNoticesByInventory(p model.GetProductNoticesByInventoryRequest) (*model.GetProductNoticesByInventoryResponse, error) { - msg, err := natsio.GetServer().Request(subject.News.GetProductNoticesByInventory, toBytes(p)) - if err != nil { - return nil, err - } - var r struct { - Data *model.GetProductNoticesByInventoryResponse `json:"data"` - Error string `json:"error"` - } - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - return r.Data, nil -} diff --git a/client/order.go b/client/order.go deleted file mode 100644 index a6ab736..0000000 --- a/client/order.go +++ /dev/null @@ -1,121 +0,0 @@ -package client - -import ( - "encoding/json" - "errors" - - "git.selly.red/Selly-Modules/natsio" - "git.selly.red/Selly-Modules/natsio/model" - "git.selly.red/Selly-Modules/natsio/subject" -) - -// Order ... -type Order struct{} - -// GetOrder ... -func GetOrder() Order { - return Order{} -} - -// UpdateORStatus ... -func (o Order) UpdateORStatus(p model.OrderUpdateORStatus) error { - msg, err := natsio.GetServer().Request(subject.Order.UpdateORStatus, toBytes(p)) - if err != nil { - return err - } - var r struct { - Error string `json:"error"` - } - if err = json.Unmarshal(msg.Data, &r); err != nil { - return err - } - if r.Error != "" { - return errors.New(r.Error) - } - return nil -} - -// CancelDelivery ... -func (o Order) CancelDelivery(p model.OrderCancelDelivery) error { - msg, err := natsio.GetServer().Request(subject.Order.CancelDelivery, toBytes(p)) - if err != nil { - return err - } - var r model.CommonResponseData - if err = json.Unmarshal(msg.Data, &r); err != nil { - return err - } - if r.Error != "" { - return errors.New(r.Error) - } - return nil -} - -// ChangeDeliveryStatus ... -func (o Order) ChangeDeliveryStatus(p model.OrderChangeDeliveryStatus) error { - msg, err := natsio.GetServer().Request(subject.Order.ChangeDeliveryStatus, toBytes(p)) - if err != nil { - return err - } - var r model.CommonResponseData - if err = json.Unmarshal(msg.Data, &r); err != nil { - return err - } - if r.Error != "" { - return errors.New(r.Error) - } - return nil -} - -// UpdateLogisticInfoFailed ... -func (o Order) UpdateLogisticInfoFailed(p model.OrderUpdateLogisticInfoFailed) error { - msg, err := natsio.GetServer().Request(subject.Order.UpdateLogisticInfoFailed, toBytes(p)) - if err != nil { - return err - } - var r model.CommonResponseData - if err = json.Unmarshal(msg.Data, &r); err != nil { - return err - } - if r.Error != "" { - return errors.New(r.Error) - } - return nil -} - -// ORNotUpdateStatus ... -func (o Order) ORNotUpdateStatus(p model.OrderORsNotUpdateStatus) error { - msg, err := natsio.GetServer().Request(subject.Order.ORNotUpdateStatus, toBytes(p)) - if err != nil { - return err - } - var r model.CommonResponseData - if err = json.Unmarshal(msg.Data, &r); err != nil { - return err - } - if r.Error != "" { - return errors.New(r.Error) - } - return nil -} - -// GetSupplierOrders ... -func (o Order) GetSupplierOrders(p model.OrderSupplierQuery) (*model.SupplierOrderList, error) { - msg, err := natsio.GetServer().Request(subject.Order.GetSupplierOrders, toBytes(p)) - if err != nil { - return nil, err - } - var ( - r struct { - Data model.SupplierOrderList `json:"data"` - Error string `json:"error"` - } - ) - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - return &r.Data, nil -} diff --git a/client/segmnet.go b/client/segmnet.go deleted file mode 100644 index bcc7bab..0000000 --- a/client/segmnet.go +++ /dev/null @@ -1,41 +0,0 @@ -package client - -import ( - "encoding/json" - "errors" - "git.selly.red/Selly-Modules/natsio" - "git.selly.red/Selly-Modules/natsio/model" - "git.selly.red/Selly-Modules/natsio/subject" -) - -// Segment ... -type Segment struct{} - -// GetSegment ... -func GetSegment() Segment { - return Segment{} -} - -// GetListSegmentInfoByIds ... -func (s Segment) GetListSegmentInfoByIds(p model.GetListSegmentRequest) (*model.ResponseListSegmentInfo, error) { - msg, err := natsio.GetServer().Request(subject.Segment.GetListSegmentInfo, toBytes(p)) - - if err != nil { - return nil, err - } - - var r struct { - Data *model.ResponseListSegmentInfo `json:"data"` - Error string `json:"error"` - } - - if err := json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - - if r.Error != "" { - return nil, errors.New(r.Error) - } - - return r.Data, nil -} diff --git a/client/seller.go b/client/seller.go deleted file mode 100644 index da0fc23..0000000 --- a/client/seller.go +++ /dev/null @@ -1,87 +0,0 @@ -package client - -import ( - "encoding/json" - "errors" - - "git.selly.red/Selly-Modules/natsio" - "git.selly.red/Selly-Modules/natsio/model" - "git.selly.red/Selly-Modules/natsio/subject" -) - -// Seller ... -type Seller struct{} - -// GetSeller ... -func GetSeller() Seller { - return Seller{} -} - -// GetSellerInfoByID ... -func (s Seller) GetSellerInfoByID(p model.GetSellerByIDRequest) (*model.ResponseSellerInfo, error) { - msg, err := natsio.GetServer().Request(subject.Seller.GetSellerInfoByID, toBytes(p)) - if err != nil { - return nil, err - } - - var r struct { - Data *model.ResponseSellerInfo `json:"data"` - Error string `json:"error"` - } - - if err := json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - - if r.Error != "" { - return nil, errors.New(r.Error) - } - - return r.Data, nil -} - -// GetListSellerInfoByIDs ... -func (s Seller) GetListSellerInfoByIDs(p model.GetListSellerByIDsRequest) (*model.ResponseListSellerInfo, error) { - msg, err := natsio.GetServer().Request(subject.Seller.GetListSellerInfoByIDs, toBytes(p)) - - if err != nil { - return nil, err - } - - var r struct { - Data *model.ResponseListSellerInfo `json:"data"` - Error string `json:"error"` - } - - if err := json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - - if r.Error != "" { - return nil, errors.New(r.Error) - - } - return r.Data, nil -} - -// GetListSellerInfoSupportChatByIDs ... -func (s Seller) GetListSellerInfoSupportChatByIDs(p model.GetListSellerSupportChatByIDsRequest) (*model.ResponseListSellerInfoSupportChat, error) { - msg, err := natsio.GetServer().Request(subject.SupportChat.GetListSellerInfoSupportChatByIDs, toBytes(p)) - if err != nil { - return nil, err - } - - var r struct { - Data *model.ResponseListSellerInfoSupportChat `json:"data"` - Error string `json:"error"` - } - - if err := json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - - } - return r.Data, nil -} diff --git a/client/social_post.go b/client/social_post.go deleted file mode 100644 index 72b1781..0000000 --- a/client/social_post.go +++ /dev/null @@ -1,65 +0,0 @@ -package client - -import ( - "encoding/json" - "errors" - "git.selly.red/Selly-Modules/natsio" - "git.selly.red/Selly-Modules/natsio/model" - "git.selly.red/Selly-Modules/natsio/subject" -) - -// SocialPost ... -type SocialPost struct{} - -// GetSocialPost ... -func GetSocialPost() SocialPost { - return SocialPost{} -} - -// GetListSocialPostAppInfoByIDs ... -func (s SocialPost) GetListSocialPostAppInfoByIDs(p model.GetListSocialPostAppByIDsRequest) (*model.ResponseListSocialPostAppInfo, error) { - msg, err := natsio.GetServer().Request(subject.SocialPost.GetListSocialPostAppInfoByIDs, toBytes(p)) - - if err != nil { - return nil, err - } - - var r struct { - Data *model.ResponseListSocialPostAppInfo `json:"data"` - Error string `json:"error"` - } - - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - - if r.Error != "" { - return nil, errors.New(r.Error) - - } - return r.Data, nil -} - -// GetBriefDetailSocialPostAdminByIDsRequest ... -func (s SocialPost) GetBriefDetailSocialPostAdminByIDsRequest(p model.GetBriefInfoSocialPostAdminByIDsRequest) (*model.ResponseListSocialPostAdminInfo, error) { - msg, err := natsio.GetServer().Request(subject.SocialPost.GetBriefInfoSocialPostAdminByIDs, toBytes(p)) - - if err != nil { - return nil, err - } - - var r struct { - Data *model.ResponseListSocialPostAdminInfo `json:"data"` - Error string `json:"error"` - } - - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - - if r.Error != "" { - return nil, errors.New(r.Error) - - } - return r.Data, nil -} diff --git a/client/staff.go b/client/staff.go deleted file mode 100644 index b175f53..0000000 --- a/client/staff.go +++ /dev/null @@ -1,41 +0,0 @@ -package client - -import ( - "encoding/json" - "errors" - "git.selly.red/Selly-Modules/natsio" - "git.selly.red/Selly-Modules/natsio/model" - "git.selly.red/Selly-Modules/natsio/subject" -) - -// Staff ... -type Staff struct{} - -func GetStaff() Staff { - return Staff{} -} - -// GetListStaffInfoByIds ... -func (s Staff) GetListStaffInfoByIds(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.ResponseListStaffInfo `json:"data"` - Error string `json:"error"` - } - - if err := json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - - if r.Error != "" { - return nil, errors.New(r.Error) - } - - return r.Data, nil - -} diff --git a/client/supplier.go b/client/supplier.go deleted file mode 100644 index 9b53826..0000000 --- a/client/supplier.go +++ /dev/null @@ -1,180 +0,0 @@ -package client - -import ( - "encoding/json" - "errors" - - "git.selly.red/Selly-Modules/natsio" - "git.selly.red/Selly-Modules/natsio/model" - "git.selly.red/Selly-Modules/natsio/subject" -) - -// Supplier ... -type Supplier struct{} - -// GetSupplier ... -func GetSupplier() Supplier { - return Supplier{} -} - -func (s Supplier) GetListSupplierInfo(p model.GetSupplierRequest) ([]*model.ResponseSupplierInfo, error) { - msg, err := natsio.GetServer().Request(subject.Supplier.GetListSupplierInfo, toBytes(p)) - if err != nil { - return nil, err - } - - var r struct { - Data []*model.ResponseSupplierInfo `json:"data"` - Error string `json:"error"` - } - - if err := json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - - return r.Data, nil -} - -func (s Supplier) GetSupplierContractBySupplierID(p model.GetSupplierContractRequest) (*model.ResponseSupplierContract, error) { - msg, err := natsio.GetServer().Request(subject.Supplier.GetSupplierContractBySupplierID, toBytes(p)) - if err != nil { - return nil, err - } - - var r struct { - Data *model.ResponseSupplierContract `json:"data"` - Error string `json:"error"` - } - - if err := json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - - return r.Data, nil -} - -func (s Supplier) FindAll(supplierID model.SupplierRequestPayload) (*model.SupplierAll, error) { - msg, err := natsio.GetServer().Request(subject.Supplier.FindAll, toBytes(supplierID)) - if err != nil { - return nil, err - } - - var r struct { - Data *model.SupplierAll `json:"data"` - Error string `json:"error"` - } - - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - - return r.Data, nil -} - -func (s Supplier) FindAllOld(req model.SupplierFindAllReq) (*model.SupplierAll, error) { - msg, err := natsio.GetServer().Request(subject.Supplier.FindAllOld, toBytes(req)) - if err != nil { - return nil, err - } - - var r struct { - Data *model.SupplierAll `json:"data"` - Error string `json:"error"` - } - - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - - return r.Data, nil -} - -func (s Supplier) GetBankInfoByID(supplierID model.SupplierRequestPayload) (*model.SupplierAll, error) { - msg, err := natsio.GetServer().Request(subject.Supplier.FindAll, toBytes(supplierID)) - if err != nil { - return nil, err - } - - var r struct { - Data *model.SupplierAll `json:"data"` - Error string `json:"error"` - } - - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - - return r.Data, nil -} - -func (s Supplier) Count(req model.SupplierCountReq) (*model.SupplierCountRes, error) { - msg, err := natsio.GetServer().Request(subject.Supplier.Count, toBytes(req)) - if err != nil { - return nil, err - } - - var r struct { - Data *model.SupplierCountRes `json:"data"` - Error string `json:"error"` - } - - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - - return r.Data, nil -} - -// CreateWarehouseIntoServiceSupplier ... -func (s Supplier) CreateWarehouseIntoServiceSupplier(p model.CreateSupplierWarehousePayload) error { - msg, err := natsio.GetServer().Request(subject.Warehouse.CreateWarehouseIntoServiceSupplier, toBytes(p)) - if err != nil { - return err - } - var r struct { - Error string `json:"error"` - } - if err = json.Unmarshal(msg.Data, &r); err != nil { - return err - } - if r.Error != "" { - return errors.New(r.Error) - } - return nil -} - -// UpdateWarehouseIntoServiceSupplier ... -func (s Supplier) UpdateWarehouseIntoServiceSupplier(p model.UpdateSupplierWarehousePayload) error { - msg, err := natsio.GetServer().Request(subject.Warehouse.UpdateWarehouseIntoServiceSupplier, toBytes(p)) - if err != nil { - return err - } - var r struct { - Error string `json:"error"` - } - if err = json.Unmarshal(msg.Data, &r); err != nil { - return err - } - if r.Error != "" { - return errors.New(r.Error) - } - return nil -} diff --git a/client/supplier_role.go b/client/supplier_role.go deleted file mode 100644 index 3bf068d..0000000 --- a/client/supplier_role.go +++ /dev/null @@ -1,58 +0,0 @@ -package client - -import ( - "encoding/json" - "errors" - "git.selly.red/Selly-Modules/natsio" - "git.selly.red/Selly-Modules/natsio/model" - "git.selly.red/Selly-Modules/natsio/subject" -) - -// SupplierRole ... -type SupplierRole struct{} - -// GetSupplierRole ... -func GetSupplierRole() SupplierRole { - return SupplierRole{} -} - -func (s SupplierRole) CreateRole(p model.CreateRoleRequest) (*model.CreateRoleResponse, error) { - msg, err := natsio.GetServer().Request(subject.SupplierUser.CreateOwner, toBytes(p)) - if err != nil { - return nil, err - } - - var r struct { - Data *model.CreateRoleResponse `json:"data"` - Error string `json:"error"` - } - - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - - return r.Data, nil -} - -func (s SupplierRole) UpdateRole(p model.UpdateRoleRequest) error { - msg, err := natsio.GetServer().Request(subject.SupplierRole.Update, toBytes(p)) - if err != nil { - return err - } - - var r struct { - Error string `json:"error"` - } - - if err = json.Unmarshal(msg.Data, &r); err != nil { - return err - } - if r.Error != "" { - return errors.New(r.Error) - } - - return nil -} diff --git a/client/supplier_user.go b/client/supplier_user.go deleted file mode 100644 index fb6a2db..0000000 --- a/client/supplier_user.go +++ /dev/null @@ -1,140 +0,0 @@ -package client - -import ( - "encoding/json" - "errors" - "git.selly.red/Selly-Modules/natsio" - "git.selly.red/Selly-Modules/natsio/model" - "git.selly.red/Selly-Modules/natsio/subject" -) - -// SupplierUser ... -type SupplierUser struct{} - -// GetSupplierUser ... -func GetSupplierUser() SupplierUser { - return SupplierUser{} -} - -func (s SupplierUser) CreateSupplierOwnerUsers(p model.CreateOwnerRequest) (*model.CreateOwnerResponse, error) { - msg, err := natsio.GetServer().Request(subject.SupplierUser.CreateOwner, toBytes(p)) - if err != nil { - return nil, err - } - - var r struct { - Data *model.CreateOwnerResponse `json:"data"` - Error string `json:"error"` - } - - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - - return r.Data, nil -} - -func (s SupplierUser) UpdateSupplierOwnerUsers(p model.UpdateOwnerRequest) error { - msg, err := natsio.GetServer().Request(subject.SupplierUser.UpdateOwner, toBytes(p)) - if err != nil { - return err - } - - var r struct { - Error string `json:"error"` - } - - if err = json.Unmarshal(msg.Data, &r); err != nil { - return err - } - if r.Error != "" { - return errors.New(r.Error) - } - - return nil -} - -func (s SupplierUser) CreateSupplierStaffUsers(p model.CreateStaffRequest) (*model.CreateStaffResponse, error) { - msg, err := natsio.GetServer().Request(subject.SupplierUser.CreateStaff, toBytes(p)) - if err != nil { - return nil, err - } - - var r struct { - Data *model.CreateStaffResponse `json:"data"` - Error string `json:"error"` - } - - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - - return r.Data, nil -} - -func (s SupplierUser) UpdateSupplierStaffUsers(p model.UpdateStaffRequest) error { - msg, err := natsio.GetServer().Request(subject.SupplierUser.UpdateStaff, toBytes(p)) - if err != nil { - return err - } - - var r struct { - Error string `json:"error"` - } - - if err = json.Unmarshal(msg.Data, &r); err != nil { - return err - } - if r.Error != "" { - return errors.New(r.Error) - } - - return nil -} - -func (s SupplierUser) UpdateStatus(p model.UpdateStatusRequest) error { - msg, err := natsio.GetServer().Request(subject.SupplierUser.UpdateStaff, toBytes(p)) - if err != nil { - return err - } - - var r struct { - Error string `json:"error"` - } - - if err = json.Unmarshal(msg.Data, &r); err != nil { - return err - } - if r.Error != "" { - return errors.New(r.Error) - } - - return nil -} - -func (s SupplierUser) ResetPassword(p model.ResetPasswordRequest) (*model.ResetPasswordResponse, error) { - msg, err := natsio.GetServer().Request(subject.SupplierUser.ResetPassword, toBytes(p)) - if err != nil { - return nil, err - } - - var r struct { - Data *model.ResetPasswordResponse `json:"data"` - Error string `json:"error"` - } - - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - - return r.Data, nil -} diff --git a/client/util.go b/client/util.go deleted file mode 100644 index 7676610..0000000 --- a/client/util.go +++ /dev/null @@ -1,21 +0,0 @@ -package client - -import ( - "encoding/json" - "go.mongodb.org/mongo-driver/bson" - "log" -) - -func toBytes(data interface{}) []byte { - b, err := json.Marshal(data) - if err != nil { - log.Printf("natsio/client.toBytes: marshal_json %v", err) - } - return b -} - -// bsonToBytes ... -func bsonToBytes(data interface{}) []byte { - b, _ := bson.Marshal(data) - return b -} diff --git a/client/warehouse.go b/client/warehouse.go deleted file mode 100644 index fb391ca..0000000 --- a/client/warehouse.go +++ /dev/null @@ -1,184 +0,0 @@ -package client - -import ( - "encoding/json" - "errors" - "fmt" - - "git.selly.red/Selly-Modules/natsio" - "git.selly.red/Selly-Modules/natsio/model" - "git.selly.red/Selly-Modules/natsio/subject" -) - -// Warehouse ... -type Warehouse struct{} - -// GetWarehouse ... -func GetWarehouse() Warehouse { - return Warehouse{} -} - -// UpdateIsClosedSupplier ... -func (w Warehouse) UpdateIsClosedSupplier(p model.UpdateSupplierIsClosedRequest) error { - msg, err := natsio.GetServer().Request(subject.Warehouse.UpdateIsClosedSupplier, toBytes(p)) - if err != nil { - return err - } - var r struct { - Error string `json:"error"` - } - if err = json.Unmarshal(msg.Data, &r); err != nil { - return err - } - if r.Error != "" { - return errors.New(r.Error) - } - return nil -} - -// AfterCreateWarehouse ... -func (w Warehouse) AfterCreateWarehouse(p model.WarehouseNatsResponse) error { - msg, err := natsio.GetServer().Request(subject.Warehouse.AfterCreateWarehouse, toBytes(p)) - if err != nil { - return err - } - var r struct { - Error string `json:"error"` - } - if err = json.Unmarshal(msg.Data, &r); err != nil { - return err - } - if r.Error != "" { - return errors.New(r.Error) - } - return nil -} - -// AfterUpdateWarehouse ... -func (w Warehouse) AfterUpdateWarehouse(p model.WarehouseNatsResponse) error { - msg, err := natsio.GetServer().Request(subject.Warehouse.AfterUpdateWarehouse, toBytes(p)) - if err != nil { - return err - } - var r struct { - Error string `json:"error"` - } - if err = json.Unmarshal(msg.Data, &r); err != nil { - return err - } - if r.Error != "" { - return errors.New(r.Error) - } - return nil -} - -// CreateOutboundRequest ... -func (w Warehouse) CreateOutboundRequest(p model.OutboundRequestPayload) (*model.OutboundRequestResponse, error) { - msg, err := natsio.GetServer().Request(subject.Warehouse.CreateOutboundRequest, toBytes(p)) - if err != nil { - return nil, err - } - var r struct { - Data *model.OutboundRequestResponse `json:"data"` - Error string `json:"error"` - } - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - return r.Data, nil -} - -// UpdateOutboundRequestLogisticInfo ... -func (w Warehouse) UpdateOutboundRequestLogisticInfo(p model.UpdateOutboundRequestLogisticInfoPayload) error { - msg, err := natsio.GetServer().Request(subject.Warehouse.UpdateOutboundRequestLogistic, toBytes(p)) - if err != nil { - return err - } - var r struct { - Error string `json:"error"` - } - if err = json.Unmarshal(msg.Data, &r); err != nil { - return err - } - if r.Error != "" { - return errors.New(r.Error) - } - return nil -} - -// CancelOutboundRequest ... -func (w Warehouse) CancelOutboundRequest(p model.CancelOutboundRequest) error { - msg, err := natsio.GetServer().Request(subject.Warehouse.CancelOutboundRequest, toBytes(p)) - if err != nil { - return err - } - var r struct { - Error string `json:"error"` - } - if err = json.Unmarshal(msg.Data, &r); err != nil { - return err - } - if r.Error != "" { - return errors.New(r.Error) - } - return nil -} - -// GetConfigByWarehouseID ... -func (w Warehouse) GetConfigByWarehouseID(warehouseID string) (*model.WarehouseConfiguration, error) { - msg, err := natsio.GetServer().Request(subject.Warehouse.GetConfiguration, toBytes(warehouseID)) - if err != nil { - return nil, err - } - var r struct { - Data *model.WarehouseConfiguration `json:"data"` - Error string `json:"error"` - } - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - return r.Data, nil -} - -// GetWarehouses ... -func (w Warehouse) GetWarehouses(p model.GetWarehousesRequest) (*model.GetWarehousesResponse, error) { - msg, err := natsio.GetServer().Request(subject.Warehouse.GetWarehouses, toBytes(p)) - if err != nil { - return nil, err - } - var r struct { - Data *model.GetWarehousesResponse `json:"data"` - Error string `json:"error"` - } - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - return r.Data, nil -} - -// UpdateORDeliveryStatus ... -func (w Warehouse) UpdateORDeliveryStatus(p model.WarehouseORUpdateDeliveryStatus) error { - msg, err := natsio.GetServer().Request(subject.Warehouse.UpdateORDeliveryStatus, toBytes(p)) - if err != nil { - return err - } - var r struct { - Error string `json:"error"` - } - if err = json.Unmarshal(msg.Data, &r); err != nil { - return fmt.Errorf("nats: update_or_delivery_status %v", err) - } - if r.Error != "" { - return errors.New(r.Error) - } - return nil -} diff --git a/client/warehouse_dao.go b/client/warehouse_dao.go deleted file mode 100644 index 56c046f..0000000 --- a/client/warehouse_dao.go +++ /dev/null @@ -1,85 +0,0 @@ -package client - -import ( - "encoding/json" - "errors" - "git.selly.red/Selly-Modules/natsio" - "git.selly.red/Selly-Modules/natsio/model" - "git.selly.red/Selly-Modules/natsio/subject" -) - -// DistinctWithField ... -func (w Warehouse) DistinctWithField(p model.DistinctWithField) ([]interface{}, error) { - msg, err := natsio.GetServer().Request(subject.Warehouse.Distinct, bsonToBytes(p)) - if err != nil { - return nil, err - } - var r struct { - Data []interface{} `json:"data"` - Error string `json:"error"` - } - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - return r.Data, nil -} - -// FindOneByCondition ... -func (w Warehouse) FindOneByCondition(p model.FindOneCondition) (*model.WarehouseNatsResponse, error) { - msg, err := natsio.GetServer().Request(subject.Warehouse.FindOne, bsonToBytes(p)) - if err != nil { - return nil, err - } - var r struct { - Data *model.WarehouseNatsResponse `json:"data"` - Error string `json:"error"` - } - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - return r.Data, nil -} - -// CountByCondition ... -func (w Warehouse) CountByCondition(p model.FindWithCondition) (int64, error) { - msg, err := natsio.GetServer().Request(subject.Warehouse.Count, bsonToBytes(p)) - if err != nil { - return 0, err - } - var r struct { - Data int64 `json:"data"` - Error string `json:"error"` - } - if err = json.Unmarshal(msg.Data, &r); err != nil { - return 0, err - } - if r.Error != "" { - return 0, errors.New(r.Error) - } - return r.Data, nil -} - -// FindByCondition ... -func (w Warehouse) FindByCondition(p model.FindWithCondition) ([]*model.WarehouseNatsResponse, error) { - msg, err := natsio.GetServer().Request(subject.Warehouse.FindByCondition, bsonToBytes(p)) - if err != nil { - return nil, err - } - var r struct { - Data []*model.WarehouseNatsResponse `json:"data"` - Error string `json:"error"` - } - if err = json.Unmarshal(msg.Data, &r); err != nil { - return nil, err - } - if r.Error != "" { - return nil, errors.New(r.Error) - } - return r.Data, nil -} diff --git a/go.mod b/go.mod index bd87680..0c348a1 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,18 @@ -module git.selly.red/Selly-Modules/natsio +module git.selly.red/Selly-Modules/natsio/v3 -go 1.16 +go 1.19 + +require ( + github.com/nats-io/nats.go v1.20.0 + github.com/thoas/go-funk v0.9.2 + go.mongodb.org/mongo-driver v1.10.1 +) require ( github.com/golang/protobuf v1.5.2 // indirect github.com/nats-io/nats-server/v2 v2.6.1 // indirect - github.com/nats-io/nats.go v1.13.0 - github.com/thoas/go-funk v0.9.1 - go.mongodb.org/mongo-driver v1.10.1 + github.com/nats-io/nkeys v0.3.0 // indirect + github.com/nats-io/nuid v1.0.1 // indirect + golang.org/x/crypto v0.3.0 // indirect google.golang.org/protobuf v1.27.1 // indirect ) diff --git a/go.sum b/go.sum index 85b108e..bf650d0 100644 --- a/go.sum +++ b/go.sum @@ -38,6 +38,8 @@ github.com/nats-io/nats-server/v2 v2.6.1/go.mod h1:Az91TbZiV7K4a6k/4v6YYdOKEoxCX github.com/nats-io/nats.go v1.12.3/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w= github.com/nats-io/nats.go v1.13.0 h1:LvYqRB5epIzZWQp6lmeltOOZNLqCvm4b+qfvzZO03HE= github.com/nats-io/nats.go v1.13.0/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w= +github.com/nats-io/nats.go v1.20.0 h1:T8JJnQfVSdh1CzGiwAOv5hEobYCBho/0EupGznYw0oM= +github.com/nats-io/nats.go v1.20.0/go.mod h1:tLqubohF7t4z3du1QDPYJIQQyhb4wl6DhjxEajSI7UA= github.com/nats-io/nkeys v0.2.0/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= github.com/nats-io/nkeys v0.3.0 h1:cgM5tL53EvYRU+2YLXIK0G2mJtK12Ft9oeooSZMA2G8= github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= @@ -53,6 +55,8 @@ github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/thoas/go-funk v0.9.1 h1:O549iLZqPpTUQ10ykd26sZhzD+rmR5pWhuElrhbC20M= github.com/thoas/go-funk v0.9.1/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q= +github.com/thoas/go-funk v0.9.2 h1:oKlNYv0AY5nyf9g+/GhMgS/UO2ces0QRdPKwkhY3VCk= +github.com/thoas/go-funk v0.9.2/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= @@ -71,6 +75,8 @@ golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.3.0 h1:a06MkbcxBrEFc0w0QIZWXrH/9cCX6KJyWbBOIwAn+7A= +golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= diff --git a/jestream_name.go b/jestream_name.go deleted file mode 100644 index 1f2ea4d..0000000 --- a/jestream_name.go +++ /dev/null @@ -1,4 +0,0 @@ -package natsio - -// StreamNameSelly ... -const StreamNameSelly = "selly" diff --git a/jetstream_consumer.go b/jetstream_consumer.go index b59df80..c8bf7df 100644 --- a/jetstream_consumer.go +++ b/jetstream_consumer.go @@ -13,21 +13,18 @@ func (js JetStream) GetConsumerInfo(stream, name string) (*nats.ConsumerInfo, er } // AddConsumer ... -func (js JetStream) AddConsumer(stream, subject, name string) error { +func (js JetStream) AddConsumer(stream, name, filterSubject string) error { // Get consumer first, return if existed - consumer, err := js.GetConsumerInfo(stream, name) + consumer, _ := js.GetConsumerInfo(stream, name) if consumer != nil { return nil } - // Generate channel name - channel := combineStreamAndSubjectName(stream, subject) - // Add - _, err = js.instance.AddConsumer(stream, &nats.ConsumerConfig{ + _, err := js.instance.AddConsumer(stream, &nats.ConsumerConfig{ Durable: name, AckPolicy: nats.AckExplicitPolicy, - FilterSubject: channel, + FilterSubject: filterSubject, }) if err != nil { diff --git a/js/consumer/selly.go b/js/consumer/selly.go deleted file mode 100644 index 975cb5b..0000000 --- a/js/consumer/selly.go +++ /dev/null @@ -1,12 +0,0 @@ -package jsconsumer - -// Selly ... -var Selly = struct { - PushNotification string - UpdateSellerAffiliateStatistic string - CheckAnDInsertCashflowBySeller string -}{ - PushNotification: "PULL_PUSH_NOTIFICATION", - UpdateSellerAffiliateStatistic: "PULL_UPDATE_SELLER_AFFILIATE_STATISTIC", - CheckAnDInsertCashflowBySeller: "PULL_CHECK_AND_INSERT_CASHFLOW_BY_SELLER", -} diff --git a/js/model/selly.go b/js/model/selly.go deleted file mode 100644 index 68d3342..0000000 --- a/js/model/selly.go +++ /dev/null @@ -1,65 +0,0 @@ -package jsmodel - -// PushNotification ... -type PushNotification struct { - User string `json:"user"` - Type string `json:"type"` - TargetID string `json:"targetId"` - IsFromAdmin bool `json:"isFromAdmin"` - Category string `json:"category"` - Options NotificationOptions `json:"options"` -} - -// NotificationOptions ... -type NotificationOptions struct { - Title string `json:"title"` - Content string `json:"content"` - CampaignID string `json:"campaignId,omitempty"` -} - -// PayloadUpdateSellerAffiliateStatistic ... -type PayloadUpdateSellerAffiliateStatistic struct { - SellerID string `json:"sellerId"` - Statistic SellerAffiliateStatistic `json:"statistic"` -} - -// SellerAffiliateStatistic ... -type SellerAffiliateStatistic struct { - TransactionTotal int `json:"transactionTotal"` - TransactionCashback int `json:"transactionCashback"` - TransactionPending int `json:"transactionPending"` - TransactionApproved int `json:"transactionApproved"` - TransactionRejected int `json:"transactionRejected"` - CommissionTransactionTotal float64 `json:"commissionTransactionTotal"` - CommissionTransactionCashback float64 `json:"commissionTransactionCashback"` - CommissionTransactionApproved float64 `json:"commissionTransactionApproved"` - CommissionTransactionPending float64 `json:"commissionTransactionPending"` - CommissionTransactionRejected float64 `json:"commissionTransactionRejected"` -} - -// PayloadCashflowsBySeller ... -type PayloadCashflowsBySeller struct { - SellerID string `json:"sellerId"` - List []CashflowSeller `json:"list"` -} - -// CashflowSeller ... -type CashflowSeller struct { - Value float64 `json:"value"` - Action string `json:"action"` - Category string `json:"category"` - TargetID string `json:"targetId"` - TargetType string `json:"targetType"` - Options *CashFlowOptions `json:"options"` -} - -// CashFlowOptions ... -type CashFlowOptions struct { - AffiliateTransactionCode string `json:"affiliateTransactionCode,omitempty"` - AffiliateCampaignID string `json:"affiliateCampaignId,omitempty"` - AffiliateCampaignName string `json:"affiliateCampaignName,omitempty"` - - // Campaign - CampaignID string `json:"campaignId,omitempty"` - CampaignName string `json:"campaignName,omitempty"` -} diff --git a/js/subject/config.go b/js/subject/config.go deleted file mode 100644 index 3f77205..0000000 --- a/js/subject/config.go +++ /dev/null @@ -1,10 +0,0 @@ -package jssubject - -var root = "js" - -// prefixes ... -var prefixes = struct { - Selly string -}{ - Selly: "selly", -} diff --git a/js/subject/selly.go b/js/subject/selly.go deleted file mode 100644 index 2f665bb..0000000 --- a/js/subject/selly.go +++ /dev/null @@ -1,21 +0,0 @@ -package jssubject - -import ( - "fmt" -) - -// getSellyValue ... -func getSellyValue(val string) string { - return fmt.Sprintf("%s.%s.%s", root, prefixes.Selly, val) -} - -// Selly ... -var Selly = struct { - PushNotification string - UpdateSellerAffiliateStatistic string - CheckAnDInsertCashflowBySeller string -}{ - PushNotification: getSellyValue("push_notifications"), - UpdateSellerAffiliateStatistic: getSellyValue("update_seller_affiliate_statistic"), - CheckAnDInsertCashflowBySeller: getSellyValue("check_and_insert_cashflow_statistic"), -} diff --git a/json_encoder.go b/json_encoder.go deleted file mode 100644 index c0bde64..0000000 --- a/json_encoder.go +++ /dev/null @@ -1,44 +0,0 @@ -package natsio - -import ( - "log" - - "github.com/nats-io/nats.go" -) - -// JSONEncoder ... -type JSONEncoder struct { - encConn *nats.EncodedConn -} - -// Subscribe ... -func (e JSONEncoder) Subscribe(subject string, cb nats.Handler) (*nats.Subscription, error) { - sub, err := e.encConn.Subscribe(subject, cb) - if err != nil { - log.Printf("natsio.JSONEncoder.Subscribe err: %v\n", err) - } else { - log.Printf("natsio.JSONEncoder - subscribed to subject %s successfully\n", subject) - } - return sub, err -} - -// QueueSubscribe ... -func (e JSONEncoder) QueueSubscribe(subject, queue string, cb nats.Handler) (*nats.Subscription, error) { - sub, err := e.encConn.QueueSubscribe(subject, queue, cb) - if err != nil { - log.Printf("natsio.JSONEncoder.QueueSubscribe err: %v\n", err) - } else { - log.Printf("natsio.JSONEncoder.QueueSubscribe - subscribed to subject %s successfully\n", subject) - } - return sub, err -} - -// Publish ... -func (e JSONEncoder) Publish(reply string, data interface{}) error { - return e.encConn.Publish(reply, data) -} - -// Request ... -func (e JSONEncoder) Request(subject string, data interface{}, res interface{}) error { - return e.encConn.Request(subject, data, res, requestTimeout) -} diff --git a/model/bank_branch_reponse.go b/model/bank_branch_reponse.go deleted file mode 100644 index 1fa1432..0000000 --- a/model/bank_branch_reponse.go +++ /dev/null @@ -1,11 +0,0 @@ -package model - -// BankBranchBrief ... -type BankBranchBrief struct { - ID string `json:"_id"` - City string `json:"city"` - BankCode string `json:"bankCode"` - Bank string `json:"bank"` - Active bool `json:"active"` - Name string `json:"name"` -} diff --git a/model/bank_branch_request.go b/model/bank_branch_request.go deleted file mode 100644 index 6de1216..0000000 --- a/model/bank_branch_request.go +++ /dev/null @@ -1,6 +0,0 @@ -package model - -type BankBranchRequest struct { - BankID string `json:"bankId"` - BranchID string `json:"branchId"` -} diff --git a/model/bank_response.go b/model/bank_response.go deleted file mode 100644 index 74fc10e..0000000 --- a/model/bank_response.go +++ /dev/null @@ -1,21 +0,0 @@ -package model - -// MultiLang ... -type MultiLang struct { - En string `json:"en"` - Vi string `json:"vi"` -} - -// BankBrief ... -type BankBrief struct { - ID string `json:"_id"` - Name MultiLang `json:"name"` - ShortName string `json:"shortName"` - Active bool `json:"active"` - BenBankName string `json:"benBankName"` - BankCode int `json:"bankCode"` - IsBranchRequired bool `json:"isBranchRequired"` - SearchString string `json:"searchString"` - BeneficiaryForVietinbank string `json:"beneficiaryForVietinbank"` - CreatedBy string `json:"createdBy,omitempty"` -} diff --git a/model/campaign_request.go b/model/campaign_request.go deleted file mode 100644 index 71227e4..0000000 --- a/model/campaign_request.go +++ /dev/null @@ -1,14 +0,0 @@ -package model - -import "time" - -// GetCampaignTransactionsRequest ... -type GetCampaignTransactionsRequest struct { - Campaign string `json:"campaign"` - Keyword string `json:"keyword"` - Status string `json:"status"` - FromAt time.Time `json:"fromAt"` - ToAt time.Time `json:"toAt"` - Page int64 `json:"page"` - Limit int64 `json:"limit"` -} diff --git a/model/campaign_response.go b/model/campaign_response.go deleted file mode 100644 index db8a90b..0000000 --- a/model/campaign_response.go +++ /dev/null @@ -1,52 +0,0 @@ -package model - -import "go.mongodb.org/mongo-driver/bson/primitive" - -// ResponseCampaignTransactionAll ... -type ResponseCampaignTransactionAll struct { - List []ResponseNatsCampaignTransaction `json:"list"` - Total int64 `json:"total"` - Limit int64 `json:"limit"` -} - -// ResponseNatsCampaignTransaction ... -type ResponseNatsCampaignTransaction struct { - ID string `json:"_id"` - Cash float64 `json:"cash"` - Campaign ResponseCampaignShortInfo `json:"campaign"` - Options ResponseCampaignTransactionOptions `json:"options"` - Seller primitive.ObjectID `json:"seller"` - Type string `json:"type"` - Status string `json:"status"` - RejectedReason string `json:"rejectedReason"` - CreatedAt string `json:"createdAt"` - UpdatedAt string `json:"updatedAt"` - Item *ResponseCampaignItemShortInfo `json:"item"` - ApprovedBy primitive.ObjectID `json:"approvedBy,omitempty"` - RejectedBy primitive.ObjectID `json:"rejectedBy,omitempty"` - ApprovedAt string `json:"approvedAt,omitempty"` - RejectedAt string `json:"rejectedAt,omitempty"` - CompletedAt string `json:"completedAt,omitempty"` -} - -// ResponseCampaignShortInfo ... -type ResponseCampaignShortInfo struct { - ID string `json:"_id"` - Name string `json:"name"` - Status string `json:"status"` -} - -// ResponseCampaignItemShortInfo ... -type ResponseCampaignItemShortInfo struct { - ID string `json:"_id"` - Name string `json:"name"` - Status string `json:"status"` -} - -// ResponseCampaignTransactionOptions ... -type ResponseCampaignTransactionOptions struct { - Link string `json:"link"` - SocialChannel string `json:"socialChannel"` - Milestone int64 `json:"milestone"` - MilestoneTitle string `json:"milestoneTitle"` -} diff --git a/model/common_request.go b/model/common_request.go deleted file mode 100644 index 0ce5163..0000000 --- a/model/common_request.go +++ /dev/null @@ -1,22 +0,0 @@ -package model - -import "go.mongodb.org/mongo-driver/mongo/options" - -type FindWithCondition struct { - Conditions interface{} `json:"conditions"` - Opts []*options.FindOptions `json:"opts"` -} - -type FindOneCondition struct { - Conditions interface{} `json:"conditions"` -} - -type DistinctWithField struct { - Conditions interface{} `json:"conditions"` - Filed string `json:"filed"` -} - -type ActionBy struct { - ID string `json:"id"` - Name string `json:"name"` -} diff --git a/model/common_response.go b/model/common_response.go deleted file mode 100644 index 2d2aba8..0000000 --- a/model/common_response.go +++ /dev/null @@ -1,18 +0,0 @@ -package model - -import "encoding/json" - -// CommonResponseData ... -type CommonResponseData struct { - Data interface{} `json:"data"` - Error string `json:"error"` -} - -// ParseData ... -func (c CommonResponseData) ParseData(resultPointer interface{}) error { - b, err := json.Marshal(c.Data) - if err != nil { - return err - } - return json.Unmarshal(b, resultPointer) -} diff --git a/model/communication_request.go b/model/communication_request.go deleted file mode 100644 index eb64ef2..0000000 --- a/model/communication_request.go +++ /dev/null @@ -1,17 +0,0 @@ -package model - -// CommunicationRequestHttp ... -type CommunicationRequestHttp struct { - ResponseImmediately bool `json:"responseImmediately"` - Authentication string `json:"authentication"` - Payload HttpRequest `json:"payload"` -} - -// HttpRequest ... -type HttpRequest struct { - URL string `json:"url"` - Method string `json:"method"` - Data string `json:"data"` - Header map[string]string `json:"header"` - Query map[string]string `json:"query"` -} diff --git a/model/communication_response.go b/model/communication_response.go deleted file mode 100644 index f57e176..0000000 --- a/model/communication_response.go +++ /dev/null @@ -1,25 +0,0 @@ -package model - -import "encoding/json" - -// CommunicationHttpResponse ... -type CommunicationHttpResponse struct { - Response *HttpResponse `json:"response"` - Error bool `json:"error"` - Message string `json:"message"` - RequestID string `json:"requestId"` -} - -// ParseResponseData ... -func (r *CommunicationHttpResponse) ParseResponseData(result interface{}) error { - if r.Response == nil { - return nil - } - return json.Unmarshal([]byte(r.Response.Body), result) -} - -// HttpResponse ... -type HttpResponse struct { - Body string `json:"body"` - StatusCode int `json:"statusCode"` -} diff --git a/model/file_response.go b/model/file_response.go deleted file mode 100644 index 6eff304..0000000 --- a/model/file_response.go +++ /dev/null @@ -1,56 +0,0 @@ -package model - -import "go.mongodb.org/mongo-driver/bson/primitive" - -// FilePhoto ... -type FilePhoto struct { - ID string `json:"_id"` - Name string `json:"name,omitempty"` - Dimensions *FileDimensions `json:"dimensions"` -} - -// FileSize ... -type FileSize struct { - Width int `json:"width"` - Height int `json:"height"` - URL string `json:"url"` -} - -// FileDimensions ... -type FileDimensions struct { - Small *FileSize `json:"sm"` - Medium *FileSize `json:"md"` -} - -// ListPhoto ... -type ListPhoto []*FilePhoto - -// Video ... -type Video struct { - ID primitive.ObjectID `json:"_id"` - Name string `json:"name"` - Dimensions *FileVideoDimensions `json:"dimensions"` - VideoExtension string `json:"ext"` - Thumbnail *FilePhoto `json:"thumbnail"` - Status string `json:"status"` -} - -// FileVideoDimensions ... -type FileVideoDimensions struct { - Dimension480p *FileVideoSize `json:"size480p"` - Dimension720p *FileVideoSize `json:"size720p"` - Dimension1080p *FileVideoSize `json:"size1080p"` - DimensionOriginal *FileVideoSize `json:"original"` -} - -// FileVideoSize ... -type FileVideoSize struct { - Name string `json:"name"` - Width int `json:"width"` - Height int `json:"height"` - Size string `json:"size"` - URL string `json:"url"` -} - -// ListVideo ... -type ListVideo []Video diff --git a/model/location_request.go b/model/location_request.go deleted file mode 100644 index 4533db7..0000000 --- a/model/location_request.go +++ /dev/null @@ -1,23 +0,0 @@ -package model - -// LocationRequestPayload ... -type LocationRequestPayload struct { - Province int `json:"province"` - District int `json:"district"` - Ward int `json:"ward"` -} - -// ProvinceRequestPayload ... -type ProvinceRequestPayload struct { - Codes []int `json:"codes"` -} - -// DistrictRequestPayload ... -type DistrictRequestPayload struct { - Codes []int `json:"codes"` -} - -// WardRequestPayload ... -type WardRequestPayload struct { - Codes []int `json:"codes"` -} diff --git a/model/location_response.go b/model/location_response.go deleted file mode 100644 index 484d89e..0000000 --- a/model/location_response.go +++ /dev/null @@ -1,43 +0,0 @@ -package model - -type ResponseLocationAddress struct { - Province LocationProvince `json:"province"` - District LocationDistrict `json:"district"` - Ward LocationWard `json:"ward"` -} - -// LocationProvince ... -type LocationProvince struct { - ID string `json:"id"` - Name string `json:"name"` - Code int `json:"code"` -} - -// LocationDistrict ... -type LocationDistrict struct { - ID string `json:"id"` - Name string `json:"name"` - Code int `json:"code"` -} - -// LocationWard ... -type LocationWard struct { - ID string `json:"id"` - Name string `json:"name"` - Code int `json:"code"` -} - -// LocationProvinceResponse ... -type LocationProvinceResponse struct { - Provinces []LocationProvince `json:"provinces"` -} - -// LocationDistrictResponse ... -type LocationDistrictResponse struct { - Districts []LocationDistrict `json:"districts"` -} - -// LocationWardResponse ... -type LocationWardResponse struct { - Wards []LocationWard `json:"wards"` -} diff --git a/model/news_request.go b/model/news_request.go deleted file mode 100644 index fb886e3..0000000 --- a/model/news_request.go +++ /dev/null @@ -1,6 +0,0 @@ -package model - -// GetProductNoticesByInventoryRequest .... -type GetProductNoticesByInventoryRequest struct { - InventoryIds []string `json:"inventoryIds"` -} diff --git a/model/news_response.go b/model/news_response.go deleted file mode 100644 index 4b496c4..0000000 --- a/model/news_response.go +++ /dev/null @@ -1,38 +0,0 @@ -package model - -// GetProductNoticesByInventoryResponse .... -type GetProductNoticesByInventoryResponse struct { - Notices []NewsAppResponse `json:"notices"` -} - -// NewsAppResponse ... -type NewsAppResponse struct { - ID string `json:"_id"` - Title string `json:"title,omitempty"` - Target *TargetNewDoc `json:"target,omitempty"` - ActionType *ActionType `json:"action"` - ShortDesc string `json:"shortDesc,omitempty"` - Type string `json:"type"` - ShortTitle string `json:"shortTitle,omitempty"` - Color string `json:"color"` - Options *NewsOptions `json:"options,omitempty"` - DisplayStyle string `json:"displayStyle"` -} - -// NewsOptions ... -type NewsOptions struct { - Category string `json:"category"` -} - -// TargetNewDoc ... -type TargetNewDoc struct { - Type string `json:"type,omitempty"` - Value string `json:"value,omitempty"` -} - -// ActionType ... -type ActionType struct { - Type string `json:"type"` - Value string `json:"value"` - Text string `json:"text,omitempty"` -} diff --git a/model/order_request.go b/model/order_request.go deleted file mode 100644 index bd1fa73..0000000 --- a/model/order_request.go +++ /dev/null @@ -1,51 +0,0 @@ -package model - -// OrderUpdateORStatus ... -type OrderUpdateORStatus struct { - ID string `json:"id"` - OrderCode string `json:"orderCode"` - ORCode string `json:"orCode"` - Status string `json:"status"` - DeliveryStatus string `json:"deliveryStatus"` - Reason string `json:"reason"` - Data OrderORData `json:"data"` -} - -// OrderCancelDelivery ... -type OrderCancelDelivery struct { - OrderID string `json:"orderId"` -} - -// OrderChangeDeliveryStatus ... -type OrderChangeDeliveryStatus struct { - OrderID string `json:"orderId"` - DeliveryStatus string `json:"deliveryStatus"` - ActionBy ActionBy `json:"actionBy"` -} - -// OrderORData ... -type OrderORData struct { - Link string `json:"link"` -} - -// OrderUpdateLogisticInfoFailed ... -type OrderUpdateLogisticInfoFailed struct { - OrderID string `json:"orderId"` - ORCode string `json:"orCode"` - Reason string `json:"reason"` -} - -// OrderORsNotUpdateStatus ... -type OrderORsNotUpdateStatus struct { - ORCodes []string `json:"orCodes"` -} - -// OrderSupplierQuery ... -type OrderSupplierQuery struct { - Limit int64 `json:"limit"` - Page int64 `json:"page"` - FromDate string `json:"fromDate"` - ToDate string `json:"toDate"` - SupplierID string `json:"supplierId"` - WarehouseIDs []string `json:"warehouseIDs"` -} diff --git a/model/order_response.go b/model/order_response.go deleted file mode 100644 index c08f87a..0000000 --- a/model/order_response.go +++ /dev/null @@ -1,35 +0,0 @@ -package model - -import "time" - -// SupplierOrderList ... -type SupplierOrderList struct { - List []SupplierOrder `json:"list"` - Total int64 `json:"total" example:"100"` - Limit int64 `json:"limit" example:"20"` -} - -// SupplierOrder ... -type SupplierOrder struct { - ID string `json:"_id"` - Code string `json:"code"` - CreatedAt time.Time `json:"createdAt"` - Status string `json:"status"` - WarehouseStatus string `json:"warehouseStatus"` - Items []SupplierOrderItem `json:"items"` - Delivery SupplierOrderDelivery `json:"delivery"` -} - -// SupplierOrderItem ... -type SupplierOrderItem struct { - ID string `json:"_id" example:"1231"` - SupplierSKU string `json:"supplierSku" example:"SUPPLIER_SKU"` - Quantity int64 `json:"quantity" example:"2"` -} - -// SupplierOrderDelivery ... -type SupplierOrderDelivery struct { - Code string `json:"code" example:"123187287"` - Status string `json:"status" enums:"waiting_to_confirm,waiting_to_pick,picking,picked,delay_pickup,pickup_failed,delivering,delay_delivery,delivered,cancelled,delivery_failed,waiting_to_return,returning,delay_return,compensation,returned"` - TPLCode string `json:"tplCode" enums:"SLY,GHTK,GHN,SSC,SPY,VTP,SE,NTL,BEST"` -} diff --git a/model/segment_request.go b/model/segment_request.go deleted file mode 100644 index 138f347..0000000 --- a/model/segment_request.go +++ /dev/null @@ -1,6 +0,0 @@ -package model - -// GetListSegmentRequest ... -type GetListSegmentRequest struct { - SegmentIds []string `json:"segmentIds"` -} diff --git a/model/segment_response.go b/model/segment_response.go deleted file mode 100644 index 84a1571..0000000 --- a/model/segment_response.go +++ /dev/null @@ -1,12 +0,0 @@ -package model - -// ResponseSegmentInfo ... -type ResponseSegmentInfo struct { - ID string `json:"_id"` - Name string `json:"name"` -} - -// ResponseListSegmentInfo ... -type ResponseListSegmentInfo struct { - Segments []ResponseSegmentInfo `json:"segments"` -} diff --git a/model/seller_request.go b/model/seller_request.go deleted file mode 100644 index a54996c..0000000 --- a/model/seller_request.go +++ /dev/null @@ -1,18 +0,0 @@ -package model - -import "go.mongodb.org/mongo-driver/bson/primitive" - -// GetSellerByIDRequest ... -type GetSellerByIDRequest struct { - SellerID primitive.ObjectID `json:"sellerId"` -} - -// GetListSellerByIDsRequest ... -type GetListSellerByIDsRequest struct { - SellerIDs []primitive.ObjectID `json:"sellerIds"` -} - -// GetListSellerSupportChatByIDsRequest ... -type GetListSellerSupportChatByIDsRequest struct { - SellerIDs []primitive.ObjectID `json:"sellerIds"` -} diff --git a/model/seller_response.go b/model/seller_response.go deleted file mode 100644 index 01c80e5..0000000 --- a/model/seller_response.go +++ /dev/null @@ -1,90 +0,0 @@ -package model - -import "time" - -// ResponseSellerInfo ... -type ResponseSellerInfo struct { - ID string `json:"_id"` - Name string `json:"name"` - Code string `json:"code"` -} - -// ResponseListSellerInfo ... -type ResponseListSellerInfo struct { - Sellers []ResponseSellerInfo `json:"sellers"` -} - -// ResponseListSellerInfoSupportChat ... -type ResponseListSellerInfoSupportChat struct { - Sellers []ResponseSellerInfoSupportChat `json:"sellers"` -} - -// ResponseSellerInfoSupportChat ... -type ResponseSellerInfoSupportChat struct { - ID string `json:"_id"` - Name string `json:"name"` - Code string `json:"code"` - Membership SellerMembershipInfo `json:"membership"` - Info SellerContactInfo `json:"info"` - Team *TeamInfo `json:"team,omitempty"` - Statistic SellerStatistic `json:"statistic"` - TrackingTime *SellerTrackingTime `json:"trackingTime"` - Invitee *InviteeInfo `json:"invitee"` - CreatedAt time.Time `json:"createdAt"` - PlanPackage *SellerPlanPackageInfo `json:"planPackage"` -} - -// SellerPlanPackageInfo ... -type SellerPlanPackageInfo struct { - ID string `json:"_id"` - Name string `json:"name"` - Level int `json:"level"` - CreatedAt time.Time `json:"createdAt"` -} - -// SellerTrackingTime ... -type SellerTrackingTime struct { - FirstOrderDeliveredAt time.Time `json:"firstOrderDeliveredAt,omitempty"` - ThirdOrderDeliveredAt time.Time `json:"thirdOrderDeliveredAt,omitempty"` -} - -// SellerStatistic ... -type SellerStatistic struct { - ThisMonthSale float64 `bson:"thisMonthSale" json:"thisMonthSale"` - LastMonthSale float64 `bson:"lastMonthSale" json:"lastMonthSale"` - Sale float64 `bson:"sale" json:"sale"` - TransactionTotal int `json:"transactionTotal"` - TransactionPaymentProcessing int `json:"transactionPaymentProcessing"` - TransactionWaitingApprove int `json:"transactionWaitingApprove"` - TransactionPending int `json:"transactionPending"` - TransactionSuccess int `json:"transactionSuccess"` - TransactionRejected int `json:"transactionRejected"` - TransactionDelivering int `json:"transactionDelivering"` - TransactionDelivered int `json:"transactionDelivered"` -} - -// TeamInfo ... -type TeamInfo struct { - ID string `json:"_id"` - Name string `json:"name"` - Role string `json:"role"` -} - -// InviteeInfo ... -type InviteeInfo struct { - ID string `json:"_id"` - Name string `json:"name"` -} - -// SellerContactInfo ... -type SellerContactInfo struct { - City int `json:"cityCode"` - CityName string `json:"cityName"` - Gender string `json:"gender"` -} - -// SellerMembershipInfo ... -type SellerMembershipInfo struct { - Level int `json:"level"` - Name string `json:"name"` -} diff --git a/model/social_post_request.go b/model/social_post_request.go deleted file mode 100644 index efeb983..0000000 --- a/model/social_post_request.go +++ /dev/null @@ -1,13 +0,0 @@ -package model - -import "go.mongodb.org/mongo-driver/bson/primitive" - -// GetListSocialPostAppByIDsRequest ... -type GetListSocialPostAppByIDsRequest struct { - SocialPostIDs []primitive.ObjectID `json:"socialPostIDs"` -} - -// GetBriefInfoSocialPostAdminByIDsRequest ... -type GetBriefInfoSocialPostAdminByIDsRequest struct { - SocialPostIDs []primitive.ObjectID `json:"socialPostIDs"` -} diff --git a/model/social_post_response.go b/model/social_post_response.go deleted file mode 100644 index 85a2445..0000000 --- a/model/social_post_response.go +++ /dev/null @@ -1,61 +0,0 @@ -package model - -import ( - "go.mongodb.org/mongo-driver/bson/primitive" - "time" -) - -// ResponseListSocialPostAppInfo ... -type ResponseListSocialPostAppInfo struct { - SocialPosts []SocialPostAppInfo `json:"socialPosts"` -} - -// SocialPostAppInfo ... -type SocialPostAppInfo struct { - ID primitive.ObjectID `json:"_id"` - Title string `json:"title"` - Content string `json:"content"` - Statistic SocialPostStatistic `json:"statistic"` - Author *SocialPostSellerInfo `json:"author"` - Photos ListPhoto `json:"photos"` - PublishedAt time.Time `json:"publishedAt"` - IsLiked bool `json:"isLiked"` - IsPin bool `json:"isPin"` - Contributor *SocialPostSellerInfo `json:"contributor"` - CreatedAt time.Time `json:"createdAt"` - Status string `json:"status"` - HasUpdate bool `json:"hasUpdate"` - Order int `json:"order"` - Videos ListVideo `json:"videos"` -} - -// SocialPostStatistic ... -type SocialPostStatistic struct { - Views int `json:"views"` - UniqueViews int `json:"uniqueViews"` - Likes int `json:"likes"` - Shares int `json:"shares"` - UniqueShares int `json:"uniqueShares"` - Comments int `json:"comments"` -} - -// SocialPostSellerInfo ... -type SocialPostSellerInfo struct { - ID primitive.ObjectID `json:"_id"` - Name string `json:"name"` - Membership SellerMembershipInfo `json:"membership"` - Logo *FilePhoto `json:"avatar"` - IsMine bool `json:"isMine"` -} - -// ResponseListSocialPostAdminInfo ... -type ResponseListSocialPostAdminInfo struct { - SocialPosts []SocialPostAdminInfo `json:"socialPosts"` -} - -// SocialPostAdminInfo ... -type SocialPostAdminInfo struct { - ID primitive.ObjectID `json:"_id"` - Title string `json:"title"` - Status string `json:"status"` -} diff --git a/model/staff_request.go b/model/staff_request.go deleted file mode 100644 index 176b34e..0000000 --- a/model/staff_request.go +++ /dev/null @@ -1,6 +0,0 @@ -package model - -// GetListStaffRequest ... -type GetListStaffRequest struct { - StaffIds []string `json:"staffIds"` -} diff --git a/model/staff_response.go b/model/staff_response.go deleted file mode 100644 index 5076d0c..0000000 --- a/model/staff_response.go +++ /dev/null @@ -1,12 +0,0 @@ -package model - -// ResponseListStaffInfo ... -type ResponseListStaffInfo struct { - Staffs []ResponseStaffInfo `json:"staffs"` -} - -// ResponseStaffInfo ... -type ResponseStaffInfo struct { - ID string `json:"_id"` - Name string `json:"name"` -} diff --git a/model/supplier_request.go b/model/supplier_request.go deleted file mode 100644 index 18034af..0000000 --- a/model/supplier_request.go +++ /dev/null @@ -1,54 +0,0 @@ -package model - -import ( - "go.mongodb.org/mongo-driver/bson/primitive" -) - -// GetSupplierRequest ... -type GetSupplierRequest struct { - ListID []primitive.ObjectID `json:"listID"` -} - -type GetSupplierContractRequest struct { - SupplierID primitive.ObjectID `json:"supplierID"` -} - -// SupplierRequestPayload ... -type SupplierRequestPayload struct { - Limit int - Page int - Keyword string - Status string - PIC string - ContractStatus string -} - -type CreateSupplierWarehousePayload struct { - Supplier string `json:"supplier"` - Warehouse string `json:"warehouse"` - ProvinceCode int `json:"provinceCode"` - DistrictCode int `json:"districtCode"` - WardCode int `json:"wardCode"` -} - -type UpdateSupplierWarehousePayload struct { - Supplier string `json:"supplier"` - Warehouse string `json:"warehouse"` - ProvinceCode int `json:"provinceCode"` - DistrictCode int `json:"districtCode"` - WardCode int `json:"wardCode"` -} - -type SupplierFindAllReq struct { - Page int64 `json:"page"` - Limit int64 `json:"limit"` - Segment string `json:"segment"` - IDs []string `json:"ids"` - Status string `json:"status"` // active,inactive -} - -type SupplierCountReq struct { - Segment string `json:"segment"` - IDs []string `json:"ids"` - Status string `json:"status"` // active,inactive -} diff --git a/model/supplier_response.go b/model/supplier_response.go deleted file mode 100644 index 2b9dd10..0000000 --- a/model/supplier_response.go +++ /dev/null @@ -1,35 +0,0 @@ -package model - -// ResponseSupplierInfo ... -type ResponseSupplierInfo struct { - ID string `json:"id"` - Name string `json:"name"` - BusinessType string `json:"businessType"` -} - -// ResponseSupplierContract ... -type ResponseSupplierContract struct { - ID string `json:"id"` - Supplier string `json:"supplier"` - Name string `json:"name"` - Status string `json:"status"` -} - -// SupplierBrief ... -type SupplierBrief struct { - ID string `json:"_id"` - Name string `json:"name"` - Status string `json:"status"` - BusinessType string `json:"businessType"` - CreatedAt string `json:"createdAt"` - UpdatedAt string `json:"updatedAt"` -} - -type SupplierAll struct { - Suppliers []SupplierBrief `json:"suppliers"` - Total int64 `json:"total"` -} - -type SupplierCountRes struct { - Total int64 `json:"total"` -} diff --git a/model/supplier_role_request.go b/model/supplier_role_request.go deleted file mode 100644 index 6402622..0000000 --- a/model/supplier_role_request.go +++ /dev/null @@ -1,14 +0,0 @@ -package model - -type CreateRoleRequest struct { - Name string `json:"name"` - Code string `json:"code"` - Type string `json:"type"` -} - -type UpdateRoleRequest struct { - ID string `json:"_id"` - Name string `json:"name"` - Code string `json:"code"` - Type string `json:"type"` -} diff --git a/model/supplier_role_response.go b/model/supplier_role_response.go deleted file mode 100644 index d7b68fc..0000000 --- a/model/supplier_role_response.go +++ /dev/null @@ -1,5 +0,0 @@ -package model - -type CreateRoleResponse struct { - ID string `json:"_id"` -} diff --git a/model/supplier_user_request.go b/model/supplier_user_request.go deleted file mode 100644 index 66ccb17..0000000 --- a/model/supplier_user_request.go +++ /dev/null @@ -1,51 +0,0 @@ -package model - -type CreateOwnerRequest struct { - Name string `json:"name"` - Phone string `json:"phone"` - Email string `json:"email"` - SupplierID string `json:"supplierId"` - RoleID string `json:"roleId"` - Password string `json:"password"` -} - -type UpdateOwnerRequest struct { - ID string `json:"_id"` - SupplierID string `json:"supplierId"` - Name string `json:"name"` - Phone string `json:"phone"` - Email string `json:"email"` - RoleID string `json:"roleId"` -} - -type CreateStaffRequest struct { - Name string `json:"name"` - Phone string `json:"phone"` - Email string `json:"email"` - SupplierID string `json:"supplierId"` - RoleID string `json:"roleId"` - Password string `json:"password"` - Warehouses []string `json:"warehouses"` -} - -type UpdateStaffRequest struct { - ID string `json:"_id"` - Name string `json:"name"` - Phone string `json:"phone"` - Email string `json:"email"` - SupplierID string `json:"supplierId"` - RoleID string `json:"roleId"` - Password string `json:"password"` - SupplierUserWarehouseID string `json:"supplierUserWarehouseId"` - Warehouses []string `json:"warehouses"` -} - -type UpdateStatusRequest struct { - ID string `json:"_id"` - Status string `json:"status"` -} - -type ResetPasswordRequest struct { - ID string `json:"_id"` - Password string `json:"password"` -} diff --git a/model/supplier_user_response.go b/model/supplier_user_response.go deleted file mode 100644 index 38a1d0c..0000000 --- a/model/supplier_user_response.go +++ /dev/null @@ -1,13 +0,0 @@ -package model - -type CreateOwnerResponse struct { - ID string `json:"_id"` -} - -type CreateStaffResponse struct { - ID string `json:"_id"` -} - -type ResetPasswordResponse struct { - Password string `json:"password"` -} diff --git a/model/warehouse_request.go b/model/warehouse_request.go deleted file mode 100644 index b6cecb1..0000000 --- a/model/warehouse_request.go +++ /dev/null @@ -1,115 +0,0 @@ -package model - -// OutboundRequestPayload ... -type OutboundRequestPayload struct { - OrderID string `json:"orderId"` - OrderCode string `json:"orderCode"` - TrackingCode string `json:"trackingCode"` - WarehouseID string `json:"warehouseId"` - SupplierID string `json:"supplierId"` - Note string `json:"note"` - CODAmount float64 `json:"codAmount"` - TPLCode string `json:"tplCode"` - Customer CustomerInfo `json:"customer"` - Items []OutboundRequestItem `json:"items"` - Insurance *InsuranceOpts `json:"insurance"` - PaymentMethod string `json:"paymentMethod"` -} - -// InsuranceOpts ... -type InsuranceOpts struct { - InsuranceType string `json:"insuranceType"` - VehicleTypeID string `json:"vehicleTypeId"` - VehicleTypeName string `json:"vehicleTypeName"` - InsuranceTypeID string `json:"insuranceTypeId"` - YearsOfInsurance int `json:"yearsOfInsurance"` - License string `json:"license"` - Chassis string `json:"chassis"` - Engine string `json:"engine"` - BeginDate string `json:"beginDate"` - - // For car insurance - NumberOfSeatsCarOccupantAccidentInsurance int `json:"numberOfSeatsCarOccupantAccidentInsurance"` - NumberOfSeats int `json:"numberOfSeats"` - NumberOfSeatsOrTonnageId string `json:"numberOfSeatsOrTonnageId"` - NumberOfSeatsOrTonnageName string `json:"numberOfSeatsOrTonnageName"` -} - -// OutboundRequestItem ... -type OutboundRequestItem struct { - SupplierSKU string `json:"supplierSKU"` - Quantity int64 `json:"quantity"` - UnitCode string `json:"unitCode"` - Price float64 `json:"price"` - Name string `json:"name"` -} - -// CustomerInfo ... -type CustomerInfo struct { - Name string `json:"name"` - PhoneNumber string `json:"phoneNumber"` - Email string `json:"email"` - Address AddressDetail `json:"address"` -} - -// AddressDetail ... -type AddressDetail struct { - Address string `json:"address"` - FullAddress string `json:"fullAddress"` - ProvinceCode int `json:"provinceCode"` - DistrictCode int `json:"districtCode"` - WardCode int `json:"wardCode"` -} - -// UpdateOutboundRequestLogisticInfoPayload ... -type UpdateOutboundRequestLogisticInfoPayload struct { - ShippingLabel string `json:"shippingLabel"` - TrackingCode string `json:"trackingCode"` - ORCode string `json:"orCode"` - TPLCode string `json:"tplCode"` - OrderID string `json:"orderId"` -} - -// CancelOutboundRequest ... -type CancelOutboundRequest struct { - ORCode string `json:"orCode"` - OrderID string `json:"orderId"` - Note string `json:"note"` -} - -// SyncORStatusRequest ... -type SyncORStatusRequest struct { - ORCode string `json:"orCode"` - OrderCode string `json:"orderCode"` - OrderID string `json:"orderId"` -} - -// UpdateSupplierIsClosedRequest ... -type UpdateSupplierIsClosedRequest struct { - Suppliers []SupplierIsClosed `json:"suppliers"` -} - -// SupplierIsClosed ... -type SupplierIsClosed struct { - Supplier string `json:"supplier"` - IsClosed bool `json:"isClosed"` -} - -// GetWarehousesRequest ... -type GetWarehousesRequest struct { - Keyword string `json:"keyword"` - Status string `json:"status"` - Supplier string `json:"supplier"` - BusinessType string `json:"businessType"` - - Page int64 `json:"page"` - Limit int64 `json:"limit"` -} - -// WarehouseORUpdateDeliveryStatus ... -type WarehouseORUpdateDeliveryStatus struct { - ORCode string `json:"orCode"` - OrderCode string `json:"orderCode"` - OrderID string `json:"orderId"` - DeliveryStatus string `json:"deliveryStatus"` -} diff --git a/model/warehouse_response.go b/model/warehouse_response.go deleted file mode 100644 index c667290..0000000 --- a/model/warehouse_response.go +++ /dev/null @@ -1,172 +0,0 @@ -package model - -import "time" - -// OutboundRequestResponse ... -type OutboundRequestResponse struct { - // System code - OrderCode string `json:"orderCode"` - TrackingCode string `json:"trackingCode"` - ID string `json:"id"` // OR id - - // Partner response - ORCode string `json:"orCode"` - RequestID string `json:"requestId"` - Status string `json:"status"` - Reason string `json:"reason"` -} - -// WarehouseConfiguration ... -type WarehouseConfiguration struct { - Warehouse string `json:"warehouse"` - DoesSupportSellyExpress bool `json:"doesSupportSellyExpress"` - Supplier WarehouseSupplier `json:"supplier"` - Order WarehouseOrder `json:"order"` - Partner WarehousePartner `json:"partner"` - Delivery WarehouseDelivery `json:"delivery"` - Other WarehouseOther `json:"other"` - Food WarehouseFood `json:"food"` - AutoConfirmOrder WarehouseOrderConfirm `json:"autoConfirmOrder"` -} - -// WarehouseOrderConfirm ... -type WarehouseOrderConfirm struct { - IsEnable bool `json:"isEnable"` - ConfirmDelayInSeconds int64 `json:"confirmDelayInSeconds"` -} - -// WarehouseFood ... -type WarehouseFood struct { - ForceClosed bool `json:"forceClosed"` - IsClosed bool `json:"isClosed"` - TimeRange []TimeRange `json:"timeRange"` -} - -// TimeRange ... -type TimeRange struct { - From int64 `json:"from"` - To int64 `json:"to"` -} - -// WarehouseOther ... -type WarehouseOther struct { - DoesSupportSellyExpress bool `json:"doesSupportSellyExpress"` -} - -// WarehouseSupplier ... -type WarehouseSupplier struct { - CanAutoSendMail bool `json:"canAutoSendMail"` - InvoiceDeliveryMethod string `json:"invoiceDeliveryMethod"` -} - -// WarehouseOrder ... -type WarehouseOrder struct { - MinimumValue float64 `json:"minimumValue"` - PaymentMethod WarehousePaymentMethod `json:"paymentMethod"` - IsLimitNumberOfPurchases bool `json:"isLimitNumberOfPurchases"` - LimitNumberOfPurchases int64 `json:"limitNumberOfPurchases"` -} - -// WarehousePaymentMethod ... -type WarehousePaymentMethod struct { - Cod bool `json:"cod"` - BankTransfer bool `json:"bankTransfer"` -} - -// WarehouseDelivery ... -type WarehouseDelivery struct { - DeliveryMethods []string `json:"deliveryMethods"` - PriorityServiceCodes []string `json:"priorityServiceCodes"` - EnabledSources []int `json:"enabledSources"` - Types []string `json:"types"` -} - -// WarehousePartner ... -type WarehousePartner struct { - IdentityCode string `json:"identityCode"` - Code string `json:"code"` - Enabled bool `json:"enabled"` - Authentication string `json:"authentication"` -} - -// SyncORStatusResponse ... -type SyncORStatusResponse struct { - ORCode string `json:"orCode"` - OrderCode string `json:"orderCode"` - Status string `json:"status"` - DeliveryStatus string `json:"deliveryStatus"` - Data OrderORData `json:"data"` -} - -// ResponseWarehouseContact ... -type ResponseWarehouseContact struct { - Name string `json:"name"` - Phone string `json:"phone"` - Address string `json:"address"` - Email string `json:"email"` -} - -// ResponseWarehouseLocation ... -type ResponseWarehouseLocation struct { - Province CommonLocation `json:"province"` - District CommonLocation `json:"district"` - Ward CommonLocation `json:"ward"` - Address string `json:"address"` - LocationCoordinates ResponseLatLng `json:"locationCoordinates"` -} - -type CommonLocation struct { - ID string `json:"id"` - Name string `json:"name"` - Code int `json:"code"` -} - -// ResponseLatLng ... -type ResponseLatLng struct { - Latitude float64 `json:"latitude"` - Longitude float64 `json:"longitude"` -} - -// WarehouseNatsResponse ... -type WarehouseNatsResponse struct { - ID string `json:"_id"` - Staff string `json:"staff"` - BusinessType string `json:"businessType"` - Name string `json:"name"` - SearchString string `json:"searchString"` - Slug string `json:"slug"` - Status string `json:"status"` - Supplier string `json:"supplier"` - Contact ResponseWarehouseContact `json:"contact"` - Location ResponseWarehouseLocation `json:"location"` - Configurations WarehouseConfiguration `json:"configurations"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` -} - -// WarehouseInfo ... -type WarehouseInfo struct { - ID string `json:"_id"` - Name string `json:"name"` - BusinessType string `json:"businessType"` - Status string `json:"status"` - Slug string `json:"slug"` - Supplier WarehouseSupplierInfo `json:"supplier"` - Location ResponseWarehouseLocation `json:"location"` - Contact ResponseWarehouseContact `json:"contact"` - CreatedAt string `json:"createdAt"` - UpdatedAt string `json:"updatedAt"` -} - -// WarehouseSupplierInfo ... -type WarehouseSupplierInfo struct { - ID string `json:"_id"` - Name string `json:"name"` -} - -// GetWarehousesResponse ... -type GetWarehousesResponse struct { - Total int64 `json:"total"` - Limit int64 `json:"limit"` - List []WarehouseInfo `json:"list"` -} diff --git a/server_reqres.go b/server_reqres.go index 7b2d66b..335b4a4 100644 --- a/server_reqres.go +++ b/server_reqres.go @@ -49,13 +49,3 @@ func (sv Server) QueueSubscribe(subject, queue string, cb nats.MsgHandler) (*nat } return sub, nil } - -// NewJSONEncodedConn ... -func (sv Server) NewJSONEncodedConn() (*JSONEncoder, error) { - enc, err := nats.NewEncodedConn(sv.instance, nats.JSON_ENCODER) - if err != nil { - log.Printf("natsio.NewJSONEncodedConn: err %v\n", err) - return nil, err - } - return &JSONEncoder{encConn: enc}, nil -} diff --git a/subject/bank.go b/subject/bank.go deleted file mode 100644 index 9f7f8bb..0000000 --- a/subject/bank.go +++ /dev/null @@ -1,17 +0,0 @@ -package subject - -import "fmt" - -func getBankValue(val string) string { - return fmt.Sprintf("%s.%s", prefixes.Bank, val) -} - -var Bank = struct { - GetBankById string - GetBankBranchById string - CheckBankAndBranchByID string -}{ - GetBankById: getBankValue("get_bank_by_id"), - GetBankBranchById: getBankValue("get_bank_branch_by_id"), - CheckBankAndBranchByID: getBankValue("check_bank_and_brach_by_id"), -} diff --git a/subject/campaign.go b/subject/campaign.go deleted file mode 100644 index 8c7ddac..0000000 --- a/subject/campaign.go +++ /dev/null @@ -1,15 +0,0 @@ -package subject - -import "fmt" - -// getCampaignValue ... -func getCampaignValue(val string) string { - return fmt.Sprintf("%s.%s", prefixes.Campaign, val) -} - -// Campaign ... -var Campaign = struct { - GetListCampaignTransactionAdminInfoByIDs string -}{ - GetListCampaignTransactionAdminInfoByIDs: getCampaignValue("get_list_campaign_transaction_admin_info_by_ids"), -} diff --git a/subject/communication.go b/subject/communication.go deleted file mode 100644 index 80926f2..0000000 --- a/subject/communication.go +++ /dev/null @@ -1,15 +0,0 @@ -package subject - -import "fmt" - -func getCommunicationValue(val string) string { - return fmt.Sprintf("%s.%s", prefixes.Communication, val) -} - -var Communication = struct { - RequestHTTP string - ResponseHTTP string -}{ - RequestHTTP: getCommunicationValue("request_http"), - ResponseHTTP: getCommunicationValue("response_http"), -} diff --git a/subject/config.go b/subject/config.go deleted file mode 100644 index bb4e723..0000000 --- a/subject/config.go +++ /dev/null @@ -1,33 +0,0 @@ -package subject - -var prefixes = struct { - Communication string - Order string - News string - Warehouse string - Location string - Bank string - Supplier string - Seller string - SupplierUser string - SupplierRole string - SocialPost string - Staff string - Segment string - Campaign string -}{ - Communication: "communication", - Order: "order", - News: "news", - Warehouse: "warehouse", - Location: "location", - Supplier: "supplier", - Bank: "bank", - Seller: "seller", - SupplierUser: "supplier_user", - SupplierRole: "supplier_role", - SocialPost: "social_post", - Staff: "staff", - Segment: "segment", - Campaign: "campaign", -} diff --git a/subject/location.go b/subject/location.go deleted file mode 100644 index b19a59b..0000000 --- a/subject/location.go +++ /dev/null @@ -1,19 +0,0 @@ -package subject - -import "fmt" - -func getLocationValue(val string) string { - return fmt.Sprintf("%s.%s", prefixes.Location, val) -} - -var Location = struct { - GetLocationByCode string - GetProvincesByCodes string - GetDistrictsByCodes string - GetWardsByCodes string -}{ - GetLocationByCode: getLocationValue("get_location_warehouse"), - GetProvincesByCodes: getLocationValue("get_provinces_by_codes"), - GetDistrictsByCodes: getLocationValue("get_districts_by_codes"), - GetWardsByCodes: getLocationValue("get_wards_by_codes"), -} diff --git a/subject/news.go b/subject/news.go deleted file mode 100644 index bfec6cf..0000000 --- a/subject/news.go +++ /dev/null @@ -1,13 +0,0 @@ -package subject - -import "fmt" - -func getNewsValue(val string) string { - return fmt.Sprintf("%s.%s", prefixes.News, val) -} - -var News = struct { - GetProductNoticesByInventory string -}{ - GetProductNoticesByInventory: getNewsValue("get_product_notices_by_inventory"), -} diff --git a/subject/order.go b/subject/order.go deleted file mode 100644 index 017f2be..0000000 --- a/subject/order.go +++ /dev/null @@ -1,23 +0,0 @@ -package subject - -import "fmt" - -func getOrderValue(val string) string { - return fmt.Sprintf("%s.%s", prefixes.Order, val) -} - -var Order = struct { - UpdateORStatus string - CancelDelivery string - ChangeDeliveryStatus string - UpdateLogisticInfoFailed string - ORNotUpdateStatus string - GetSupplierOrders string -}{ - UpdateORStatus: getOrderValue("update_outbound_request_status"), - CancelDelivery: getOrderValue("cancel_delivery"), - ChangeDeliveryStatus: getOrderValue("change_delivery_status"), - UpdateLogisticInfoFailed: getOrderValue("update_logistic_info_failed"), - ORNotUpdateStatus: getOrderValue("outbound_request_not_update_status"), - GetSupplierOrders: getOrderValue("get_supplier_orders"), -} diff --git a/subject/segment.go b/subject/segment.go deleted file mode 100644 index f6021ca..0000000 --- a/subject/segment.go +++ /dev/null @@ -1,15 +0,0 @@ -package subject - -import "fmt" - -// getSegmentValue ... -func getSegmentValue(val string) string { - return fmt.Sprintf("%s.%s", prefixes.Segment, val) -} - -// Segment ... -var Segment = struct { - GetListSegmentInfo string -}{ - GetListSegmentInfo: getSegmentValue("get_list_segment_info"), -} diff --git a/subject/seller.go b/subject/seller.go deleted file mode 100644 index eba9131..0000000 --- a/subject/seller.go +++ /dev/null @@ -1,23 +0,0 @@ -package subject - -import "fmt" - -func getSellerValue(val string) string { - return fmt.Sprintf("%s.%s", prefixes.Seller, val) -} - -// Seller ... -var Seller = struct { - GetSellerInfoByID string - GetListSellerInfoByIDs string -}{ - GetSellerInfoByID: getSellerValue("get_seller_info_by_id"), - GetListSellerInfoByIDs: getSellerValue("get_list_seller_info_by_ids"), -} - -// SupportChat ... -var SupportChat = struct { - GetListSellerInfoSupportChatByIDs string -}{ - GetListSellerInfoSupportChatByIDs: "SELLY_CHAT.REQUEST.SELLER_INFO", -} diff --git a/subject/social_post.go b/subject/social_post.go deleted file mode 100644 index 029f876..0000000 --- a/subject/social_post.go +++ /dev/null @@ -1,17 +0,0 @@ -package subject - -import "fmt" - -// getSocialPostValue ... -func getSocialPostValue(val string) string { - return fmt.Sprintf("%s.%s", prefixes.SocialPost, val) -} - -// SocialPost ... -var SocialPost = struct { - GetListSocialPostAppInfoByIDs string - GetBriefInfoSocialPostAdminByIDs string -}{ - GetListSocialPostAppInfoByIDs: getSocialPostValue("get_list_social_post_app_info_by_ids"), - GetBriefInfoSocialPostAdminByIDs: getSocialPostValue("get_brief_info_social_post_admin_by_ids"), -} diff --git a/subject/staff.go b/subject/staff.go deleted file mode 100644 index 4777f06..0000000 --- a/subject/staff.go +++ /dev/null @@ -1,14 +0,0 @@ -package subject - -import "fmt" - -func getStaffValue(val string) string { - return fmt.Sprintf("%s.%s", prefixes.Staff, val) -} - -// Staff ... -var Staff = struct { - GetListStaffInfo string -}{ - GetListStaffInfo: getStaffValue("get_list_staff_info"), -} diff --git a/subject/supplier.go b/subject/supplier.go deleted file mode 100644 index edc797f..0000000 --- a/subject/supplier.go +++ /dev/null @@ -1,21 +0,0 @@ -package subject - -import "fmt" - -func getSupplierValue(val string) string { - return fmt.Sprintf("%s.%s", prefixes.Supplier, val) -} - -var Supplier = struct { - GetListSupplierInfo string - GetSupplierContractBySupplierID string - FindAll string - FindAllOld string - Count string -}{ - GetListSupplierInfo: getSupplierValue("get_list_supplier_info"), - GetSupplierContractBySupplierID: getSupplierValue("get_supplier_contract_by_supplier_id"), - FindAll: getSupplierValue("find_all"), - FindAllOld: getSupplierValue("find_all_old"), - Count: getSupplierValue("count"), -} diff --git a/subject/supplier_role.go b/subject/supplier_role.go deleted file mode 100644 index 8915759..0000000 --- a/subject/supplier_role.go +++ /dev/null @@ -1,15 +0,0 @@ -package subject - -import "fmt" - -func getRoleValue(val string) string { - return fmt.Sprintf("%s.%s", prefixes.SupplierRole, val) -} - -var SupplierRole = struct { - Create string - Update string -}{ - Create: getRoleValue("create"), - Update: getRoleValue("update"), -} diff --git a/subject/supplier_user.go b/subject/supplier_user.go deleted file mode 100644 index adc2f1f..0000000 --- a/subject/supplier_user.go +++ /dev/null @@ -1,25 +0,0 @@ -package subject - -import "fmt" - -func getSupplierUserValue(val string) string { - return fmt.Sprintf("%s.%s", prefixes.SupplierUser, val) -} - -var SupplierUser = struct { - // Users - CreateOwner string - UpdateOwner string - CreateStaff string - UpdateStaff string - UpdateStatus string - ResetPassword string -}{ - // Users - CreateOwner: getSupplierUserValue("create_owner"), - UpdateOwner: getSupplierUserValue("update_owner"), - CreateStaff: getSupplierUserValue("create_staff"), - UpdateStaff: getSupplierUserValue("update_staff"), - UpdateStatus: getSupplierUserValue("update_status"), - ResetPassword: getSupplierUserValue("reset_password"), -} diff --git a/subject/warehouse.go b/subject/warehouse.go deleted file mode 100644 index bb184b5..0000000 --- a/subject/warehouse.go +++ /dev/null @@ -1,49 +0,0 @@ -package subject - -import "fmt" - -func getWarehouseValue(val string) string { - return fmt.Sprintf("%s.%s", prefixes.Warehouse, val) -} - -var Warehouse = struct { - CreateWarehouseIntoServiceSupplier string - UpdateWarehouseIntoServiceSupplier string - CreateOutboundRequest string - UpdateOutboundRequestLogistic string - CancelOutboundRequest string - GetConfiguration string - SyncORStatus string - WebhookTNC string - WebhookGlobalCare string - WebhookOnPoint string - FindOne string - FindByCondition string - Distinct string - Count string - AfterUpdateWarehouse string - AfterCreateWarehouse string - UpdateIsClosedSupplier string - GetWarehouses string - UpdateORDeliveryStatus string -}{ - CreateWarehouseIntoServiceSupplier: getWarehouseValue("create_warehouse_into_service_supplier"), - UpdateWarehouseIntoServiceSupplier: getWarehouseValue("update_warehouse_into_service_supplier"), - AfterCreateWarehouse: getWarehouseValue("after_create_warehouse"), - AfterUpdateWarehouse: getWarehouseValue("after_update_warehouse"), - CreateOutboundRequest: getWarehouseValue("create_outbound_request"), - UpdateOutboundRequestLogistic: getWarehouseValue("update_outbound_request_logistic_info"), - CancelOutboundRequest: getWarehouseValue("cancel_outbound_request"), - GetConfiguration: getWarehouseValue("get_configuration"), - SyncORStatus: getWarehouseValue("sync_or_status"), - WebhookTNC: getWarehouseValue("webhook_tnc"), - WebhookGlobalCare: getWarehouseValue("webhook_global_care"), - WebhookOnPoint: getWarehouseValue("webhook_on_point"), - FindOne: getWarehouseValue("find_one"), - FindByCondition: getWarehouseValue("find_all_by_condition"), - Distinct: getWarehouseValue("distinct"), - Count: getWarehouseValue("count"), - UpdateIsClosedSupplier: getWarehouseValue("update_is_closed_supplier"), - GetWarehouses: getWarehouseValue("get_warehouses"), - UpdateORDeliveryStatus: getWarehouseValue("update_or_delivery_status"), -}