Skip to content

Commit

Permalink
update(note request): update the content send in get request of note …
Browse files Browse the repository at this point in the history
…by adding note parrent structure
  • Loading branch information
dependentmadani committed Sep 7, 2024
1 parent bb6caff commit a11d1f8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/presentation/http/router/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { FastifyPluginCallback } from 'fastify';
import type NoteService from '@domain/service/note.js';
import type NoteSettingsService from '@domain/service/noteSettings.js';
import type { ErrorResponse } from '@presentation/http/types/HttpResponse.js';
import type { Note, NotePublicId } from '@domain/entities/note.js';
import type { Note, NoteParentsStructure, NotePublicId } from '@domain/entities/note.js';
import useNoteResolver from '../middlewares/note/useNoteResolver.js';
import useNoteSettingsResolver from '../middlewares/noteSettings/useNoteSettingsResolver.js';
import useMemberRoleResolver from '../middlewares/noteSettings/useMemberRoleResolver.js';
Expand Down Expand Up @@ -85,6 +85,7 @@ const NoteRouter: FastifyPluginCallback<NoteRouterOptions> = (fastify, opts, don
canEdit: boolean;
};
tools: EditorTool[];
parentStructure: NoteParentsStructure;
} | ErrorResponse;
}>('/:notePublicId', {
config: {
Expand Down Expand Up @@ -172,11 +173,14 @@ const NoteRouter: FastifyPluginCallback<NoteRouterOptions> = (fastify, opts, don
*/
const canEdit = memberRole === MemberRole.Write;

const noteParentStructure = await noteService.getNoteParentStructure(noteId, userId!);

return reply.send({
note: notePublic,
parentNote: parentNote,
accessRights: { canEdit: canEdit },
tools: noteTools,
parentStructure: noteParentStructure,
});
});

Expand Down

0 comments on commit a11d1f8

Please sign in to comment.