rez_core 3.1.182 → 3.1.184

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": "3.1.182",
3
+ "version": "3.1.184",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -0,0 +1,75 @@
1
+ import {
2
+ BadRequestException,
3
+ Controller,
4
+ Get,
5
+ Param,
6
+ Query,
7
+ } from '@nestjs/common';
8
+ import { WorkflowAutomationEngineService } from 'src/module/workflow-automation/service/workflow-automation-engine.service';
9
+ import { ReflectionHelper } from '../../../utils/service/reflection-helper.service';
10
+ import { EntityMasterService } from '../service/entity-master.service';
11
+ import { EntityServiceImpl } from '../service/entity-service-impl.service';
12
+
13
+ @Controller('entity/public')
14
+ export class EntityPublicController {
15
+ constructor(
16
+ private entityService: EntityServiceImpl,
17
+ private reflectionHelper: ReflectionHelper,
18
+ private entityMasterService: EntityMasterService,
19
+ private readonly workflowAutomationEngineService: WorkflowAutomationEngineService,
20
+ ) {}
21
+
22
+ @Get('getById/:id')
23
+ async getPublicById(
24
+ @Param('id') id: number,
25
+ @Query() queryParams: Record<string, string>,
26
+ ) {
27
+ const {
28
+ entity_type: entityType,
29
+ loggedInUser: loggedInUserParam,
30
+ ...params
31
+ } = queryParams;
32
+
33
+ if (!entityType) {
34
+ throw new BadRequestException(
35
+ 'Query parameter "entity_type" is required',
36
+ );
37
+ }
38
+
39
+ // Default user object (if organization_id or appcode is needed in service)
40
+ let loggedInUser: any = {};
41
+
42
+ if (typeof loggedInUserParam === 'string') {
43
+ try {
44
+ loggedInUser = JSON.parse(loggedInUserParam);
45
+ } catch (e) {
46
+ loggedInUser = {};
47
+ }
48
+ } else if (
49
+ typeof loggedInUserParam === 'object' &&
50
+ loggedInUserParam !== null
51
+ ) {
52
+ loggedInUser = loggedInUserParam;
53
+ } else {
54
+ loggedInUser = {};
55
+ }
56
+
57
+ if (!entityType) {
58
+ throw new BadRequestException(
59
+ 'Query parameter "entity_type" is required',
60
+ );
61
+ }
62
+ const entityMaster = await this.entityMasterService.getEntityData(
63
+ entityType,
64
+ loggedInUser,
65
+ );
66
+ const entityService =
67
+ await this.reflectionHelper.getBean<EntityServiceImpl>(
68
+ entityMaster.entity_service,
69
+ );
70
+
71
+ if (entityService) {
72
+ return await entityService.getEntityData(entityType, id, loggedInUser);
73
+ }
74
+ }
75
+ }
@@ -59,6 +59,7 @@ import { CommonService } from './service/common.service';
59
59
  import { EntityMasterRepository } from './repository/entity-master.repository';
60
60
  import { EntityMasterController } from './controller/entity-master.controller';
61
61
  import { WorkflowAutomationModule } from '../workflow-automation/workflow-automation.module';
62
+ import { EntityPublicController } from './controller/entity.public.controller';
62
63
 
63
64
  @Module({
64
65
  imports: [
@@ -78,7 +79,7 @@ import { WorkflowAutomationModule } from '../workflow-automation/workflow-automa
78
79
  forwardRef(() => ListMasterModule),
79
80
  forwardRef(() => FilterModule),
80
81
  UtilsModule,
81
- WorkflowAutomationModule
82
+ WorkflowAutomationModule,
82
83
  ],
83
84
  providers: [
84
85
  EntityMasterService,
@@ -138,7 +139,7 @@ import { WorkflowAutomationModule } from '../workflow-automation/workflow-automa
138
139
  ResolverService,
139
140
  EntityDynamicService,
140
141
  'CommonService',
141
- 'EntityRelationService'
142
+ 'EntityRelationService',
142
143
  ],
143
144
  controllers: [
144
145
  EntityController,
@@ -151,6 +152,7 @@ import { WorkflowAutomationModule } from '../workflow-automation/workflow-automa
151
152
  EntityDynamicController,
152
153
  EntityRelationController,
153
154
  EntityMasterController,
155
+ EntityPublicController,
154
156
  ],
155
157
  })
156
158
  export class EntityModule {}
@@ -1,3 +1,4 @@
1
+ import { app } from 'firebase-admin';
1
2
  import { BadGatewayException, Inject, Injectable } from '@nestjs/common';
2
3
  import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
3
4
  import { StageGroupRepository } from '../repository/stage-group.repository';
@@ -10,6 +11,8 @@ import { InjectRepository } from '@nestjs/typeorm';
10
11
  import { StageMovementData } from '../entity/stage-movement-data.entity';
11
12
  import * as moment from 'moment';
12
13
  import { MediaDataService } from 'src/module/meta/service/media-data.service';
14
+ import axios from 'axios';
15
+ import { ConfigService } from '@nestjs/config';
13
16
 
14
17
  @Injectable()
15
18
  export class StageGroupService extends EntityServiceImpl {
@@ -23,6 +26,7 @@ export class StageGroupService extends EntityServiceImpl {
23
26
  @InjectRepository(StageMovementData)
24
27
  private readonly stageMovementRepo: Repository<StageMovementData>,
25
28
  private readonly mediaDataService: MediaDataService,
29
+ private readonly configService: ConfigService,
26
30
  ) {
27
31
  super();
28
32
  }
@@ -206,13 +210,39 @@ export class StageGroupService extends EntityServiceImpl {
206
210
  userId: number,
207
211
  loggedInUser: UserData,
208
212
  ): Promise<any> {
209
- const user = await this.dataSource.query(
210
- `SELECT eth_user_profile.name AS created_by_name,
211
- eth_user_profile.profile_image AS profile_image
212
- FROM eth_user_profile
213
- WHERE eth_user_profile.id = ?;`,
214
- [userId],
215
- );
213
+ // const user = await this.dataSource.query(
214
+ // `SELECT eth_user_profile.name AS created_by_name,
215
+ // eth_user_profile.profile_image AS profile_image
216
+ // FROM eth_user_profile
217
+ // WHERE eth_user_profile.id = ?;`,
218
+ // [userId],
219
+ // );
220
+
221
+ let user: any = [];
222
+
223
+ try {
224
+ const baseUrl = this.configService.get<string>('REDIRECT_BE_URL');
225
+
226
+ // Prepare the query string
227
+ const queryParams = new URLSearchParams({
228
+ loggedInUser: JSON.stringify(loggedInUser),
229
+ }).toString();
230
+
231
+ // Make the GET request with query parameters
232
+ const response = await axios.get(
233
+ `${baseUrl}/entity/public/getById/${userId}?entity_type=UPR&${queryParams}`,
234
+ {
235
+ headers: {
236
+ 'Content-Type': 'application/json',
237
+ },
238
+ },
239
+ );
240
+
241
+ console.log('✅ Internal Entity API response:', response.data);
242
+ user = [response.data];
243
+ } catch (error) {
244
+ console.error('⚠️ Internal Entity API call failed:', error.message);
245
+ }
216
246
 
217
247
  if (user.length === 0) return null;
218
248