manifest 4.9.0 → 4.9.1
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.
|
@@ -54,7 +54,8 @@ let CrudService = class CrudService {
|
|
|
54
54
|
entityManifest
|
|
55
55
|
});
|
|
56
56
|
if (queryParams?.orderBy) {
|
|
57
|
-
if (
|
|
57
|
+
if (queryParams.orderBy !== 'id' &&
|
|
58
|
+
!entityManifest.properties.find((prop) => prop.name === queryParams.orderBy && !prop.hidden)) {
|
|
58
59
|
throw new common_1.HttpException(`Property ${queryParams.orderBy} does not exist in ${entitySlug} and thus cannot be used for ordering`, common_1.HttpStatus.BAD_REQUEST);
|
|
59
60
|
}
|
|
60
61
|
query.orderBy(`entity.${queryParams.orderBy}`, queryParams.order === 'DESC' ? 'DESC' : 'ASC');
|
|
@@ -64,8 +65,8 @@ let CrudService = class CrudService {
|
|
|
64
65
|
}
|
|
65
66
|
return this.paginationService.paginate({
|
|
66
67
|
query,
|
|
67
|
-
currentPage: parseInt(queryParams
|
|
68
|
-
resultsPerPage: parseInt(queryParams
|
|
68
|
+
currentPage: parseInt(queryParams?.page, 10) || 1,
|
|
69
|
+
resultsPerPage: parseInt(queryParams?.perPage, 10) || constants_1.DEFAULT_RESULTS_PER_PAGE
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
async findSelectOptions({ entitySlug, queryParams }) {
|
|
@@ -15,7 +15,7 @@ exports.typeValidators = {
|
|
|
15
15
|
[types_1.PropType.Date]: (value) => (0, class_validator_1.isDateString)(value) && new RegExp(/^\d{4}-\d{2}-\d{2}$/).test(value)
|
|
16
16
|
? null
|
|
17
17
|
: 'The value must be a valid date',
|
|
18
|
-
[types_1.PropType.Timestamp]: (value) => (0, class_validator_1.isISO8601)(value) ? null : 'The value must be a valid timestamp',
|
|
18
|
+
[types_1.PropType.Timestamp]: (value) => (0, class_validator_1.isISO8601)(value) ? null : 'The value must be a valid ISO 8601 timestamp',
|
|
19
19
|
[types_1.PropType.Email]: (value) => (0, class_validator_1.isEmail)(value) ? null : 'The value must be a valid email address',
|
|
20
20
|
[types_1.PropType.Boolean]: (value) => (0, class_validator_1.isBoolean)(value) ? null : 'The value must be a boolean',
|
|
21
21
|
[types_1.PropType.Password]: (value) => (0, class_validator_1.isString)(value) ? null : 'The value must be a string',
|