rez_core 6.5.58 → 6.5.59

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.
Files changed (27) hide show
  1. package/dist/module/listmaster/service/list-master.service.d.ts +14 -1
  2. package/dist/module/listmaster/service/list-master.service.js +216 -36
  3. package/dist/module/listmaster/service/list-master.service.js.map +1 -1
  4. package/dist/module/meta/controller/entity-dynamic.controller.js +6 -3
  5. package/dist/module/meta/controller/entity-dynamic.controller.js.map +1 -1
  6. package/dist/module/meta/controller/entity.controller.js +1 -1
  7. package/dist/module/meta/controller/entity.controller.js.map +1 -1
  8. package/dist/module/meta/entity/attribute-master.entity.d.ts +4 -0
  9. package/dist/module/meta/entity/attribute-master.entity.js +16 -0
  10. package/dist/module/meta/entity/attribute-master.entity.js.map +1 -1
  11. package/dist/module/meta/service/entity-dynamic.service.d.ts +9 -12
  12. package/dist/module/meta/service/entity-dynamic.service.js +20 -22
  13. package/dist/module/meta/service/entity-dynamic.service.js.map +1 -1
  14. package/dist/module/meta/service/entity-service-impl.service.d.ts +1 -1
  15. package/dist/module/meta/service/entity-service-impl.service.js +1 -1
  16. package/dist/module/meta/service/entity-service-impl.service.js.map +1 -1
  17. package/dist/module/workflow/service/task.service.js +1 -1
  18. package/dist/module/workflow/service/task.service.js.map +1 -1
  19. package/dist/tsconfig.build.tsbuildinfo +1 -1
  20. package/package.json +1 -1
  21. package/src/module/listmaster/service/list-master.service.ts +436 -66
  22. package/src/module/meta/controller/entity-dynamic.controller.ts +6 -8
  23. package/src/module/meta/controller/entity.controller.ts +0 -1
  24. package/src/module/meta/entity/attribute-master.entity.ts +13 -0
  25. package/src/module/meta/service/entity-dynamic.service.ts +23 -26
  26. package/src/module/meta/service/entity-service-impl.service.ts +0 -1
  27. package/src/module/workflow/service/task.service.ts +0 -1
@@ -3,27 +3,25 @@ import { STATUS_ACTIVE } from 'src/constant/global.constant';
3
3
  import { EntityManager, In } from 'typeorm';
4
4
  import { UserData } from 'src/module/user/entity/user.entity';
5
5
  import { MediaDataService } from './media-data.service';
6
- import { ResolverService } from './resolver.service';
7
6
  import { EntityMasterRepository } from '../repository/entity-master.repository';
8
- import { ReflectionHelper } from '../../../utils/service/reflection-helper.service';
9
7
  import { ConfigService } from '@nestjs/config';
8
+ import { EntityServiceImpl } from './entity-service-impl.service';
10
9
 
11
10
  @Injectable()
12
- export class EntityDynamicService {
11
+ export class EntityDynamicService extends EntityServiceImpl{
13
12
  constructor(
14
13
  private readonly entityManager: EntityManager,
15
14
  private readonly mediaDataService: MediaDataService,
16
- private readonly resolverService: ResolverService,
17
15
  private readonly entityMasterRepo: EntityMasterRepository,
18
- private readonly reflectionHelper: ReflectionHelper,
19
16
  private readonly configService: ConfigService,
20
17
  ) {
18
+ super();
21
19
  }
22
20
 
23
21
  schema = this.configService.get('DB_SCHEMA');
24
22
 
25
23
  // -----------------------------
26
- async createEntity(
24
+ async createEntityData(
27
25
  entityType: string,
28
26
  entityData: Record<string, any>,
29
27
  loggedInUser: any,
@@ -136,7 +134,7 @@ export class EntityDynamicService {
136
134
  const placeholders: string[] = [];
137
135
 
138
136
  for (const attr of validAttributes) {
139
- if (attr.attribute_key === 'id') continue;
137
+ if (attr.attribute_key === 'id' && !entityData.id) continue;
140
138
 
141
139
  columns.push(attr.attribute_key);
142
140
  values.push(entityData[attr.attribute_key] ?? null);
@@ -159,11 +157,11 @@ export class EntityDynamicService {
159
157
  // ----------------------------- get entity with relations
160
158
 
161
159
  // ----------------------------- create entity with relations
162
- async createEntityWithRelation(
163
- entityType: string,
160
+ async createEntity(
164
161
  data: Record<string, any>,
165
162
  loggedInUser: any,
166
163
  ): Promise<any> {
164
+ const entityType = data.entity_type;
167
165
  const enterpriseId = loggedInUser.enterprise_id;
168
166
  const organizationId = loggedInUser.organization_id;
169
167
 
@@ -179,7 +177,7 @@ export class EntityDynamicService {
179
177
  const { mappedEntities, ...mainData } = data;
180
178
 
181
179
  // create main entity
182
- const createdEntityData = await this.createEntity(
180
+ const createdEntityData = await this.createEntityData(
183
181
  entityType,
184
182
  mainData,
185
183
  loggedInUser,
@@ -204,7 +202,7 @@ export class EntityDynamicService {
204
202
  entity_type: targetEntityType,
205
203
  };
206
204
 
207
- const createdRelatedEntity = await this.createEntity(
205
+ const createdRelatedEntity = await this.createEntityData(
208
206
  targetEntityType,
209
207
  itemWithRef,
210
208
  loggedInUser,
@@ -237,7 +235,7 @@ export class EntityDynamicService {
237
235
  }
238
236
 
239
237
  // ----------------------------- get entity with relations
240
- async getEntityWithRelation(
238
+ async getEntityData(
241
239
  entityType: string,
242
240
  id: number | string,
243
241
  loggedInUser: any,
@@ -320,20 +318,19 @@ export class EntityDynamicService {
320
318
  // ----------------------------- update with relations
321
319
 
322
320
  // ----------------------------- update entity with relations
323
- async updateEntityWithRelations(
324
- entityType: string,
325
- id: number | string,
321
+ async updateEntity(
326
322
  data: Record<string, any>,
327
323
  loggedInUser: any,
328
324
  ): Promise<any> {
325
+ const entityType = data.entity_type;
329
326
  const organizationId = loggedInUser.organization_id;
330
327
  const enterpriseId = loggedInUser.enterprise_id;
331
328
  const { mappedEntities, ...mainData } = data;
332
329
 
333
330
  // Update main entity
334
- const updatedMainEntity = await this.updateEntity(
331
+ const updatedMainEntity = await this.updateEntityData(
335
332
  entityType,
336
- id,
333
+ data.id,
337
334
  mainData,
338
335
  loggedInUser,
339
336
  );
@@ -373,12 +370,12 @@ export class EntityDynamicService {
373
370
 
374
371
  if (item.id) {
375
372
  // Update existing entity
376
- await this.updateEntity(
373
+ await this.updateEntityData(
377
374
  targetEntityType,
378
375
  item.id,
379
376
  item,
380
377
  loggedInUser,
381
- Number(id), // pass main entity id as parent_id
378
+ Number(data.id), // pass main entity id as parent_id
382
379
  );
383
380
  targetEntityId = item.id;
384
381
  entityData = await this.getEntity(
@@ -388,11 +385,11 @@ export class EntityDynamicService {
388
385
  );
389
386
  } else {
390
387
  // Create new entity
391
- const createdEntity = await this.createEntity(
388
+ const createdEntity = await this.createEntityData(
392
389
  targetEntityType,
393
390
  item,
394
391
  loggedInUser,
395
- Number(id), // pass main entity id as parent_id
392
+ Number(data.id), // pass main entity id as parent_id
396
393
  );
397
394
  targetEntityId = createdEntity.insertId || createdEntity.id;
398
395
  entityData = await this.getEntity(
@@ -407,7 +404,7 @@ export class EntityDynamicService {
407
404
  await entityRelationDataRepo.save({
408
405
  organizationId: organizationId,
409
406
  enterprise_id: enterpriseId,
410
- source_entity_id: id,
407
+ source_entity_id: data.id,
411
408
  source_entity_type: entityType,
412
409
  target_entity_id: targetEntityId,
413
410
  target_entity_type: targetEntityType,
@@ -433,7 +430,7 @@ export class EntityDynamicService {
433
430
 
434
431
  return {
435
432
  mainEntity: {
436
- id,
433
+ id: data.id,
437
434
  entityType,
438
435
  data: updatedMainEntity,
439
436
  },
@@ -442,7 +439,7 @@ export class EntityDynamicService {
442
439
  }
443
440
 
444
441
  // -----------------------------
445
- async updateEntity(
442
+ async updateEntityData(
446
443
  entityType: string,
447
444
  id: number | string,
448
445
  entityData: Record<string, any>,
@@ -710,7 +707,7 @@ export class EntityDynamicService {
710
707
  }));
711
708
  }
712
709
 
713
- private async deleteEntity(
710
+ async deleteEntity(
714
711
  entityType: string,
715
712
  id: number | string,
716
713
  loggedInUser: any,
@@ -785,7 +782,7 @@ export class EntityDynamicService {
785
782
  entity: string,
786
783
  loggedInUser: UserData,
787
784
  ): Promise<any> {
788
- const leadData = await this.getEntityWithRelation(entity, id, loggedInUser);
785
+ const leadData = await this.getEntityData(entity, id, loggedInUser);
789
786
 
790
787
  const { mappedEntities, ...data } = leadData as any;
791
788
 
@@ -39,7 +39,6 @@ export class EntityServiceImpl implements EntityService<BaseEntity> {
39
39
  entityData: BaseEntity,
40
40
  loggedInUser: UserData | null,
41
41
  manager?: EntityManager | null,
42
- appcode?: string,
43
42
  ) {
44
43
  if (!entityData.entity_type) {
45
44
  throw new BadRequestException(`EntityType is missing`);
@@ -81,7 +81,6 @@ export class TaskService extends EntityServiceImpl {
81
81
  entityData,
82
82
  loggedInUser,
83
83
  manager,
84
- appcode,
85
84
  );
86
85
 
87
86
  try {