Skip to content

Commit

Permalink
noteSettings fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shvkhzod committed Nov 27, 2023
1 parent 2314d76 commit f0dcad4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/presentation/http/router/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,23 @@ const NoteRouter: FastifyPluginCallback<NoteRouterOptions> = (fastify, opts, don
}, async (request, reply) => {
const { note } = request;


/**
* Check if note does not exist
*/
if (note === null) {
return reply.notFound('Note not found');
}
/**
* Check if noteSettings Resolver added settings to request
*/
if (request.noteSettings) {
note.noteSettings = request.noteSettings;
}

/**
* Wrap note for public use
*/

const notePublic = changeNoteToNotePublic(note);
const canEdit = note.creatorId == request.userId;

Expand Down Expand Up @@ -277,9 +283,6 @@ const NoteRouter: FastifyPluginCallback<NoteRouterOptions> = (fastify, opts, don
/**
* Wrapping Note for public use
*/



const notePublic = changeNoteToNotePublic(note);
const canEdit = note.creatorId == request.userId;

Expand Down

0 comments on commit f0dcad4

Please sign in to comment.