refactor: simplify app status and response shape in API

Derive status from app.active flag instead of maintenance/bugs heuristic.
Remove version, minVersion, and maintenance from list/detail response
as these are fetched separately via the grid overview endpoint.
This commit is contained in:
2026-05-05 12:43:36 +08:00
parent ef852842b4
commit a73dcb1e89

View File

@@ -363,11 +363,8 @@ export function createApp() {
return apps.map((app) => ({
id: app.id,
name: app.name,
status: app.maintenance ? 'warning' : app.bugs.length > 0 ? 'error' : 'active',
status: app.active ? 'active' : 'inactive',
errors: app.bugs.length,
version: app.version ?? '-',
minVersion: app.minVersion,
maintenance: app.maintenance,
active: app.active,
urlApi: app.urlApi,
hasClientApiKey: !!app.clientApiKey,
@@ -400,11 +397,8 @@ export function createApp() {
return {
id: app.id,
name: app.name,
status: app.maintenance ? 'warning' : app.bugs.length > 0 ? 'error' : 'active',
status: app.active ? 'active' : 'inactive',
errors: app.bugs.length,
version: app.version ?? '-',
minVersion: app.minVersion,
maintenance: app.maintenance,
urlApi: app.urlApi,
totalBugs: app._count.bugs,
}