From d0eb4aff9b7db52b21eb42cc118170f57db5c478 Mon Sep 17 00:00:00 2001 From: Jamie Vangeysel <32323785+JamieVangeysel@users.noreply.github.com> Date: Fri, 13 Dec 2024 10:10:23 +0100 Subject: [PATCH] fix 204 resp --- src/controllers/directories.controller.ts | 6 +++--- src/repositories/directory.repository.ts | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/controllers/directories.controller.ts b/src/controllers/directories.controller.ts index 03b4f25..30048c0 100644 --- a/src/controllers/directories.controller.ts +++ b/src/controllers/directories.controller.ts @@ -160,7 +160,7 @@ export default async function (fastify: FastifyInstance) { try { const pool = await fastify.getSqlPool() const repo = new Directory(request.log, pool) - const result = await repo.getWatched(request.params.id, request.jwt.sub) + const result = await repo.getWatched(request.jwt.sub) if (result.verified) { if (result.error) return reply.error(result.error) @@ -193,7 +193,7 @@ export default async function (fastify: FastifyInstance) { if (result.verified) { if (result.error) return reply.error(result.error) - return reply.success(null, 200, performance.now() - start) + return reply.success({ success: result.result }, 200, performance.now() - start) } return reply.error('Session has expired!', 401, performance.now() - start) @@ -226,7 +226,7 @@ export default async function (fastify: FastifyInstance) { if (result.verified) { if (result.error) return reply.error(result.error) - return reply.success(null, 200, performance.now() - start) + return reply.success({ success: result.result }, 200, performance.now() - start) } return reply.error('Session has expired!', 401, performance.now() - start) diff --git a/src/repositories/directory.repository.ts b/src/repositories/directory.repository.ts index b1608c6..e35d2cf 100644 --- a/src/repositories/directory.repository.ts +++ b/src/repositories/directory.repository.ts @@ -122,10 +122,9 @@ export default class Directory { } } - async getWatched(id: number, user_id?: string): Promise { + async getWatched(user_id?: string): Promise { const r = new sql.Request(this._pool) r.input('user_id', sql.Int, user_id) - r.input('directory_id', sql.Int, id) const result = await r.execute(`account.uspGetWatchedDirectories`)