add onlySharedAccess option to i/apps endpoint

This commit is contained in:
Hazelnoot 2025-06-22 10:26:44 -04:00
parent cc3076d6d2
commit 82cac0bbb7
2 changed files with 6 additions and 0 deletions

View file

@ -76,6 +76,7 @@ export const paramDef = {
type: 'object',
properties: {
sort: { type: 'string', enum: ['+createdAt', '-createdAt', '+lastUsedAt', '-lastUsedAt'] },
onlySharedAccess: { type: 'boolean' },
},
required: [],
} as const;
@ -103,6 +104,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
default: query.orderBy('token.id', 'ASC'); break;
}
if (ps.onlySharedAccess) {
query.andWhere('token.granteeIds != \'{}\'');
}
const tokens = await query.getMany();
const users = await this.cacheService.getUsers(tokens.flatMap(token => token.granteeIds));