Link seeded users to roles by code and list only clients not assigned to a branch.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -170,6 +170,12 @@ func likePattern(term string) string {
|
||||
|
||||
func (r *repository) GetByRole(ctx context.Context, role string, filter user.ListFilter) (user.ListUserDTO, error) {
|
||||
fromClause, whereClause, args := buildFilteredListQuery(filter, role)
|
||||
excludeStaff := `NOT EXISTS (SELECT 1 FROM branch_user bu WHERE bu.user_id = u.id)`
|
||||
if whereClause == "" {
|
||||
whereClause = " WHERE " + excludeStaff
|
||||
} else {
|
||||
whereClause += " AND " + excludeStaff
|
||||
}
|
||||
return r.paginateUsers(ctx, filter, fromClause, whereClause, args)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user