Complete map refresh guards and fix the dashboard job embed

This commit is contained in:
2026-10-06 12:18:22 +05:00
parent 923abdc472
commit 5f43e97d32
11 changed files with 127 additions and 27 deletions

View File

@@ -332,7 +332,7 @@ export async function handle(request: NextRequest, path: string[]) {
await client
.from("datasets")
.select(
"*, upload_jobs(state,progress,error,updated_at,lease_until,kind)",
"*, upload_jobs!dataset_id(state,progress,error,updated_at,lease_until,kind)",
)
.eq("owner_id", owner)
.order("created_at", { ascending: false }),
@@ -349,6 +349,8 @@ export async function handle(request: NextRequest, path: string[]) {
}
const d = await ownedDataset(request, path[1]);
if (path[2] === "refresh-map") {
if (d.parent_dataset_id)
throw new Error("Only maps can refresh their guessing map");
if (method === "POST") {
const body = z
.object({ sourceId: idSchema })
@@ -424,7 +426,7 @@ export async function handle(request: NextRequest, path: string[]) {
const manifest = datasetSchema.parse(input.manifest);
const jobResult = await client
.from("upload_jobs")
.select("state,progress,error,updated_at,lease_until")
.select("state,progress,error,updated_at,lease_until,kind")
.eq("dataset_id", d.id)
.maybeSingle();
checkServiceError(jobResult.error);