style: clean up code with prettier and eslint

This commit is contained in:
openhands
2026-07-12 20:31:05 +02:00
parent 60278b9e71
commit fb8e77bb68
378 changed files with 22407 additions and 20689 deletions
+24 -24
View File
@@ -1,45 +1,45 @@
import { withAdmin } from '@/lib/api-handler'
import { apiError } from '@/lib/api-response'
import { PERMS } from '@/lib/permissions'
import { logAudit } from '@/lib/services/audit'
import { runSseBatch } from '@/lib/services/import/core/sse-batch'
import { ensurePetDirs, importSinglePet } from '@/lib/services/pet-import'
import { withAdmin } from "@/lib/api-handler";
import { apiError } from "@/lib/api-response";
import { PERMS } from "@/lib/permissions";
import { logAudit } from "@/lib/services/audit";
import { runSseBatch } from "@/lib/services/import/core/sse-batch";
import { ensurePetDirs, importSinglePet } from "@/lib/services/pet-import";
interface PetBatchItem {
lib: string
lib: string;
}
export const POST = withAdmin({ permission: PERMS.ASSETS_IMPORT }, async (request, ctx) => {
const body = await request.json()
const rawItems: PetBatchItem[] = body.items || []
const concurrency = body.concurrency || 3
if (rawItems.length === 0) return apiError('No pets to import', 400)
const body = await request.json();
const rawItems: PetBatchItem[] = body.items || [];
const concurrency = body.concurrency || 3;
if (rawItems.length === 0) return apiError("No pets to import", 400);
const seen = new Set<string>()
const seen = new Set<string>();
const items = rawItems.filter((it) => {
if (seen.has(it.lib)) return false
seen.add(it.lib)
return true
})
if (seen.has(it.lib)) return false;
seen.add(it.lib);
return true;
});
await ensurePetDirs()
await ensurePetDirs();
return runSseBatch<PetBatchItem>({
items,
concurrency,
labelOf: (it) => it.lib,
worker: async (it, _index, report) => {
const r = await importSinglePet({ lib: it.lib, onProgress: report })
const r = await importSinglePet({ lib: it.lib, onProgress: report });
if (r.ok) {
logAudit({
userId: ctx.session.user.id,
action: 'pet_import',
target: 'PetAsset',
action: "pet_import",
target: "PetAsset",
targetId: 0,
after: { lib: it.lib, batch: true },
})
});
}
return { ok: r.ok, warnings: r.warnings, error: r.error }
return { ok: r.ok, warnings: r.warnings, error: r.error };
},
})
})
});
});