Wire device execution mode controls into UI
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { requireRequestSession } from "@/lib/boss-auth";
|
||||
import { updateDevice } from "@/lib/boss-data";
|
||||
import { applyProjectConflictDecision, updateDevice } from "@/lib/boss-data";
|
||||
|
||||
export async function PATCH(
|
||||
request: NextRequest,
|
||||
@@ -19,9 +19,33 @@ export async function PATCH(
|
||||
endpoint?: string;
|
||||
note?: string;
|
||||
projects?: string[];
|
||||
capabilities?: {
|
||||
gui?: {
|
||||
connected?: boolean;
|
||||
lastSeenAt?: string;
|
||||
lastActiveProjectId?: string;
|
||||
};
|
||||
cli?: {
|
||||
connected?: boolean;
|
||||
lastSeenAt?: string;
|
||||
lastActiveProjectId?: string;
|
||||
};
|
||||
};
|
||||
preferredExecutionMode?: "gui" | "cli";
|
||||
projectId?: string;
|
||||
folderKey?: string;
|
||||
conflictDecision?: "forbid" | "allow_once" | "allow_always";
|
||||
};
|
||||
|
||||
try {
|
||||
if (body.conflictDecision && body.projectId) {
|
||||
await applyProjectConflictDecision({
|
||||
deviceId,
|
||||
projectId: body.projectId,
|
||||
folderKey: body.folderKey,
|
||||
decision: body.conflictDecision,
|
||||
});
|
||||
}
|
||||
const device = await updateDevice(deviceId, body);
|
||||
return NextResponse.json({ ok: true, device });
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user