-
-
Notifications
You must be signed in to change notification settings - Fork 453
core: group api #1168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
core: group api #1168
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -479,8 +479,14 @@ class UserModel { | |
| ]); | ||
| } | ||
|
|
||
| static async listGroup(domainId: string, uid?: number) { | ||
| const groups = await collGroup.find(typeof uid === 'number' ? { domainId, uids: uid } : { domainId }).toArray(); | ||
| static async listGroup(domainId: string, uid?: number, names?: string[], search?: string, limit?: number) { | ||
| const filter: Filter<GDoc> = { domainId }; | ||
| if (typeof uid === 'number') filter.uids = uid; | ||
| if (names?.length) filter.name = { $in: names }; | ||
| if (search) filter.name = { $regex: escapeRegExp(search), $options: 'i' }; | ||
| let cursor = collGroup.find(filter); | ||
| if (limit) cursor = cursor.limit(limit); | ||
|
Comment on lines
+495
to
+496
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Treat This truthy check makes 🤖 Prompt for AI Agents |
||
| const groups = await cursor.toArray(); | ||
| if (uid) { | ||
| groups.push({ | ||
| _id: new ObjectId(), domainId, uids: [uid], name: uid.toString(), | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.