@fabx.vn/core 1.0.15 → 1.0.17
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.
- package/dist/config/redis-cache.config.js +2 -2
- package/dist/config/redis-cache.config.js.map +1 -1
- package/dist/config/redis.config.js +1 -1
- package/dist/config/redis.config.js.map +1 -1
- package/dist/core/decorators/current-user.decorator.js +17 -1
- package/dist/core/decorators/current-user.decorator.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.redisCacheConfig = void 0;
|
|
4
4
|
exports.redisCacheConfig = {
|
|
5
|
-
host: process.env.REDIS_CACHE_HOST || "
|
|
6
|
-
port: parseInt(process.env.REDIS_CACHE_PORT || "
|
|
5
|
+
host: process.env.REDIS_CACHE_HOST || "redis-cache",
|
|
6
|
+
port: parseInt(process.env.REDIS_CACHE_PORT || "6379"),
|
|
7
7
|
password: process.env.REDIS_CACHE_PASSWORD || undefined,
|
|
8
8
|
db: 0,
|
|
9
9
|
retryDelayOnFailover: 100,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redis-cache.config.js","sourceRoot":"","sources":["../../src/config/redis-cache.config.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG;IAC9B,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,
|
|
1
|
+
{"version":3,"file":"redis-cache.config.js","sourceRoot":"","sources":["../../src/config/redis-cache.config.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG;IAC9B,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,aAAa;IACnD,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,MAAM,CAAC;IACtD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,SAAS;IACvD,EAAE,EAAE,CAAC;IACL,oBAAoB,EAAE,GAAG;IACzB,gBAAgB,EAAE,KAAK;IACvB,oBAAoB,EAAE,IAAI;CAC3B,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.redisConfig = void 0;
|
|
4
4
|
exports.redisConfig = {
|
|
5
|
-
host: process.env.SHARED_REDIS_HOST || "
|
|
5
|
+
host: process.env.SHARED_REDIS_HOST || "redis-shared",
|
|
6
6
|
port: parseInt(process.env.SHARED_REDIS_PORT || "6379"),
|
|
7
7
|
password: process.env.SHARED_REDIS_PASSWORD || undefined,
|
|
8
8
|
db: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redis.config.js","sourceRoot":"","sources":["../../src/config/redis.config.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;IACzB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,
|
|
1
|
+
{"version":3,"file":"redis.config.js","sourceRoot":"","sources":["../../src/config/redis.config.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;IACzB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,cAAc;IACrD,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,MAAM,CAAC;IACvD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,SAAS;IACxD,EAAE,EAAE,CAAC;IACL,oBAAoB,EAAE,GAAG;IACzB,gBAAgB,EAAE,KAAK;IACvB,oBAAoB,EAAE,IAAI;CAC3B,CAAC"}
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CurrentUser = void 0;
|
|
4
|
+
const messages_constants_1 = require("../../constants/messages.constants");
|
|
4
5
|
const common_1 = require("@nestjs/common");
|
|
5
6
|
exports.CurrentUser = (0, common_1.createParamDecorator)((data, ctx) => {
|
|
6
7
|
const request = ctx.switchToHttp().getRequest();
|
|
7
|
-
|
|
8
|
+
const user = request.user;
|
|
9
|
+
if (!user) {
|
|
10
|
+
throw new common_1.UnauthorizedException(messages_constants_1.MESSAGES.AUTH.INVALID_TOKEN);
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
companyId: parseInt(user.companyId || "0"),
|
|
14
|
+
uuid: user.uuid || "",
|
|
15
|
+
userId: parseInt(user.userId || "0"),
|
|
16
|
+
orgUnitId: parseInt(user.orgUnitId || "0"),
|
|
17
|
+
email: user.email || "",
|
|
18
|
+
fullName: user.fullName || "",
|
|
19
|
+
employeeCode: user.employeeCode || "",
|
|
20
|
+
avatar: user.avatar || "",
|
|
21
|
+
dataScope: user.dataScope || "",
|
|
22
|
+
permissions: user.permissions || [],
|
|
23
|
+
};
|
|
8
24
|
});
|
|
9
25
|
//# sourceMappingURL=current-user.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"current-user.decorator.js","sourceRoot":"","sources":["../../../src/core/decorators/current-user.decorator.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"current-user.decorator.js","sourceRoot":"","sources":["../../../src/core/decorators/current-user.decorator.ts"],"names":[],"mappings":";;;AAAA,sEAAyD;AAEzD,2CAIwB;AAEX,QAAA,WAAW,GAAG,IAAA,6BAAoB,EAC7C,CAAC,IAAa,EAAE,GAAqB,EAAkB,EAAE;IACvD,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IAChD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,8BAAqB,CAAC,6BAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO;QACL,SAAS,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS,IAAI,GAAG,CAAC;QAC1C,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE;QACrB,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,IAAI,GAAG,CAAC;QACpC,SAAS,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS,IAAI,GAAG,CAAC;QAC1C,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,EAAE;QACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE;QAC7B,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,EAAE;QACrC,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE;QACzB,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,EAAE;QAC/B,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,EAAE;KACpC,CAAC;AACJ,CAAC,CACF,CAAC"}
|