Skip to content

Commit 7efadf5

Browse files
update (note parents): add comment about the query
1 parent 92c8569 commit 7efadf5

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,10 @@ export default class NoteRelationsSequelizeStorage {
217217
* @param noteId - the ID of the note.
218218
*/
219219
public async getNoteParentsIds(noteId: NoteInternalId): Promise<NoteInternalId[]> {
220-
// get all note ids via a singe sql query instead of many
220+
// Query to get all parent notes of a note.
221+
// The query uses a recursive common table expression (CTE) to get all parent notes of a note.
222+
// It starts from the note with the ID :startNoteId and recursively gets all parent notes.
223+
// It returns a list of note ID and parent ID of the note.
221224
const query = `
222225
WITH RECURSIVE note_parents AS (
223226
SELECT np.note_id, np.parent_id

0 commit comments

Comments
 (0)