Compare commits
1 Commits
master
...
product-re
Author | SHA1 | Date |
---|---|---|
anbuiselly | ac81466c86 |
|
@ -6,6 +6,7 @@ import (
|
||||||
"git.selly.red/Selly-Modules/usermngmt/permission"
|
"git.selly.red/Selly-Modules/usermngmt/permission"
|
||||||
"git.selly.red/Selly-Modules/usermngmt/role"
|
"git.selly.red/Selly-Modules/usermngmt/role"
|
||||||
"git.selly.red/Selly-Modules/usermngmt/user"
|
"git.selly.red/Selly-Modules/usermngmt/user"
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
)
|
)
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -170,3 +171,8 @@ func (s Service) DeletePermission(permissionID string) error {
|
||||||
func (s Service) GetAllPermissions(query model.PermissionAllQuery) model.PermissionAll {
|
func (s Service) GetAllPermissions(query model.PermissionAllQuery) model.PermissionAll {
|
||||||
return permission.All(query)
|
return permission.All(query)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetStaffsBySupplier ...
|
||||||
|
func (s Service) GetStaffsBySupplier(supplierID primitive.ObjectID) []model.SupplierStaffShort {
|
||||||
|
return user.GetStaffBySupplier(supplierID)
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
package model
|
||||||
|
|
||||||
|
// SupplierStaffShort ...
|
||||||
|
type SupplierStaffShort struct {
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Role string `json:"role"`
|
||||||
|
}
|
|
@ -749,3 +749,21 @@ func Delete(userID string) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetStaffBySupplier ...
|
||||||
|
func GetStaffBySupplier(supplierID primitive.ObjectID) (r []model.SupplierStaffShort) {
|
||||||
|
var (
|
||||||
|
ctx = context.Background()
|
||||||
|
)
|
||||||
|
|
||||||
|
users := findByCondition(ctx, bson.M{"other.supplier": supplierID})
|
||||||
|
for _, user := range users {
|
||||||
|
r = append(r, model.SupplierStaffShort{
|
||||||
|
ID: user.ID.Hex(),
|
||||||
|
Name: user.Name,
|
||||||
|
Role: user.RoleID.Hex(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue