mirror of
https://github.com/directus/directus.git
synced 2026-01-27 16:58:02 -05:00
use aggregate count for users in roles view (#9834)
This commit is contained in:
@@ -130,7 +130,12 @@ export default defineComponent({
|
||||
|
||||
try {
|
||||
const response = await api.get(`/roles`, {
|
||||
params: { limit: -1, fields: 'id,name,description,icon,users.id', sort: 'name' },
|
||||
params: {
|
||||
limit: -1,
|
||||
fields: 'id,name,description,icon,users.id',
|
||||
deep: { users: { _aggregate: { count: 'id' } } },
|
||||
sort: 'name',
|
||||
},
|
||||
});
|
||||
|
||||
roles.value = [
|
||||
@@ -144,7 +149,7 @@ export default defineComponent({
|
||||
...response.data.data.map((role: any) => {
|
||||
return {
|
||||
...role,
|
||||
count: (role.users || []).length,
|
||||
count: role.users[0]?.count.id || 0,
|
||||
};
|
||||
}),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user