fix(acadenice): sync-block date string + graph p.slug column name — Patch 026
Two server bugs surfaced from the live test: 1. SyncBlockRepo.mapRow crashed with 'Cannot read properties of undefined (reading toISOString)' on POST /api/acadenice/sync-blocks. The kysely-postgres-js driver returns timestamps as strings, not Date instances. Wrap with new Date(...) before .toISOString(). 2. GraphService.loadPageMeta + loadOrphanPages SELECT'd p.slug, but the native pages table column is named slug_id. Postgres rejected the query, the catch returned [], and the graph rendered empty even when pages existed. Aliased p.slug_id AS slug to match the PageMetaRow interface. Patch 026.
This commit is contained in:
parent
9b33a2683b
commit
7fba3c0452
2 changed files with 6 additions and 6 deletions
|
|
@ -434,7 +434,7 @@ export class GraphService {
|
|||
SELECT
|
||||
p.id,
|
||||
p.title,
|
||||
p.slug,
|
||||
p.slug_id AS slug,
|
||||
p.space_id,
|
||||
sp.name AS space_name,
|
||||
p.icon
|
||||
|
|
@ -479,7 +479,7 @@ export class GraphService {
|
|||
SELECT
|
||||
p.id,
|
||||
p.title,
|
||||
p.slug,
|
||||
p.slug_id AS slug,
|
||||
p.space_id,
|
||||
sp.name AS space_name,
|
||||
p.icon
|
||||
|
|
|
|||
|
|
@ -181,16 +181,16 @@ export class SyncBlockRepo {
|
|||
workspace_id: string;
|
||||
content: Record<string, unknown>;
|
||||
created_by: string;
|
||||
created_at: Date;
|
||||
updated_at: Date;
|
||||
created_at: Date | string;
|
||||
updated_at: Date | string;
|
||||
}): SyncBlockResponseDto {
|
||||
return {
|
||||
id: row.id,
|
||||
workspaceId: row.workspace_id,
|
||||
content: row.content,
|
||||
createdBy: row.created_by,
|
||||
createdAt: row.created_at.toISOString(),
|
||||
updatedAt: row.updated_at.toISOString(),
|
||||
createdAt: new Date(row.created_at).toISOString(),
|
||||
updatedAt: new Date(row.updated_at).toISOString(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue