From 33d084511462abdfbabf71d07bb53248fff3b8f3 Mon Sep 17 00:00:00 2001 From: Alexander Chernyaev <265195@niuitmo.ru> Date: Thu, 19 Oct 2023 10:45:23 +0300 Subject: [PATCH] Update noteList.ts Delete nterface GetNoteListById in notelist router --- src/presentation/http/router/noteList.ts | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/presentation/http/router/noteList.ts b/src/presentation/http/router/noteList.ts index a9f95d1f..2bc926cd 100644 --- a/src/presentation/http/router/noteList.ts +++ b/src/presentation/http/router/noteList.ts @@ -1,25 +1,16 @@ import type { FastifyPluginCallback } from 'fastify'; import type NoteListService from '@domain/service/noteList'; import type { Middlewares } from '@presentation/http/middlewares/index.js'; -import type { NoteCreatorId } from '@domain/entities/note'; import type { ErrorResponse } from '@presentation/http/types/HttpResponse'; import { StatusCodes } from 'http-status-codes'; import type { NoteList } from '@domain/entities/noteList'; - -interface GetNoteListById { - /** - * Note id - */ - id: NoteCreatorId; -}; - /** * Interface for the noteList router. */ interface NoteListRouterOptions { /** - * Note service instance + * Note list service instance */ noteListService: NoteListService, @@ -31,7 +22,7 @@ interface NoteListRouterOptions { /** - * Note router plugin + * Note list router plugin * * @param fastify - fastify instance * @param opts - empty options @@ -42,15 +33,15 @@ const NoteListRouter: FastifyPluginCallback = (fastify, o const noteListService = opts.noteListService; /** - * Get note by id + * Get note list by userId */ - fastify.get<{ Params: GetNoteListById }>('/', { preHandler: [opts.middlewares.authRequired, opts.middlewares.withUser] }, async (request, reply) => { + fastify.get('/', { preHandler: [opts.middlewares.authRequired, opts.middlewares.withUser] }, async (request, reply) => { const userId = request.ctx.auth.id; const noteList = await noteListService.getNoteListByCreatorId(userId); /** - * Check if noteList does not exist + * Check if note list does not exist */ if (!noteList) { const response: ErrorResponse = {