fix(backlinks): read workspaceId from camelCased Kysely row
Kysely's CamelCasePlugin (configured globally) rewrites snake_case columns to camelCase on result rows, so result.rows[0].workspace_id was undefined and the subsequent insert hit UNDEFINED_VALUE, leaving acadenice_backlink empty and the Knowledge Graph blank.
This commit is contained in:
parent
43a70929ec
commit
60654d5d2f
1 changed files with 5 additions and 2 deletions
|
|
@ -35,7 +35,10 @@ export class BacklinkIndexerService {
|
|||
let page: { content: any; workspaceId: string } | null = null;
|
||||
|
||||
try {
|
||||
const result = await sql<{ content: any; workspace_id: string }>`
|
||||
// Kysely's CamelCasePlugin (configured in database.module.ts) maps
|
||||
// snake_case columns to camelCase keys at runtime, so the row type
|
||||
// must reflect the post-plugin shape.
|
||||
const result = await sql<{ content: any; workspaceId: string }>`
|
||||
SELECT p.content, s.workspace_id
|
||||
FROM pages p
|
||||
JOIN spaces s ON s.id = p.space_id
|
||||
|
|
@ -51,7 +54,7 @@ export class BacklinkIndexerService {
|
|||
|
||||
page = {
|
||||
content: result.rows[0].content,
|
||||
workspaceId: result.rows[0].workspace_id,
|
||||
workspaceId: result.rows[0].workspaceId,
|
||||
};
|
||||
} catch (err) {
|
||||
this.logger.error(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue