@wrcb/cb-common 1.0.431 → 1.0.433
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.
|
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.isValidMongoId = isValidMongoId;
|
|
7
|
-
const
|
|
7
|
+
const badRequestError_1 = require("../errors/badRequestError");
|
|
8
8
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
9
9
|
function isValidMongoId(id) {
|
|
10
10
|
if (!mongoose_1.default.Types.ObjectId.isValid(id)) {
|
|
11
|
-
throw new
|
|
11
|
+
throw new badRequestError_1.BadRequestError('InvalidFeedPostId');
|
|
12
12
|
}
|
|
13
13
|
return true;
|
|
14
14
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isValidTenant = isValidTenant;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const badRequestError_1 = require("../errors/badRequestError");
|
|
5
|
+
const tenant_1 = require("../types/tenant");
|
|
6
6
|
function isValidTenant(tenant) {
|
|
7
7
|
// Verificar se tenant existe e é string
|
|
8
8
|
if (!tenant || typeof tenant !== 'string') {
|
|
9
|
-
throw new
|
|
9
|
+
throw new badRequestError_1.BadRequestError('TenantRequired');
|
|
10
10
|
}
|
|
11
11
|
// Verificar se é um tenant válido
|
|
12
|
-
if (!Object.values(
|
|
13
|
-
throw new
|
|
12
|
+
if (!Object.values(tenant_1.Tenant).includes(tenant)) {
|
|
13
|
+
throw new badRequestError_1.BadRequestError('InvalidTenant');
|
|
14
14
|
}
|
|
15
15
|
return true;
|
|
16
16
|
}
|