We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 92c8569 commit 7efadf5Copy full SHA for 7efadf5
1 file changed
src/repository/storage/postgres/orm/sequelize/noteRelations.ts
@@ -217,7 +217,10 @@ export default class NoteRelationsSequelizeStorage {
217
* @param noteId - the ID of the note.
218
*/
219
public async getNoteParentsIds(noteId: NoteInternalId): Promise<NoteInternalId[]> {
220
- // get all note ids via a singe sql query instead of many
+ // 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.
224
const query = `
225
WITH RECURSIVE note_parents AS (
226
SELECT np.note_id, np.parent_id
0 commit comments