Skip to content

Commit d30d684

Browse files
author
Alexander Kharkovey
committed
fix(json-api-nestjs): should be throw NotFoundException
incorrect check for empty result
1 parent b72f12b commit d30d684

File tree

1 file changed

+1
-1
lines changed
  • libs/json-api-nestjs/src/lib/mixin/service/typeorm/methods/get-one

1 file changed

+1
-1
lines changed

libs/json-api-nestjs/src/lib/mixin/service/typeorm/methods/get-one/get-one.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export async function getOne<T>(
6161
.where({ id })
6262
.getRawMany();
6363

64-
if (!result) {
64+
if (result.length === 0) {
6565
throw new NotFoundException({
6666
detail: `Resource '${preparedResourceName}' with id '${id}' does not exist`,
6767
});

0 commit comments

Comments
 (0)