Skip to content

Commit

Permalink
fix 204 resp
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieVangeysel committed Dec 13, 2024
1 parent a8fc85a commit d0eb4af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/controllers/directories.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions src/repositories/directory.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,9 @@ export default class Directory {
}
}

async getWatched(id: number, user_id?: string): Promise<IRepositoryResult> {
async getWatched(user_id?: string): Promise<IRepositoryResult> {
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`)

Expand Down

0 comments on commit d0eb4af

Please sign in to comment.