diff --git a/app/services/oauth2.js b/app/services/oauth2.js index ff3a5dc..ce7200a 100644 --- a/app/services/oauth2.js +++ b/app/services/oauth2.js @@ -330,6 +330,18 @@ class OAuth2Service extends SiteService { return clients; } + async getRandomClients (maxCount) { + const clients = await OAuth2Client.aggregate([ + { + $match: { 'flags.isActive': true }, + }, + { + $sample: { size: maxCount }, + } + ]); + return clients; + } + async getClientById (clientId) { const client = await OAuth2Client .findOne({ _id: clientId })