fix(backend): 「アクセストークンの管理」画面でアプリの情報が表示されない問題を修正

Fix #10920
This commit is contained in:
syuilo
2023-05-30 17:27:47 +09:00
parent a4a171781b
commit a6cd97ca9a
3 changed files with 6 additions and 7 deletions

View File

@@ -26,7 +26,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
) {
super(meta, paramDef, async (ps, me) => {
const query = this.accessTokensRepository.createQueryBuilder('token')
.where('token.userId = :userId', { userId: me.id });
.where('token.userId = :userId', { userId: me.id })
.leftJoinAndSelect('token.app', 'app');
switch (ps.sort) {
case '+createdAt': query.orderBy('token.createdAt', 'DESC'); break;
@@ -40,7 +41,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
return await Promise.all(tokens.map(token => ({
id: token.id,
name: token.name,
name: token.name ?? token.app?.name,
createdAt: token.createdAt,
lastUsedAt: token.lastUsedAt,
permission: token.permission,