@nest-omni/core 3.1.2-6 → 3.1.2-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -33,22 +33,23 @@ typeorm_1.SelectQueryBuilder.prototype.toDtoPage = function (pageOptionsDto, dto
|
|
|
33
33
|
const page = pageOptionsDto.page || 1;
|
|
34
34
|
const pageSize = pageOptionsDto.pageSize || 10;
|
|
35
35
|
const skip = (page - 1) * pageSize;
|
|
36
|
-
const
|
|
36
|
+
const total = yield this.getCount();
|
|
37
37
|
const entities = yield this.skip(skip).take(pageSize).getMany();
|
|
38
|
-
|
|
38
|
+
const count = entities.length;
|
|
39
|
+
if (count) {
|
|
39
40
|
console.log('Raw entity sample:', JSON.stringify(entities[0], null, 2));
|
|
40
41
|
}
|
|
41
42
|
const data = yield entities.toDto(dtoClass, context);
|
|
42
43
|
if (data.length > 0) {
|
|
43
44
|
console.log('Converted DTO sample:', JSON.stringify(data[0], null, 2));
|
|
44
45
|
}
|
|
45
|
-
const
|
|
46
|
-
const pageCount = Math.ceil(itemCount / pageSize);
|
|
46
|
+
const pageCount = Math.ceil(total / pageSize);
|
|
47
47
|
const hasPreviousPage = page > 1;
|
|
48
48
|
const hasNextPage = page < pageCount;
|
|
49
49
|
return {
|
|
50
50
|
data,
|
|
51
|
-
|
|
51
|
+
count,
|
|
52
|
+
total,
|
|
52
53
|
page,
|
|
53
54
|
pageCount,
|
|
54
55
|
hasPreviousPage,
|
package/package.json
CHANGED