diff --git a/client/affiliate.go b/client/affiliate.go new file mode 100644 index 0000000..58e8bd0 --- /dev/null +++ b/client/affiliate.go @@ -0,0 +1,36 @@ +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" +) + +// Affiliate ... +type Affiliate struct{} + +// GetAffiliate ... +func GetAffiliate() Affiliate { + return Affiliate{} +} + +// GetTransactions ... +func (w Affiliate) GetTransactions(p model.GetTransactionsRequest) (*model.GetTransactionsResponse, error) { + msg, err := natsio.GetServer().Request(subject.Affiliate.GetTransactions, toBytes(p)) + if err != nil { + return nil, err + } + var r struct { + Data *model.GetTransactionsResponse `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 new file mode 100644 index 0000000..8368230 --- /dev/null +++ b/client/campaign.go @@ -0,0 +1,58 @@ +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 +} + +// GetCampaignSellerStatistic .... +func (c Campaign) GetCampaignSellerStatistic(req model.GetCampaignSellerStatisticBySellerIDs) (*model.ResponseCampaignSellerStatisticList, error) { + msg, err := natsio.GetServer().Request(subject.Campaign.GetCampaignSellerStatisticBySellerIDs, toBytes(req)) + if err != nil { + return nil, err + } + + var r struct { + Data *model.ResponseCampaignSellerStatisticList `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 index 2e7f0a3..a6ab736 100644 --- a/client/order.go +++ b/client/order.go @@ -98,3 +98,24 @@ func (o Order) ORNotUpdateStatus(p model.OrderORsNotUpdateStatus) 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 new file mode 100644 index 0000000..bcc7bab --- /dev/null +++ b/client/segmnet.go @@ -0,0 +1,41 @@ +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/social_post.go b/client/social_post.go new file mode 100644 index 0000000..72b1781 --- /dev/null +++ b/client/social_post.go @@ -0,0 +1,65 @@ +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 new file mode 100644 index 0000000..b175f53 --- /dev/null +++ b/client/staff.go @@ -0,0 +1,41 @@ +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 index 1ed20d0..149aad6 100644 --- a/client/supplier.go +++ b/client/supplier.go @@ -38,6 +38,28 @@ func (s Supplier) GetListSupplierInfo(p model.GetSupplierRequest) ([]*model.Resp return r.Data, nil } +// GetDetailSupplierInfo ... +func (s Supplier) GetDetailSupplierInfo(p model.GetDetailSupplierRequest) (*model.ResponseSupplierInfo, error) { + msg, err := natsio.GetServer().Request(subject.Supplier.GetDetailSupplierInfo, 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 { @@ -80,6 +102,27 @@ func (s Supplier) FindAll(supplierID model.SupplierRequestPayload) (*model.Suppl 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 { @@ -101,6 +144,27 @@ func (s Supplier) GetBankInfoByID(supplierID model.SupplierRequestPayload) (*mod 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)) diff --git a/client/supplier_role.go b/client/supplier_role.go new file mode 100644 index 0000000..3bf068d --- /dev/null +++ b/client/supplier_role.go @@ -0,0 +1,58 @@ +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 index 8bb10c5..7da7f6a 100644 --- a/client/supplier_user.go +++ b/client/supplier_user.go @@ -16,15 +16,15 @@ func GetSupplierUser() SupplierUser { return SupplierUser{} } -func (s SupplierUser) CreateSupplierOwnerUsers(p model.CreateSupplierOwnerUserRequest) (*model.CreateSupplierUserOwnerResponse, error) { - msg, err := natsio.GetServer().Request(subject.SupplierUser.CreateSupplierOwnerUser, toBytes(p)) +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.CreateSupplierUserOwnerResponse `json:"data"` - Error string `json:"error"` + Data *model.CreateOwnerResponse `json:"data"` + Error string `json:"error"` } if err = json.Unmarshal(msg.Data, &r); err != nil { @@ -37,8 +37,8 @@ func (s SupplierUser) CreateSupplierOwnerUsers(p model.CreateSupplierOwnerUserRe return r.Data, nil } -func (s SupplierUser) UpdateSupplierOwnerUsers(p model.UpdateSupplierOwnerUserRequest) error { - msg, err := natsio.GetServer().Request(subject.SupplierUser.UpdateSupplierOwnerUser, toBytes(p)) +func (s SupplierUser) UpdateSupplierOwnerUsers(p model.UpdateOwnerRequest) error { + msg, err := natsio.GetServer().Request(subject.SupplierUser.UpdateOwner, toBytes(p)) if err != nil { return err } @@ -57,15 +57,15 @@ func (s SupplierUser) UpdateSupplierOwnerUsers(p model.UpdateSupplierOwnerUserRe return nil } -func (s SupplierUser) CreateSupplierStaffUsers(p model.CreateSupplierStaffUserRequest) (*model.CreateSupplierUserStaffResponse, error) { - msg, err := natsio.GetServer().Request(subject.SupplierUser.CreateSupplierStaffUser, toBytes(p)) +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.CreateSupplierUserStaffResponse `json:"data"` - Error string `json:"error"` + Data *model.CreateStaffResponse `json:"data"` + Error string `json:"error"` } if err = json.Unmarshal(msg.Data, &r); err != nil { @@ -78,8 +78,8 @@ func (s SupplierUser) CreateSupplierStaffUsers(p model.CreateSupplierStaffUserRe return r.Data, nil } -func (s SupplierUser) UpdateSupplierStaffUsers(p model.CreateSupplierStaffUserRequest) error { - msg, err := natsio.GetServer().Request(subject.SupplierUser.UpdateSupplierStaffUser, toBytes(p)) +func (s SupplierUser) UpdateSupplierStaffUsers(p model.UpdateStaffRequest) error { + msg, err := natsio.GetServer().Request(subject.SupplierUser.UpdateStaff, toBytes(p)) if err != nil { return err } @@ -97,3 +97,64 @@ func (s SupplierUser) UpdateSupplierStaffUsers(p model.CreateSupplierStaffUserRe 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 +} + +// CheckTokenSupplierUser ... +func (s SupplierUser) CheckTokenSupplierUser(p model.CheckTokenSupplierUserPayload) (*model.ResponseCheckTokenSupplierUser, error) { + msg, err := natsio.GetServer().Request(subject.SupplierUser.CheckTokenSupplierUser, toBytes(p)) + if err != nil { + return nil, err + } + + var r struct { + Error string `json:"error"` + Data *model.ResponseCheckTokenSupplierUser `json:"data"` + } + 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/warehouse.go b/client/warehouse.go index 944c2cb..fb391ca 100644 --- a/client/warehouse.go +++ b/client/warehouse.go @@ -3,6 +3,7 @@ package client import ( "encoding/json" "errors" + "fmt" "git.selly.red/Selly-Modules/natsio" "git.selly.red/Selly-Modules/natsio/model" @@ -163,3 +164,21 @@ func (w Warehouse) GetWarehouses(p model.GetWarehousesRequest) (*model.GetWareho } 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/js/model/selly.go b/js/model/selly.go index a8e0a60..68d3342 100644 --- a/js/model/selly.go +++ b/js/model/selly.go @@ -12,8 +12,9 @@ type PushNotification struct { // NotificationOptions ... type NotificationOptions struct { - Title string `json:"title"` - Content string `json:"content"` + Title string `json:"title"` + Content string `json:"content"` + CampaignID string `json:"campaignId,omitempty"` } // PayloadUpdateSellerAffiliateStatistic ... @@ -57,4 +58,8 @@ 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/model/affiliate_request.go b/model/affiliate_request.go new file mode 100644 index 0000000..359391b --- /dev/null +++ b/model/affiliate_request.go @@ -0,0 +1,16 @@ +package model + +import "time" + +// GetTransactionsRequest ... +type GetTransactionsRequest struct { + Page int64 `json:"page"` + Limit int64 `json:"limit"` + Keyword string `json:"keyword"` + Status string `json:"status"` + Source string `json:"source"` + Campaign string `json:"campaign"` + Seller string `json:"seller"` + FromAt time.Time `json:"fromAt"` + ToAt time.Time `json:"toAt"` +} diff --git a/model/affiliate_response.go b/model/affiliate_response.go new file mode 100644 index 0000000..bb8f804 --- /dev/null +++ b/model/affiliate_response.go @@ -0,0 +1,38 @@ +package model + +// GetTransactionsResponse ... +type GetTransactionsResponse struct { + Total int64 `json:"total"` + Limit int64 `json:"limit"` + List []TransactionInfo `json:"list"` +} + +// TransactionInfo ... +type TransactionInfo struct { + ID string `json:"_id"` + Code string `json:"code"` + Campaign ResponseCampaignShort `json:"campaign"` + Seller ResponseSellerInfo `json:"seller"` + Source string `json:"source"` + Commission ResponseCampaignCommission `json:"commission"` + EstimateSellerCommission float64 `json:"estimateSellerCommission"` + TransactionTime string `json:"transactionTime"` + Status string `json:"status"` + RejectedReason string `json:"rejectedReason"` + EstimateCashbackAt string `json:"estimateCashbackAt"` +} + +// ResponseCampaignCommission ... +type ResponseCampaignCommission struct { + Real float64 `json:"real"` + SellerPercent float64 `json:"sellerPercent"` + Selly float64 `json:"selly"` + Seller float64 `json:"seller"` +} + +// ResponseCampaignShort ... +type ResponseCampaignShort struct { + ID string `json:"_id"` + Name string `json:"name"` + Logo *FilePhoto `json:"logo"` +} diff --git a/model/campaign_request.go b/model/campaign_request.go new file mode 100644 index 0000000..8033196 --- /dev/null +++ b/model/campaign_request.go @@ -0,0 +1,22 @@ +package model + +import ( + "go.mongodb.org/mongo-driver/bson/primitive" + "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"` +} + +// GetCampaignSellerStatisticBySellerIDs ... +type GetCampaignSellerStatisticBySellerIDs struct { + SellerIDs []primitive.ObjectID +} diff --git a/model/campaign_response.go b/model/campaign_response.go new file mode 100644 index 0000000..65199e9 --- /dev/null +++ b/model/campaign_response.go @@ -0,0 +1,88 @@ +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"` + RejectReason string `json:"rejectReason,omitempty"` + AdminConfirmData *ResponseCampaignTransactionAdminConfirmData `json:"adminConfirmData,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"` +} + +// ResponseCampaignTransactionAdminConfirmData ... +type ResponseCampaignTransactionAdminConfirmData struct { + FriendPublicTotal int64 `json:"friendPublicTotal"` +} + +// ResponseCampaignSellerStatisticList ... +type ResponseCampaignSellerStatisticList struct { + List []ResponseCampaignSellerStatistic `json:"list"` +} + +// ResponseCampaignSellerStatistic ... +type ResponseCampaignSellerStatistic struct { + SellerID primitive.ObjectID `json:"sellerId"` + Statistic CampaignSellerStatistic `json:"Statistic"` +} + +// CampaignSellerStatistic ... +type CampaignSellerStatistic struct { + TotalNotRejected int64 `bson:"totalNotRejected" json:"totalNotRejected"` + CashTotalNotRejected float64 `bson:"cashTotalNotRejected" json:"cashTotalNotRejected"` + + TotalCompleted int64 `bson:"totalCompleted" json:"totalCompleted"` + CashTotalCompleted float64 `bson:"cashTotalCompleted" json:"cashTotalCompleted"` + + TotalPending int64 `bson:"totalPending" json:"totalPending"` + CashTotalPending float64 `bson:"cashTotalPending" json:"cashTotalPending"` + + TotalApproved int64 `bson:"totalApproved" json:"totalApproved"` + CashTotalApproved float64 `bson:"cashTotalApproved" json:"cashTotalApproved"` + + TotalRejected int64 `bson:"totalRejected" json:"totalRejected"` + CashTotalRejected float64 `bson:"cashTotalRejected" json:"cashTotalRejected"` +} diff --git a/model/file_response.go b/model/file_response.go new file mode 100644 index 0000000..6eff304 --- /dev/null +++ b/model/file_response.go @@ -0,0 +1,56 @@ +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/order_request.go b/model/order_request.go index af4989d..bd1fa73 100644 --- a/model/order_request.go +++ b/model/order_request.go @@ -2,6 +2,7 @@ package model // OrderUpdateORStatus ... type OrderUpdateORStatus struct { + ID string `json:"id"` OrderCode string `json:"orderCode"` ORCode string `json:"orCode"` Status string `json:"status"` @@ -38,3 +39,13 @@ type OrderUpdateLogisticInfoFailed struct { 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 new file mode 100644 index 0000000..c08f87a --- /dev/null +++ b/model/order_response.go @@ -0,0 +1,35 @@ +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 new file mode 100644 index 0000000..138f347 --- /dev/null +++ b/model/segment_request.go @@ -0,0 +1,6 @@ +package model + +// GetListSegmentRequest ... +type GetListSegmentRequest struct { + SegmentIds []string `json:"segmentIds"` +} diff --git a/model/segment_response.go b/model/segment_response.go new file mode 100644 index 0000000..84a1571 --- /dev/null +++ b/model/segment_response.go @@ -0,0 +1,12 @@ +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/social_post_request.go b/model/social_post_request.go new file mode 100644 index 0000000..efeb983 --- /dev/null +++ b/model/social_post_request.go @@ -0,0 +1,13 @@ +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 new file mode 100644 index 0000000..85a2445 --- /dev/null +++ b/model/social_post_response.go @@ -0,0 +1,61 @@ +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 new file mode 100644 index 0000000..176b34e --- /dev/null +++ b/model/staff_request.go @@ -0,0 +1,6 @@ +package model + +// GetListStaffRequest ... +type GetListStaffRequest struct { + StaffIds []string `json:"staffIds"` +} diff --git a/model/staff_response.go b/model/staff_response.go new file mode 100644 index 0000000..5076d0c --- /dev/null +++ b/model/staff_response.go @@ -0,0 +1,12 @@ +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 index 5a19924..5d6fbe2 100644 --- a/model/supplier_request.go +++ b/model/supplier_request.go @@ -9,6 +9,11 @@ type GetSupplierRequest struct { ListID []primitive.ObjectID `json:"listID"` } +// GetDetailSupplierRequest ... +type GetDetailSupplierRequest struct { + Supplier string `json:"supplier"` +} + type GetSupplierContractRequest struct { SupplierID primitive.ObjectID `json:"supplierID"` } @@ -38,3 +43,17 @@ type UpdateSupplierWarehousePayload struct { 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 index 975a8de..2b9dd10 100644 --- a/model/supplier_response.go +++ b/model/supplier_response.go @@ -29,3 +29,7 @@ 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 new file mode 100644 index 0000000..6402622 --- /dev/null +++ b/model/supplier_role_request.go @@ -0,0 +1,14 @@ +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 new file mode 100644 index 0000000..d7b68fc --- /dev/null +++ b/model/supplier_role_response.go @@ -0,0 +1,5 @@ +package model + +type CreateRoleResponse struct { + ID string `json:"_id"` +} diff --git a/model/supplier_user_request.go b/model/supplier_user_request.go index f4556b2..2e1c066 100644 --- a/model/supplier_user_request.go +++ b/model/supplier_user_request.go @@ -1,6 +1,6 @@ package model -type CreateSupplierOwnerUserRequest struct { +type CreateOwnerRequest struct { Name string `json:"name"` Phone string `json:"phone"` Email string `json:"email"` @@ -9,7 +9,7 @@ type CreateSupplierOwnerUserRequest struct { Password string `json:"password"` } -type UpdateSupplierOwnerUserRequest struct { +type UpdateOwnerRequest struct { ID string `json:"_id"` SupplierID string `json:"supplierId"` Name string `json:"name"` @@ -18,7 +18,7 @@ type UpdateSupplierOwnerUserRequest struct { RoleID string `json:"roleId"` } -type CreateSupplierStaffUserRequest struct { +type CreateStaffRequest struct { Name string `json:"name"` Phone string `json:"phone"` Email string `json:"email"` @@ -28,14 +28,30 @@ type CreateSupplierStaffUserRequest struct { Warehouses []string `json:"warehouses"` } -type UpdateSupplierStaffUserRequest struct { - ID string `json:"_id"` - Name string `json:"name"` - Phone string `json:"phone"` - Email string `json:"email"` - SupplierID string `json:"supplierId"` - Role string `json:"role"` - Password string `json:"password"` - Warehouses []string `json:"warehouses"` - RoleId string `json:"roleId"` +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"` +} + +// CheckTokenSupplierUserPayload ... +type CheckTokenSupplierUserPayload struct { + Token string `json:"token"` + Permissions []string `json:"permissions"` } diff --git a/model/supplier_user_response.go b/model/supplier_user_response.go index 7241bad..3b98d1c 100644 --- a/model/supplier_user_response.go +++ b/model/supplier_user_response.go @@ -1,9 +1,26 @@ package model -type CreateSupplierUserOwnerResponse struct { +type CreateOwnerResponse struct { ID string `json:"_id"` } -type CreateSupplierUserStaffResponse struct { +type CreateStaffResponse struct { ID string `json:"_id"` } + +type ResetPasswordResponse struct { + Password string `json:"password"` +} + +// ResponseCheckTokenSupplierUser ... +type ResponseCheckTokenSupplierUser struct { + IsValid bool `json:"isValid"` + Reason string `json:"reason"` + User ResponseSupplierUserInfo `json:"supplier"` +} + +type ResponseSupplierUserInfo struct { + ID string `json:"_id"` + Name string `json:"name"` + SupplierID string `json:"supplierId"` +} diff --git a/model/warehouse_request.go b/model/warehouse_request.go index 1085fe2..b6cecb1 100644 --- a/model/warehouse_request.go +++ b/model/warehouse_request.go @@ -2,17 +2,18 @@ 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"` + 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 ... @@ -36,9 +37,11 @@ type InsuranceOpts struct { // OutboundRequestItem ... type OutboundRequestItem struct { - SupplierSKU string `json:"supplierSKU"` - Quantity int64 `json:"quantity"` - UnitCode string `json:"unitCode"` + SupplierSKU string `json:"supplierSKU"` + Quantity int64 `json:"quantity"` + UnitCode string `json:"unitCode"` + Price float64 `json:"price"` + Name string `json:"name"` } // CustomerInfo ... @@ -63,18 +66,22 @@ 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"` - Note string `json:"note"` + 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 ... @@ -98,3 +105,11 @@ type GetWarehousesRequest struct { 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 index 0b6cee0..293d2a6 100644 --- a/model/warehouse_response.go +++ b/model/warehouse_response.go @@ -130,19 +130,21 @@ type ResponseLatLng struct { // 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"` + 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"` + ReasonPendingInactive string `json:"reasonPendingInactive"` + IsPendingInactive bool `json:"isPendingInactive"` } // WarehouseInfo ... diff --git a/subject/affiliate.go b/subject/affiliate.go new file mode 100644 index 0000000..cd59597 --- /dev/null +++ b/subject/affiliate.go @@ -0,0 +1,13 @@ +package subject + +import "fmt" + +func getAffiliateValue(val string) string { + return fmt.Sprintf("%s.%s", prefixes.Affiliate, val) +} + +var Affiliate = struct { + GetTransactions string +}{ + GetTransactions: getAffiliateValue("get_transactions"), +} diff --git a/subject/campaign.go b/subject/campaign.go new file mode 100644 index 0000000..a986f69 --- /dev/null +++ b/subject/campaign.go @@ -0,0 +1,17 @@ +package subject + +import "fmt" + +// getCampaignValue ... +func getCampaignValue(val string) string { + return fmt.Sprintf("%s.%s", prefixes.Campaign, val) +} + +// Campaign ... +var Campaign = struct { + GetListCampaignTransactionAdminInfoByIDs string + GetCampaignSellerStatisticBySellerIDs string +}{ + GetListCampaignTransactionAdminInfoByIDs: getCampaignValue("get_list_campaign_transaction_admin_info_by_ids"), + GetCampaignSellerStatisticBySellerIDs: getCampaignValue("get_campaign_seller_statistic_by_seller_ids"), +} diff --git a/subject/config.go b/subject/config.go index d50d9d4..1954121 100644 --- a/subject/config.go +++ b/subject/config.go @@ -10,6 +10,12 @@ var prefixes = struct { Supplier string Seller string SupplierUser string + SupplierRole string + SocialPost string + Staff string + Segment string + Campaign string + Affiliate string }{ Communication: "communication", Order: "order", @@ -20,4 +26,10 @@ var prefixes = struct { Bank: "bank", Seller: "seller", SupplierUser: "supplier_user", + SupplierRole: "supplier_role", + SocialPost: "social_post", + Staff: "staff", + Segment: "segment", + Campaign: "campaign", + Affiliate: "affiliate", } diff --git a/subject/order.go b/subject/order.go index 1452de3..017f2be 100644 --- a/subject/order.go +++ b/subject/order.go @@ -12,10 +12,12 @@ var Order = struct { 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 new file mode 100644 index 0000000..f6021ca --- /dev/null +++ b/subject/segment.go @@ -0,0 +1,15 @@ +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/social_post.go b/subject/social_post.go new file mode 100644 index 0000000..029f876 --- /dev/null +++ b/subject/social_post.go @@ -0,0 +1,17 @@ +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 new file mode 100644 index 0000000..4777f06 --- /dev/null +++ b/subject/staff.go @@ -0,0 +1,14 @@ +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 index 17ca8d0..4fc3d32 100644 --- a/subject/supplier.go +++ b/subject/supplier.go @@ -8,10 +8,16 @@ func getSupplierValue(val string) string { var Supplier = struct { GetListSupplierInfo string + GetDetailSupplierInfo string GetSupplierContractBySupplierID string FindAll string + FindAllOld string + Count string }{ GetListSupplierInfo: getSupplierValue("get_list_supplier_info"), + GetDetailSupplierInfo: getSupplierValue("get_detail_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 new file mode 100644 index 0000000..8915759 --- /dev/null +++ b/subject/supplier_role.go @@ -0,0 +1,15 @@ +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 index 7abb4c7..5c99eb4 100644 --- a/subject/supplier_user.go +++ b/subject/supplier_user.go @@ -2,18 +2,26 @@ package subject import "fmt" -func getAuthSMSValue(val string) string { +func getSupplierUserValue(val string) string { return fmt.Sprintf("%s.%s", prefixes.SupplierUser, val) } var SupplierUser = struct { - CreateSupplierOwnerUser string - UpdateSupplierOwnerUser string - CreateSupplierStaffUser string - UpdateSupplierStaffUser string + // Users + CreateOwner string + UpdateOwner string + CreateStaff string + UpdateStaff string + UpdateStatus string + ResetPassword string + CheckTokenSupplierUser string }{ - CreateSupplierOwnerUser: getAuthSMSValue("create_supplier_owner_user"), - UpdateSupplierOwnerUser: getAuthSMSValue("update_supplier_owner_user"), - CreateSupplierStaffUser: getAuthSMSValue("create_supplier_staff_user"), - UpdateSupplierStaffUser: getAuthSMSValue("update_supplier_staff_user"), + // 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"), + CheckTokenSupplierUser: getSupplierUserValue("check_token_supplier_user"), } diff --git a/subject/warehouse.go b/subject/warehouse.go index 3722edd..bb184b5 100644 --- a/subject/warehouse.go +++ b/subject/warehouse.go @@ -9,37 +9,41 @@ func getWarehouseValue(val string) string { var Warehouse = struct { CreateWarehouseIntoServiceSupplier string UpdateWarehouseIntoServiceSupplier string - CreateOutboundRequest string - UpdateOutboundRequestLogistic string - CancelOutboundRequest string - GetConfiguration string - SyncORStatus string - WebhookTNC string - WebhookGlobalCare string - FindOne string - FindByCondition string - Distinct string - Count string - AfterUpdateWarehouse string - AfterCreateWarehouse string - UpdateIsClosedSupplier string - GetWarehouses 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"), - 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"), + 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"), }