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

View file

@ -22700,6 +22700,7 @@ export type operations = {
'application/json': { 'application/json': {
/** @enum {string} */ /** @enum {string} */
sort?: '+createdAt' | '-createdAt' | '+lastUsedAt' | '-lastUsedAt'; sort?: '+createdAt' | '-createdAt' | '+lastUsedAt' | '-lastUsedAt';
onlySharedAccess?: boolean;
}; };
}; };
}; };