feat: complete search REST route, restore disk sync, and extraFields support across API/MCP
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user