Compare commits

...

23 Commits

Author SHA1 Message Date
QuanTT0110 b45fb1d19a sync data warehouse into service supplier 2022-11-08 14:20:05 +07:00
QuanTT0110 040c867c15 sync data warehouse into service supplier 2022-11-08 11:12:37 +07:00
QuanTT0110 5c3c5b6dcb sync data warehouse into service supplier 2022-11-08 11:09:35 +07:00
QuanTT0110 ae16428783 sync data warehouse into service supplier 2022-11-08 11:05:34 +07:00
Sinh 0d3c931c87 define nats func - supplier balance 2022-11-04 10:28:09 +07:00
Sinh aeec881299 define nats func - supplier balance 2022-11-03 16:02:43 +07:00
Sinh b345cd5395 Pull origin build-auth-sms into refactor-supplier 2022-11-03 11:09:36 +07:00
Tue 9407b2df6b build auth sms 2022-11-03 10:47:19 +07:00
Tue 49426e322c build auth sms 2022-11-03 00:17:49 +07:00
Sinh ac1ec030db define nats func - get supplier order cash and supplier withdraw cash 2022-11-02 17:27:10 +07:00
Sinh 816316b558 define nats func - get supplier order cash and supplier withdraw cash 2022-11-02 17:18:11 +07:00
Tue 55e3c07cf6 build auth sms 2022-11-02 16:49:12 +07:00
Sinh 868df4713d Merge branch 'master' of git.selly.red:Selly-Modules/natsio into refactor-supplier 2022-11-02 16:24:07 +07:00
Sinh e26762916c Merge branch 'master' of git.selly.red:Selly-Modules/natsio into refactor-supplier 2022-11-02 16:11:41 +07:00
Tue 19349b9813 build auth sms 2022-11-02 14:57:26 +07:00
Tue 285ddb75e7 build auth sms 2022-11-01 11:40:37 +07:00
Tue 56d210bf2d build auth sms 2022-11-01 10:44:41 +07:00
Tue 0d8e3969db build auth sms 2022-10-31 16:59:38 +07:00
Tue 64ad17016c Merge branch 'master' of git.selly.red:Selly-Modules/natsio into build-auth-sms 2022-10-31 16:59:28 +07:00
Tue f6a2b34a7f build authsms 2022-10-31 10:07:08 +07:00
Sinh 708fad7c59 Merge branch 'master' of git.selly.red:Selly-Modules/natsio into refactor-supplier 2022-10-27 09:19:13 +07:00
Sinh 97686ff405 Merge branch 'master' of git.selly.red:Selly-Modules/natsio into refactor-supplier 2022-10-27 09:16:36 +07:00
Sinh 20f460b4ef create supplier cashflow 2022-10-26 17:56:15 +07:00
33 changed files with 683 additions and 91 deletions

31
client/notification.go Normal file
View File

@ -0,0 +1,31 @@
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"
)
func GetNotification() Notification {
return Notification{}
}
type Notification struct{}
func (n Notification) SupplierChangeBalanceRequestApproved(p model.NotificationSupplierChangeBalanceRequestApprovedReq) error {
msg, err := natsio.GetServer().Request(subject.Notification.SupplierChangeBalanceRequestApproved, 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
}

View File

@ -119,3 +119,24 @@ func (o Order) GetSupplierOrders(p model.OrderSupplierQuery) (*model.SupplierOrd
} }
return &r.Data, nil return &r.Data, nil
} }
// GetSupplierCash ...
func (o Order) GetSupplierCash(p model.OrderSupplierCashReq) (*model.OrderSupplierCashRes, error) {
msg, err := natsio.GetServer().Request(subject.Order.GetSupplierCash, toBytes(p))
if err != nil {
return nil, err
}
var (
r struct {
Data model.OrderSupplierCashRes `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
}

View File

@ -101,9 +101,9 @@ func (s Supplier) GetBankInfoByID(supplierID model.SupplierRequestPayload) (*mod
return r.Data, nil return r.Data, nil
} }
// CreateWarehouseIntoServiceSupplier ... // SyncWarehouseIntoServiceSupplier ...
func (s Supplier) CreateWarehouseIntoServiceSupplier(p model.CreateSupplierWarehousePayload) error { func (s Supplier) SyncWarehouseIntoServiceSupplier(p model.SyncSupplierWarehousePayload) error {
msg, err := natsio.GetServer().Request(subject.Warehouse.CreateWarehouseIntoServiceSupplier, toBytes(p)) msg, err := natsio.GetServer().Request(subject.Warehouse.SyncWarehouseIntoServiceSupplier, toBytes(p))
if err != nil { if err != nil {
return err return err
} }
@ -119,9 +119,63 @@ func (s Supplier) CreateWarehouseIntoServiceSupplier(p model.CreateSupplierWareh
return nil return nil
} }
// UpdateWarehouseIntoServiceSupplier ... // CreateCashflow ...
func (s Supplier) UpdateWarehouseIntoServiceSupplier(p model.UpdateSupplierWarehousePayload) error { func (s Supplier) CreateCashflow(p model.SupplierCashflowCreatePayload) (*model.SupplierCashflowCreateResponse, error) {
msg, err := natsio.GetServer().Request(subject.Warehouse.UpdateWarehouseIntoServiceSupplier, toBytes(p)) msg, err := natsio.GetServer().Request(subject.Supplier.CreateCashflow, toBytes(p))
if err != nil {
return nil, err
}
var r struct {
Error string `json:"error"`
Data *model.SupplierCashflowCreateResponse `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
}
func (s Supplier) UpdateBalance(p model.SupplierUpdateBalanceReq) (*model.SupplierUpdateBalanceRes, error) {
msg, err := natsio.GetServer().Request(subject.Supplier.UpdateBalance, toBytes(p))
if err != nil {
return nil, err
}
var r struct {
Error string `json:"error"`
Data *model.SupplierUpdateBalanceRes `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
}
func (s Supplier) GetCurrentBalance(p model.SupplierGetCurrentBalanceReq) (*model.SupplierGetCurrentBalanceRes, error) {
msg, err := natsio.GetServer().Request(subject.Supplier.GetCurrentBalance, toBytes(p))
if err != nil {
return nil, err
}
var r struct {
Error string `json:"error"`
Data *model.SupplierGetCurrentBalanceRes `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
}
func (s Supplier) DeleteCashflow(p model.SupplierDeleteCashflowReq) error {
msg, err := natsio.GetServer().Request(subject.Supplier.DeleteCashflow, toBytes(p))
if err != nil { if err != nil {
return err return err
} }

View File

@ -0,0 +1,79 @@
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"
)
// SupplierPermission ...
type SupplierPermission struct{}
// GetSupplierPermission ...
func GetSupplierPermission() SupplierPermission {
return SupplierPermission{}
}
func (s SupplierPermission) GetListPermission(p model.GetListPermissionRequest) (*model.GetListPermissionResponse, error) {
msg, err := natsio.GetServer().Request(subject.SupplierPermission.GetList, toBytes(p))
if err != nil {
return nil, err
}
var r struct {
Data *model.GetListPermissionResponse `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 SupplierPermission) CreatePermission(p model.CreatePermissionRequest) (*model.CreatePermissionResponse, error) {
msg, err := natsio.GetServer().Request(subject.SupplierPermission.Create, toBytes(p))
if err != nil {
return nil, err
}
var r struct {
Data *model.CreatePermissionResponse `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 SupplierPermission) UpdatePermission(p model.UpdatePermissionRequest) error {
msg, err := natsio.GetServer().Request(subject.SupplierPermission.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
}

View File

@ -16,8 +16,28 @@ func GetSupplierRole() SupplierRole {
return SupplierRole{} return SupplierRole{}
} }
func (s SupplierRole) GetListRole(p model.GetListRoleRequest) (*model.GetListRoleResponse, error) {
msg, err := natsio.GetServer().Request(subject.SupplierRole.GetList, toBytes(p))
if err != nil {
return nil, err
}
var r struct {
Data *model.GetListRoleResponse `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) CreateRole(p model.CreateRoleRequest) (*model.CreateRoleResponse, error) { func (s SupplierRole) CreateRole(p model.CreateRoleRequest) (*model.CreateRoleResponse, error) {
msg, err := natsio.GetServer().Request(subject.SupplierUser.CreateOwner, toBytes(p)) msg, err := natsio.GetServer().Request(subject.SupplierRole.Create, toBytes(p))
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -56,3 +76,24 @@ func (s SupplierRole) UpdateRole(p model.UpdateRoleRequest) error {
return nil return nil
} }
func (s SupplierRole) DetailRole(p model.DetailRoleRequest) (*model.RoleBrief, error) {
msg, err := natsio.GetServer().Request(subject.SupplierRole.Detail, toBytes(p))
if err != nil {
return nil, err
}
var r struct {
Data *model.RoleBrief `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
}

View File

@ -16,6 +16,48 @@ func GetSupplierUser() SupplierUser {
return SupplierUser{} return SupplierUser{}
} }
func (s SupplierUser) LoginUser(p model.LoginUserRequest) (*model.LoginUserResponse, error) {
msg, err := natsio.GetServer().Request(subject.SupplierUser.LoginUser, toBytes(p))
if err != nil {
return nil, err
}
var r struct {
Data *model.LoginUserResponse `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) GetListUser(p model.GetListUserRequest) (*model.GetListUserResponse, error) {
msg, err := natsio.GetServer().Request(subject.SupplierUser.GetListUser, toBytes(p))
if err != nil {
return nil, err
}
var r struct {
Data *model.GetListUserResponse `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) CreateSupplierOwnerUsers(p model.CreateOwnerRequest) (*model.CreateOwnerResponse, error) { func (s SupplierUser) CreateSupplierOwnerUsers(p model.CreateOwnerRequest) (*model.CreateOwnerResponse, error) {
msg, err := natsio.GetServer().Request(subject.SupplierUser.CreateOwner, toBytes(p)) msg, err := natsio.GetServer().Request(subject.SupplierUser.CreateOwner, toBytes(p))
if err != nil { if err != nil {
@ -99,7 +141,7 @@ func (s SupplierUser) UpdateSupplierStaffUsers(p model.UpdateStaffRequest) error
} }
func (s SupplierUser) UpdateStatus(p model.UpdateStatusRequest) error { func (s SupplierUser) UpdateStatus(p model.UpdateStatusRequest) error {
msg, err := natsio.GetServer().Request(subject.SupplierUser.UpdateStaff, toBytes(p)) msg, err := natsio.GetServer().Request(subject.SupplierUser.UpdateStatus, toBytes(p))
if err != nil { if err != nil {
return err return err
} }

39
client/withdraw.go Normal file
View File

@ -0,0 +1,39 @@
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"
)
// Withdraw ...
type Withdraw struct{}
// GetWithdraw ...
func GetWithdraw() Withdraw {
return Withdraw{}
}
// GetSupplierCash ...
func (o Withdraw) GetSupplierCash(p model.WithdrawSupplierCashReq) (*model.WithdrawSupplierCashRes, error) {
msg, err := natsio.GetServer().Request(subject.Withdraw.GetSupplierCash, toBytes(p))
if err != nil {
return nil, err
}
var (
r struct {
Data model.WithdrawSupplierCashRes `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
}

View File

@ -20,3 +20,9 @@ type ActionBy struct {
ID string `json:"id"` ID string `json:"id"`
Name string `json:"name"` Name string `json:"name"`
} }
// ClickAction ...
type ClickAction struct {
Type string `json:"type"`
Value string `json:"value"`
}

View File

@ -0,0 +1,7 @@
package model
type NotificationSupplierChangeBalanceRequestApprovedReq struct {
SupplierID string `json:"supplierId"`
Cash float64 `json:"cash"`
Reason string `json:"reason"`
}

View File

@ -0,0 +1 @@
package model

View File

@ -49,3 +49,7 @@ type OrderSupplierQuery struct {
SupplierID string `json:"supplierId"` SupplierID string `json:"supplierId"`
WarehouseIDs []string `json:"warehouseIDs"` WarehouseIDs []string `json:"warehouseIDs"`
} }
type OrderSupplierCashReq struct {
SupplierID string `json:"supplierId"`
}

View File

@ -33,3 +33,9 @@ type SupplierOrderDelivery struct {
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"` 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"` TPLCode string `json:"tplCode" enums:"SLY,GHTK,GHN,SSC,SPY,VTP,SE,NTL,BEST"`
} }
type OrderSupplierCashRes struct {
PendingCash float64 `json:"pendingCash"`
WaitingForReconcileCash float64 `json:"waitingForReconcileCash"`
ReconciledCash float64 `json:"reconciledCash"`
}

View File

@ -0,0 +1 @@
package model

View File

@ -0,0 +1 @@
package model

View File

@ -0,0 +1,24 @@
package model
type GetListPermissionRequest struct {
Page int `json:"page"`
Limit int `json:"limit"`
Group string `json:"group"`
}
type DetailPermissionRequest struct {
ID string `json:"_id"`
}
type CreatePermissionRequest struct {
Name string `json:"name"`
Code string `json:"code"`
Group string `json:"group"`
}
type UpdatePermissionRequest struct {
ID string `json:"_id"`
Name string `json:"name"`
Code string `json:"code"`
Group string `json:"group"`
}

View File

@ -0,0 +1,26 @@
package model
type GetListPermissionResponse struct {
Permissions []PermissionBrief `json:"permissions"`
Total int64 `json:"total"`
}
type PermissionBrief struct {
ID string `json:"_id"`
Name string `json:"name"`
Code string `json:"code"`
Group string `json:"group"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type CreatePermissionResponse struct {
ID string `json:"_id"`
}
type PermissionShort struct {
ID string `json:"_id"`
Name string `json:"name"`
Code string `json:"code"`
Group string `json:"group"`
}

View File

@ -23,18 +23,24 @@ type SupplierRequestPayload struct {
ContractStatus string ContractStatus string
} }
type CreateSupplierWarehousePayload struct { // SupplierCashflowCreatePayload ...
type SupplierCashflowCreatePayload struct {
Supplier string `json:"supplier"` Supplier string `json:"supplier"`
Warehouse string `json:"warehouse"` Action string `json:"action"`
ProvinceCode int `json:"provinceCode"` Name string `json:"name"`
DistrictCode int `json:"districtCode"` TargetID string `json:"targetId"`
WardCode int `json:"wardCode"` Value float64 `json:"value"`
ClickAction *ClickAction `json:"clickAction"`
} }
type UpdateSupplierWarehousePayload struct { type SupplierUpdateBalanceReq struct {
Supplier string `json:"supplier"` SupplierID string `json:"supplierId"`
Warehouse string `json:"warehouse"` }
ProvinceCode int `json:"provinceCode"`
DistrictCode int `json:"districtCode"` type SupplierGetCurrentBalanceReq struct {
WardCode int `json:"wardCode"` SupplierID string `json:"supplierId"`
}
type SupplierDeleteCashflowReq struct {
CashflowID string `json:"cashflowId"`
} }

View File

@ -29,3 +29,38 @@ type SupplierAll struct {
Suppliers []SupplierBrief `json:"suppliers"` Suppliers []SupplierBrief `json:"suppliers"`
Total int64 `json:"total"` Total int64 `json:"total"`
} }
type SupplierCashflowCreateResponse struct {
ID string `json:"id"`
}
type SupplierShort struct {
ID string `json:"_id"`
Name string `json:"name"`
Logo interface{} `json:"logo"`
}
type SupplierUpdateBalanceRes struct {
CurrentCash float64 `json:"currentCash"`
TotalPendingCash float64 `json:"totalPendingCash"`
OrderPendingCash float64 `json:"orderPendingCash"`
OrderWaitingForReconcileCash float64 `json:"orderWaitingForReconcileCash"`
OrderReconciledCash float64 `json:"orderReconciledCash"`
WithdrawPendingCash float64 `json:"withdrawPendingCash"`
WithdrawSuccessCash float64 `json:"withdrawSuccessCash"`
WithdrawRejectCash float64 `json:"withdrawRejectCash"`
ChangeBalanceRequestApproved float64 `json:"changeBalanceRequestApproved"`
UpdatedAt string `json:"updatedAt"`
}
type SupplierGetCurrentBalanceRes struct {
CurrentCash float64 `json:"currentCash"`
}
type SyncSupplierWarehousePayload struct {
Supplier string `json:"supplier"`
Warehouse string `json:"warehouse"`
ProvinceCode int `json:"provinceCode"`
DistrictCode int `json:"districtCode"`
WardCode int `json:"wardCode"`
}

View File

@ -1,9 +1,22 @@
package model package model
type GetListRoleRequest struct {
Page int `json:"page"`
Limit int `json:"limit"`
Type string `json:"type"`
SupplierID string `json:"supplierId"`
}
type DetailRoleRequest struct {
ID string `json:"_id"`
}
type CreateRoleRequest struct { type CreateRoleRequest struct {
Name string `json:"name"` Name string `json:"name"`
Code string `json:"code"` Code string `json:"code"`
Type string `json:"type"` Type string `json:"type"`
SupplierID string `json:"supplierId"`
Permissions []string `json:"permissions"`
} }
type UpdateRoleRequest struct { type UpdateRoleRequest struct {
@ -11,4 +24,6 @@ type UpdateRoleRequest struct {
Name string `json:"name"` Name string `json:"name"`
Code string `json:"code"` Code string `json:"code"`
Type string `json:"type"` Type string `json:"type"`
SupplierID string `json:"supplierId"`
Permissions []string `json:"permissions"`
} }

View File

@ -1,5 +1,29 @@
package model package model
type GetListRoleResponse struct {
Roles []RoleBrief `json:"roles"`
Total int64 `json:"total"`
}
type RoleBrief struct {
ID string `json:"_id"`
Name string `json:"name"`
Code string `json:"code"`
Type string `json:"type"`
Permissions []PermissionShort `json:"permissions"`
SupplierId string `json:"supplierId"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type CreateRoleResponse struct { type CreateRoleResponse struct {
ID string `json:"_id"` ID string `json:"_id"`
} }
type RoleShort struct {
ID string `json:"_id"`
Name string `json:"name"`
Code string `json:"code"`
Type string `json:"type"`
SupplierId string `json:"supplierId"`
}

View File

@ -1,5 +1,30 @@
package model package model
type LoginUserRequest struct {
Email string `json:"email"`
Password string `json:"password"`
DeviceID string `json:"deviceId"`
AppVersion string `json:"appVersion"`
UserAgent string `json:"userAgent"`
Model string `json:"model"`
Manufacturer string `json:"manufacturer"`
IP string `json:"ip"`
Language string `json:"language"`
FCMToken string `json:"FCMToken"`
AuthToken string `json:"authToken"`
OsName string `json:"osName"`
OsVersion string `json:"osVersion"`
IsMobile bool `json:"isMobile"`
}
type GetListUserRequest struct {
Page int `json:"page"`
Limit int `json:"limit"`
Status string `json:"status"`
Type string `json:"type"`
SupplierID string `json:"supplierId"`
}
type CreateOwnerRequest struct { type CreateOwnerRequest struct {
Name string `json:"name"` Name string `json:"name"`
Phone string `json:"phone"` Phone string `json:"phone"`
@ -47,5 +72,4 @@ type UpdateStatusRequest struct {
type ResetPasswordRequest struct { type ResetPasswordRequest struct {
ID string `json:"_id"` ID string `json:"_id"`
Password string `json:"password"`
} }

View File

@ -1,5 +1,31 @@
package model package model
// LoginUserResponse ...
type LoginUserResponse struct {
ID string `json:"_id"`
RequireToChangePassword bool `json:"requireToChangePassword"`
SupplierID string `json:"supplierId"`
}
type GetListUserResponse struct {
SupplierUsers []SupplierUserBrief `json:"supplierUsers"`
Total int64 `json:"total"`
}
type SupplierUserBrief struct {
ID string `json:"_id"`
Role RoleShort `json:"role"`
SupplierID string `json:"supplierId"`
Name string `json:"name"`
Phone string `json:"phone"`
Email string `json:"email"`
Status string `json:"status"`
Avatar interface{} `json:"avatar"`
Type string `json:"type"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type CreateOwnerResponse struct { type CreateOwnerResponse struct {
ID string `json:"_id"` ID string `json:"_id"`
} }

View File

@ -0,0 +1,5 @@
package model
type WithdrawSupplierCashReq struct {
SupplierID string `json:"supplierId"`
}

View File

@ -0,0 +1,7 @@
package model
type WithdrawSupplierCashRes struct {
PendingCash float64 `json:"pendingCash"`
SuccessCash float64 `json:"successCash"`
RejectCash float64 `json:"rejectCash"`
}

View File

@ -8,9 +8,12 @@ var prefixes = struct {
Location string Location string
Bank string Bank string
Supplier string Supplier string
Notification string
Seller string Seller string
SupplierUser string SupplierUser string
SupplierRole string SupplierRole string
Withdraw string
SupplierPermission string
}{ }{
Communication: "communication", Communication: "communication",
Order: "order", Order: "order",
@ -18,8 +21,11 @@ var prefixes = struct {
Warehouse: "warehouse", Warehouse: "warehouse",
Location: "location", Location: "location",
Supplier: "supplier", Supplier: "supplier",
Notification: "notification",
Bank: "bank", Bank: "bank",
Seller: "seller", Seller: "seller",
SupplierUser: "supplier_user", SupplierUser: "supplier_user",
SupplierRole: "supplier_role", SupplierRole: "supplier_role",
Withdraw: "withdraw",
SupplierPermission: "supplier_permission",
} }

13
subject/notification.go Normal file
View File

@ -0,0 +1,13 @@
package subject
import "fmt"
func getNotificationValue(val string) string {
return fmt.Sprintf("%s.%s", prefixes.Notification, val)
}
var Notification = struct {
SupplierChangeBalanceRequestApproved string
}{
SupplierChangeBalanceRequestApproved: getNotificationValue("supplier_change_balance_request_approved"),
}

View File

@ -13,6 +13,7 @@ var Order = struct {
UpdateLogisticInfoFailed string UpdateLogisticInfoFailed string
ORNotUpdateStatus string ORNotUpdateStatus string
GetSupplierOrders string GetSupplierOrders string
GetSupplierCash string
}{ }{
UpdateORStatus: getOrderValue("update_outbound_request_status"), UpdateORStatus: getOrderValue("update_outbound_request_status"),
CancelDelivery: getOrderValue("cancel_delivery"), CancelDelivery: getOrderValue("cancel_delivery"),
@ -20,4 +21,5 @@ var Order = struct {
UpdateLogisticInfoFailed: getOrderValue("update_logistic_info_failed"), UpdateLogisticInfoFailed: getOrderValue("update_logistic_info_failed"),
ORNotUpdateStatus: getOrderValue("outbound_request_not_update_status"), ORNotUpdateStatus: getOrderValue("outbound_request_not_update_status"),
GetSupplierOrders: getOrderValue("get_supplier_orders"), GetSupplierOrders: getOrderValue("get_supplier_orders"),
GetSupplierCash: getOrderValue("get_supplier_cash"),
} }

View File

@ -10,8 +10,16 @@ var Supplier = struct {
GetListSupplierInfo string GetListSupplierInfo string
GetSupplierContractBySupplierID string GetSupplierContractBySupplierID string
FindAll string FindAll string
CreateCashflow string
DeleteCashflow string
UpdateBalance string
GetCurrentBalance string
}{ }{
GetListSupplierInfo: getSupplierValue("get_list_supplier_info"), GetListSupplierInfo: getSupplierValue("get_list_supplier_info"),
GetSupplierContractBySupplierID: getSupplierValue("get_supplier_contract_by_supplier_id"), GetSupplierContractBySupplierID: getSupplierValue("get_supplier_contract_by_supplier_id"),
FindAll: getSupplierValue("find_all"), FindAll: getSupplierValue("find_all"),
CreateCashflow: getSupplierValue("create_cashflow"),
DeleteCashflow: getSupplierValue("delete_cashflow"),
UpdateBalance: getSupplierValue("update_balance"),
GetCurrentBalance: getSupplierValue("get_current_balance"),
} }

View File

@ -0,0 +1,17 @@
package subject
import "fmt"
func getPermissionValue(val string) string {
return fmt.Sprintf("%s.%s", prefixes.SupplierPermission, val)
}
var SupplierPermission = struct {
GetList string
Create string
Update string
}{
GetList: getPermissionValue("get_list"),
Create: getPermissionValue("create"),
Update: getPermissionValue("update"),
}

View File

@ -7,9 +7,15 @@ func getRoleValue(val string) string {
} }
var SupplierRole = struct { var SupplierRole = struct {
GetList string
Detail string
Create string Create string
Update string Update string
GetListBySupplierID string
}{ }{
GetList: getRoleValue("get_list"),
Detail: getRoleValue("detail"),
Create: getRoleValue("create"), Create: getRoleValue("create"),
Update: getRoleValue("update"), Update: getRoleValue("update"),
GetListBySupplierID: getRoleValue("get_list_by_supplierId"),
} }

View File

@ -8,6 +8,8 @@ func getSupplierUserValue(val string) string {
var SupplierUser = struct { var SupplierUser = struct {
// Users // Users
LoginUser string
GetListUser string
CreateOwner string CreateOwner string
UpdateOwner string UpdateOwner string
CreateStaff string CreateStaff string
@ -16,6 +18,8 @@ var SupplierUser = struct {
ResetPassword string ResetPassword string
}{ }{
// Users // Users
LoginUser: getSupplierUserValue("login_user"),
GetListUser: getSupplierUserValue("get_list_user"),
CreateOwner: getSupplierUserValue("create_owner"), CreateOwner: getSupplierUserValue("create_owner"),
UpdateOwner: getSupplierUserValue("update_owner"), UpdateOwner: getSupplierUserValue("update_owner"),
CreateStaff: getSupplierUserValue("create_staff"), CreateStaff: getSupplierUserValue("create_staff"),

View File

@ -7,8 +7,7 @@ func getWarehouseValue(val string) string {
} }
var Warehouse = struct { var Warehouse = struct {
CreateWarehouseIntoServiceSupplier string SyncWarehouseIntoServiceSupplier string
UpdateWarehouseIntoServiceSupplier string
CreateOutboundRequest string CreateOutboundRequest string
UpdateOutboundRequestLogistic string UpdateOutboundRequestLogistic string
CancelOutboundRequest string CancelOutboundRequest string
@ -27,8 +26,7 @@ var Warehouse = struct {
GetWarehouses string GetWarehouses string
UpdateORDeliveryStatus string UpdateORDeliveryStatus string
}{ }{
CreateWarehouseIntoServiceSupplier: getWarehouseValue("create_warehouse_into_service_supplier"), SyncWarehouseIntoServiceSupplier: getWarehouseValue("sync_warehouse_into_service_supplier"),
UpdateWarehouseIntoServiceSupplier: getWarehouseValue("update_warehouse_into_service_supplier"),
AfterCreateWarehouse: getWarehouseValue("after_create_warehouse"), AfterCreateWarehouse: getWarehouseValue("after_create_warehouse"),
AfterUpdateWarehouse: getWarehouseValue("after_update_warehouse"), AfterUpdateWarehouse: getWarehouseValue("after_update_warehouse"),
CreateOutboundRequest: getWarehouseValue("create_outbound_request"), CreateOutboundRequest: getWarehouseValue("create_outbound_request"),

13
subject/withdraw.go Normal file
View File

@ -0,0 +1,13 @@
package subject
import "fmt"
func getWithdrawValue(val string) string {
return fmt.Sprintf("%s.%s", prefixes.Withdraw, val)
}
var Withdraw = struct {
GetSupplierCash string
}{
GetSupplierCash: getWithdrawValue("get_supplier_cash"),
}