Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
sombriks committed Jul 8, 2023
1 parent 860ac8f commit 0061c3a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion service-node-koa/app/config/security/middleware.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export const ifAuthenticated = (ctx, next) => {
export const contaOwnedBy = async (ctx, next) => {
const { usuario_id, conta_id } = ctx.request.params;
const [count] = await knex("conta").where({ usuario_id, id: conta_id }).count();
if (count[Object.keys(count)]) await next();
if (count[Object.keys(count)[0]]) await next();
else throw new Error(`Conta ${conta_id} não pertence ao usuário ${usuario_id}`);
};

0 comments on commit 0061c3a

Please sign in to comment.