core&ui: assignment auto complete (#1061)

This commit is contained in:
Tairui Qu authored and GitHub committed 2025-10-10 13:43:38 +01:00
1 parent f32cee2200
commit 564ff1b02d
6 files changed
+184 -8

No files matched your search

+19
View File
@@ -433,6 +433,25 @@ export const DomainApi = {
return ddoc;
},
),
groups: Query(
Schema.object({
search: Schema.string(),
names: Schema.array(Schema.string()),
domainId: Schema.string().required(),
}),
async (ctx, args) => {
if (!ctx.user.hasPerm(PERM.PERM_VIEW) && !ctx.user.hasPriv(PRIV.PRIV_VIEW_ALL_DOMAIN)) throw new PermissionError(PERM.PERM_VIEW);
const groups = await user.listGroup(args.domainId);
if (args.names?.length) {
return groups.filter((g) => args.names.includes(g.name));
}
if (args.search) {
const searchLower = args.search.toLowerCase();
return groups.filter((g) => g.name.toLowerCase().includes(searchLower));
}
return groups;
},
),
'domain.group': Mutation(
Schema.object({
name: Schema.string().required(),