From c46c176ca8666d85d1ed8ee8685cf3ab20e98d4b Mon Sep 17 00:00:00 2001 From: chyoo Date: Thu, 9 Jul 2026 13:50:45 +0900 Subject: [PATCH] refine app management and source repository displays --- src/apps/apps.service.ts | 15 ++++++++++++--- src/launcher/launcher.service.ts | 7 +++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/apps/apps.service.ts b/src/apps/apps.service.ts index 8bbce71..46e2241 100644 --- a/src/apps/apps.service.ts +++ b/src/apps/apps.service.ts @@ -40,8 +40,9 @@ export class AppsService { private readonly launcherService: LauncherService, ) {} - listApps() { - return this.prisma.app.findMany({ + async listApps() { + const [apps, launcherAppKeys] = await Promise.all([ + this.prisma.app.findMany({ orderBy: { name: 'asc' }, include: { components: { @@ -58,7 +59,15 @@ export class AppsService { }, }, }, - }); + }), + this.launcherService.listEnabledAppKeys().catch(() => []), + ]); + const launcherLinkedKeys = new Set(launcherAppKeys); + + return apps.map((app) => ({ + ...app, + launcherLinked: launcherLinkedKeys.has(app.key), + })); } async createApp(body: CreateAppDto) { diff --git a/src/launcher/launcher.service.ts b/src/launcher/launcher.service.ts index 17e9750..3e5e6ff 100644 --- a/src/launcher/launcher.service.ts +++ b/src/launcher/launcher.service.ts @@ -454,6 +454,13 @@ export class LauncherService { }; } + async listEnabledAppKeys() { + const rows = await this.launcherPrisma.$queryRawUnsafe>( + `SELECT app_key FROM launcher_apps WHERE is_enabled = true`, + ); + return rows.map((row) => row.app_key); + } + async listUserAppPermissions(userId: string) { const rows = await this.launcherPrisma.$queryRawUnsafe( `SELECT app.id AS app_id, app.app_key, app.display_name, app.description, app.sort_order, app.is_enabled,