pangea-server 1.0.39 → 1.0.41
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.
|
@@ -15,10 +15,6 @@ const decorators_1 = require("../decorators");
|
|
|
15
15
|
class User extends base_model_class_1.BaseModel {
|
|
16
16
|
}
|
|
17
17
|
exports.User = User;
|
|
18
|
-
__decorate([
|
|
19
|
-
decorators_1.col.Str({ unique: true, minLength: 8, maxLength: 'short' }),
|
|
20
|
-
__metadata("design:type", String)
|
|
21
|
-
], User.prototype, "username", void 0);
|
|
22
18
|
__decorate([
|
|
23
19
|
decorators_1.col.Str({ exclude: true, maxLength: 'medium' }),
|
|
24
20
|
__metadata("design:type", Object)
|
|
@@ -13,12 +13,14 @@ const validate_request_1 = require("../validator/validate-request");
|
|
|
13
13
|
function callController(controller, validate, authConfig) {
|
|
14
14
|
return async function (req, res) {
|
|
15
15
|
const inputs = (0, validate_request_1.validateRequest)(validate, req);
|
|
16
|
-
const
|
|
16
|
+
const xBusiness = req.headers['x-business'];
|
|
17
|
+
const headers = { ...req.headers, 'x-business': xBusiness && Number(xBusiness) };
|
|
18
|
+
const ctx = { headers, file: req.file, files: req.files, ...inputs };
|
|
17
19
|
const tx = await (0, database_1.getDbClient)().transaction();
|
|
20
|
+
const db = new database_1.Db(tx);
|
|
18
21
|
try {
|
|
19
|
-
const db = new database_1.Db(tx);
|
|
20
22
|
const { authMap, authCtor, accessToken } = authConfig;
|
|
21
|
-
const authUsers = await (0, authentication_1.getUsersFromToken)(
|
|
23
|
+
const authUsers = await (0, authentication_1.getUsersFromToken)(headers.authorization, db, accessToken, authMap);
|
|
22
24
|
const auth = new authCtor(authUsers);
|
|
23
25
|
const result = await controller(ctx, db, auth);
|
|
24
26
|
await tx.commit();
|