Skip to content

Commit dd1bcdc

Browse files
update (note relation): return noteId and parentId from the sql query
1 parent 7bfe0eb commit dd1bcdc

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/repository/storage/postgres/orm/sequelize/noteRelations.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,16 +228,15 @@ export default class NoteRelationsSequelizeStorage {
228228
FROM ${String(this.database.literal(this.tableName).val)} nr
229229
INNER JOIN note_parents np ON np.parent_id = nr.note_id
230230
)
231-
SELECT np.note_id, np.parent_id
231+
SELECT np.note_id AS "noteId", np.parent_id AS "parentId"
232232
FROM note_parents np;`;
233233

234-
const result = await this.database.query(query, {
234+
const result = await this.model.sequelize?.query(query, {
235235
replacements: { startNoteId: noteId },
236236
type: QueryTypes.SELECT,
237237
});
238238

239-
// eslint-disable-next-line @typescript-eslint/naming-convention
240-
let noteParents = (result as { note_id: number; parent_id: number }[])?.map(note => note.parent_id) ?? [];
239+
let noteParents = (result as { noteId: number; parentId: number }[])?.map(note => note.parentId) ?? [];
241240

242241
noteParents.reverse();
243242

0 commit comments

Comments
 (0)