rez_core 1.0.36 → 1.0.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -1,16 +1,23 @@
1
- import { Controller, Get, Req, UseGuards } from '@nestjs/common';
1
+ import { Controller, Get, Inject, Req, UseGuards } from '@nestjs/common';
2
2
  import { OrganizationService } from '../service/organization.service';
3
3
  import { Request } from 'express';
4
4
  import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
5
+ import { UserService } from 'src/module/user/service/user.service';
6
+ import { ENTITYTYPE_USER } from '../../../constant/global.constant';
7
+
5
8
 
6
9
  @Controller('organization')
7
10
  export class OrganizationController {
8
- constructor(private readonly orgService: OrganizationService) {}
11
+ constructor(private readonly orgService: OrganizationService,
12
+ @Inject('UserService') private readonly userService: UserService
13
+ ) {}
9
14
 
10
15
  @UseGuards(JwtAuthGuard)
11
16
  @Get('dropdown')
12
- async getOrganizationDropdown(@Req() req: Request) {
17
+ async getOrganizationDropdown(@Req() req: Request & { user: any }) {
18
+ const userId = req.user.userId;
19
+ const userData = await this.userService.getEntityData(ENTITYTYPE_USER, userId);
13
20
  // const enterpriseId = req.user['enterpriseId']; // or adapt based on your user structure
14
- return this.orgService.findAll();
21
+ return this.orgService.findById(userData?.organization_id);
15
22
  }
16
23
  }
@@ -46,6 +46,10 @@ export class OrganizationService {
46
46
  return await repo.findOne({ where: { id } });
47
47
  }
48
48
 
49
+ async findById(id:number | undefined){
50
+ return await this.organizationRepository.find({ where: { id } });
51
+ }
52
+
49
53
  async update(
50
54
  id: number,
51
55
  organizationDto: Partial<OrganizationData>,