rez_core 4.0.30 → 4.0.34

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": "4.0.30",
3
+ "version": "4.0.34",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -1,6 +1,7 @@
1
1
  import { EntityService } from './entity.service';
2
2
  import {
3
3
  BadRequestException,
4
+ forwardRef,
4
5
  Inject,
5
6
  Injectable,
6
7
  NotFoundException,
@@ -40,7 +41,7 @@ export class EntityServiceImpl implements EntityService<BaseEntity> {
40
41
  @Inject()
41
42
  protected readonly entityValidationService: EntityValidationService;
42
43
  protected readonly attributeMasterService: AttributeMasterService;
43
- @Inject()
44
+ @Inject(forwardRef(() => ResolverService))
44
45
  protected readonly resolverService: ResolverService;
45
46
 
46
47
  async createEntity(
@@ -3,15 +3,29 @@ import { Inject, Injectable } from '@nestjs/common';
3
3
  import { UserData } from '../../user/entity/user.entity';
4
4
  import * as moment from 'moment';
5
5
  import { ListMasterService } from 'src/module/listmaster/service/list-master.service';
6
+ import { ModuleRef } from '@nestjs/core';
6
7
 
7
8
  @Injectable()
8
9
  export class ResolverService {
10
+ private mediaDataService: any;
11
+
9
12
  constructor(
10
13
  private readonly dataSource: DataSource,
11
14
  @Inject('ListMasterService')
12
15
  private readonly listMasterService: ListMasterService,
16
+ private readonly moduleRef: ModuleRef,
13
17
  ) {}
14
18
 
19
+ private async getMediaDataService() {
20
+ if (!this.mediaDataService) {
21
+ const { MediaDataService } = await import('./media-data.service');
22
+ this.mediaDataService = this.moduleRef.get(MediaDataService, {
23
+ strict: false,
24
+ });
25
+ }
26
+ return this.mediaDataService;
27
+ }
28
+
15
29
  async getResolvedData(
16
30
  loggedInUser: any,
17
31
  entityData: any,
@@ -85,6 +99,19 @@ export class ResolverService {
85
99
  : dateValue.format('DD-MM-YYYY HH:mm:ss');
86
100
  }
87
101
  }
102
+
103
+ // --------UPLOAD / IMAGE --------
104
+ else if (
105
+ attr.element_type === 'upload' ||
106
+ attr.element_type === 'image'
107
+ ) {
108
+ const mediaService = await this.getMediaDataService();
109
+ const uploadData = await mediaService.getMediaDownloadUrl(
110
+ resolvedEntityData[field],
111
+ loggedInUser,
112
+ );
113
+ resolvedEntityData[field] = uploadData;
114
+ }
88
115
  }
89
116
 
90
117
  return resolvedEntityData;
@@ -1,4 +1,9 @@
1
- import { BadGatewayException, Inject, Injectable, Logger } from '@nestjs/common';
1
+ import {
2
+ BadGatewayException,
3
+ Inject,
4
+ Injectable,
5
+ Logger,
6
+ } from '@nestjs/common';
2
7
  import { ConfigService } from '@nestjs/config';
3
8
  import { InjectRepository } from '@nestjs/typeorm';
4
9
  import axios from 'axios';
@@ -30,7 +35,6 @@ export class WorkflowMetaService extends EntityServiceImpl {
30
35
  @Inject('EntityModificationService')
31
36
  private readonly modificationService: EntityModificationService,
32
37
  private readonly configService: ConfigService,
33
- private readonly logger = new Logger(WorkflowMetaService.name)
34
38
  ) {
35
39
  super();
36
40
  }
@@ -554,9 +558,8 @@ export class WorkflowMetaService extends EntityServiceImpl {
554
558
  console.error('Internal Entity API call failed:', error.message);
555
559
  }
556
560
 
557
- if (!owners?.length) this.logger.log(
558
- `No eligible users found for lead assignment`,
559
- );
561
+ if (!owners?.length)
562
+ console.log('No eligible owners found for lead assignment.');
560
563
  const userIds = owners?.map((o) => Number(o.id)); // normalize to numbers
561
564
 
562
565
  // 2) Find the last assigned *eligible* owner (use IN (...))