rez_core 5.0.15 → 5.0.16

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": "5.0.15",
3
+ "version": "5.0.16",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -1,10 +1,12 @@
1
1
  import { Injectable } from '@nestjs/common';
2
2
  import { EntityServiceImpl } from './entity-service-impl.service';
3
3
  import { DataSource } from 'typeorm';
4
+ import { EntityMasterRepository } from '../repository/entity-master.repository';
4
5
 
5
6
  @Injectable()
6
7
  export class EntityRelationService extends EntityServiceImpl {
7
- constructor(private readonly dataSource: DataSource) {
8
+ constructor(private readonly dataSource: DataSource,
9
+ private entityMasterRepo: EntityMasterRepository) {
8
10
  super();
9
11
  }
10
12
 
@@ -21,16 +23,11 @@ export class EntityRelationService extends EntityServiceImpl {
21
23
  );
22
24
 
23
25
  if (includeSelf) {
24
- const [entity] = await this.dataSource.query(
25
- `SELECT name as label
26
- FROM frm_entity_master
27
- WHERE mapped_entity_type = $1 AND organization_id = $2`,
28
- [entityType, loggedInUser.organization_id],
29
- );
26
+ const entity = await this.entityMasterRepo.getEntityByMappedEntityType(entityType, loggedInUser.organization_id);
30
27
 
31
28
  if (entity) {
32
29
  relations.unshift({
33
- label: entity.label,
30
+ label: entity.name,
34
31
  value: entityType,
35
32
  id: null, // or some special marker
36
33
  });
@@ -4,6 +4,7 @@ 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
6
  import { ModuleRef } from '@nestjs/core';
7
+ import { AttributeMasterRepository } from '../repository/attribute-master.repository';
7
8
 
8
9
  @Injectable()
9
10
  export class ResolverService {
@@ -14,6 +15,7 @@ export class ResolverService {
14
15
  @Inject('ListMasterService')
15
16
  private readonly listMasterService: ListMasterService,
16
17
  private readonly moduleRef: ModuleRef,
18
+ private readonly attributeMasterRepo: AttributeMasterRepository
17
19
  ) {}
18
20
 
19
21
  private async getMediaDataService() {
@@ -31,10 +33,7 @@ export class ResolverService {
31
33
  entityData: any,
32
34
  entityType: string,
33
35
  ): Promise<any> {
34
- const attributeItems = await this.dataSource.query(
35
- `SELECT * FROM frm_entity_attribute WHERE mapped_entity_type = $1 AND organization_id = $2`,
36
- [entityType, loggedInUser.organization_id],
37
- );
36
+ const attributeItems = await this.attributeMasterRepo.findAttributesByMappedEntityType(entityType, loggedInUser.organization_id);
38
37
 
39
38
  const resolvedEntityData = { ...entityData };
40
39