From e1f4b4ade86e74b1aaf3827d616cdd18cc77034f Mon Sep 17 00:00:00 2001 From: "iamgabrielsoft@gmail.com" Date: Mon, 20 May 2024 09:17:18 +0100 Subject: [PATCH 1/2] change join route method to POST --- src/presentation/http/router/join.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/presentation/http/router/join.ts b/src/presentation/http/router/join.ts index f42518038..528c1d611 100644 --- a/src/presentation/http/router/join.ts +++ b/src/presentation/http/router/join.ts @@ -9,7 +9,7 @@ interface JoinRouterOptions { /** * Note settings service instance */ - noteSettings: NoteSettingsService + noteSettings: NoteSettingsService; } /** @@ -25,12 +25,12 @@ const JoinRouter: FastifyPluginCallback = (fastify, opts, don const noteSettingsService = opts.noteSettings; fastify.post<{ - Params: { + Body: { hash: string - } + }, }>('/:hash', { schema: { - params: { + body: { hash: { $ref: 'JoinSchemaParams#/properties/hash', }, @@ -54,7 +54,7 @@ const JoinRouter: FastifyPluginCallback = (fastify, opts, don ], }, }, async (request, reply) => { - const { hash } = request.params; + const { hash } = request.body; const { userId } = request; let result: TeamMember | null = null; From a6c53a55f2d227a952b375e75d8eea5d3fd32081 Mon Sep 17 00:00:00 2001 From: "iamgabrielsoft@gmail.com" Date: Mon, 20 May 2024 10:27:41 +0100 Subject: [PATCH 2/2] change join route method to POST --- src/presentation/http/router/join.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/presentation/http/router/join.test.ts b/src/presentation/http/router/join.test.ts index fd1e5f1ca..279bcc360 100644 --- a/src/presentation/http/router/join.test.ts +++ b/src/presentation/http/router/join.test.ts @@ -42,6 +42,7 @@ describe('Join API', () => { headers: { authorization: `Bearer ${accessToken}`, }, + body: { invitationHash }, url: `/join/${invitationHash}`, }); @@ -61,6 +62,7 @@ describe('Join API', () => { headers: { authorization: `Bearer ${accessToken}`, }, + body: { hash }, url: `/join/${hash}`, }); @@ -107,6 +109,7 @@ describe('Join API', () => { headers: { authorization: `Bearer ${accessToken}`, }, + body: { invitationHash }, url: `/join/${invitationHash}`, });