new destruction flow
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { json, error } from '@sveltejs/kit';
|
||||
import { db } from '$lib/server/db/index.js';
|
||||
import { getDeployment } from '$lib/server/fleet/deployments.js';
|
||||
|
||||
export async function GET({ params }: { params: { id: string } }) {
|
||||
const lifecycle = getDeployment(params.id);
|
||||
if (lifecycle) return json(lifecycle);
|
||||
const dep = db()
|
||||
.prepare('SELECT * FROM deployments WHERE id = ?')
|
||||
.get(params.id) as Record<string, unknown> | undefined;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { kick } from '$lib/server/pipeline/worker.js';
|
||||
import { json } from '@sveltejs/kit';
|
||||
import { destroyServer } from '$lib/server/fleet/create.js';
|
||||
|
||||
@@ -11,5 +12,6 @@ export async function DELETE({ params }: { params: { name: string } }) {
|
||||
const status = result.kind === 'not-found' ? 404 : 500;
|
||||
return json({ ok: false, error: result.message, kind: result.kind, warnings: result.warnings }, { status });
|
||||
}
|
||||
return json({ ok: true, warnings: result.warnings });
|
||||
void kick().catch((err) => console.error('[destroy] worker kick failed:', err));
|
||||
return json({ ok: true, deploymentId: result.deploymentId }, { status: 202 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user