ch role list added name
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled

This commit is contained in:
guwandyk committed 2026-09-30 13:44:10 +05:00
1 parent 5ab17b1539
commit 6f54e9c20b
2 files changed
+4 -3

No files matched your search

+2 -2
View File
@@ -45,7 +45,7 @@ func (r *repository) List(ctx context.Context, filter role.ListFilter) (role.Lis
}
args = append(args, filter.Limit, (filter.Page-1)*filter.Limit)
query := fmt.Sprintf(`SELECT r.id, r.code, r.scope,
query := fmt.Sprintf(`SELECT r.id, r.code, r.name, r.scope,
(SELECT COUNT(*) FROM users u WHERE u.role_id = r.id AND u.deleted_at IS NULL)
FROM roles r%s ORDER BY r.id LIMIT $%d OFFSET $%d`,
where, len(args)-1, len(args))
@@ -59,7 +59,7 @@ func (r *repository) List(ctx context.Context, filter role.ListFilter) (role.Lis
for rows.Next() {
var item role.RoleListItemDTO
var scope string
if err := rows.Scan(&item.Id, &item.Code, &scope, &item.UsersCount); err != nil {
if err := rows.Scan(&item.Id, &item.Code, &item.Name, &scope, &item.UsersCount); err != nil {
return role.ListRoleDTO{}, err
}
item.Scope = rbac.Scope(scope)