feat: complete search REST route, restore disk sync, and extraFields support across API/MCP

This commit is contained in:
asepharyana
2026-08-21 11:03:04 +07:00
parent 989ee9c464
commit a67a8c6469
11 changed files with 319 additions and 34 deletions
+3 -2
View File
@@ -32,7 +32,7 @@ const VALID_TYPES: DocType[] = ["documentation", "writeup", "research", "note"];
/** Map a Drizzle row (text columns, Date timestamps) into the strict types. */
function toMeta(row: DocumentRow): DocumentMeta {
const extra = row.extraFields as Record<string, unknown> | null;
const extra = (row.extraFields ?? {}) as Record<string, unknown>;
return {
id: row.id,
slug: row.slug,
@@ -47,8 +47,9 @@ function toMeta(row: DocumentRow): DocumentMeta {
path: row.path,
createdAt: row.createdAt.toISOString(),
updatedAt: row.updatedAt.toISOString(),
extraFields: extra,
// Spread dynamic extra fields (CTF: event, challenge, category, difficulty, points, etc.)
...(extra ?? {}),
...extra,
};
}