@devline-smart-taxi/common 2.3.72 → 2.3.74

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.
@@ -1,6 +1,7 @@
1
1
  type User = {
2
2
  id: string;
3
3
  role: string;
4
+ branchId?: string;
4
5
  };
5
6
  export declare const CurrentUser: (...dataOrPipes: (keyof User | import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
6
7
  export {};
@@ -5,10 +5,14 @@ const common_1 = require("@nestjs/common");
5
5
  exports.CurrentUser = (0, common_1.createParamDecorator)((data, context) => {
6
6
  // gRPC metadatasini olish
7
7
  const metadata = context.switchToRpc().getContext();
8
- // Metadatadan ma'lumotlarni ajratib olish
8
+ // Canonical keys are user-*.
9
+ const id = metadata.get('user-id')?.[0];
10
+ const role = metadata.get('user-role')?.[0];
11
+ const branchId = metadata.get('user-branch-id')?.[0];
9
12
  const user = {
10
- id: metadata.get('id')[0],
11
- role: metadata.get('role')[0],
13
+ id,
14
+ role,
15
+ branchId,
12
16
  };
13
17
  return data ? user?.[data] : user;
14
18
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devline-smart-taxi/common",
3
- "version": "2.3.72",
3
+ "version": "2.3.74",
4
4
  "description": "Reusable NestJS common library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",