Ver Fonte

chore: Refactor handling of list `take` arg

Michael Bromley há 3 anos atrás
pai
commit
47b54e68da

+ 1 - 1
packages/core/src/service/helpers/list-query-builder/list-query-builder.ts

@@ -277,7 +277,7 @@ export class ListQueryBuilder implements OnApplicationBootstrap {
         const rawConnection = this.connection.rawConnection;
         const skip = Math.max(options.skip ?? 0, 0);
         // `take` must not be negative, and must not be greater than takeLimit
-        let take = Math.min(Math.max(options.take ?? 0, 0), takeLimit) || takeLimit;
+        let take = options.take == null ? takeLimit : Math.min(Math.max(options.take, 0), takeLimit);
         if (options.skip !== undefined && options.take === undefined) {
             take = takeLimit;
         }