rez_core 2.2.109 → 2.2.111

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 (55) hide show
  1. package/dist/app.module.js +2 -0
  2. package/dist/app.module.js.map +1 -1
  3. package/dist/constant/global.constant.d.ts +2 -0
  4. package/dist/constant/global.constant.js +3 -1
  5. package/dist/constant/global.constant.js.map +1 -1
  6. package/dist/module/ics/controller/ics.controller.d.ts +8 -0
  7. package/dist/module/ics/controller/ics.controller.js +45 -0
  8. package/dist/module/ics/controller/ics.controller.js.map +1 -0
  9. package/dist/module/ics/dto/ics.dto.d.ts +17 -0
  10. package/dist/module/ics/dto/ics.dto.js +73 -0
  11. package/dist/module/ics/dto/ics.dto.js.map +1 -0
  12. package/dist/module/ics/ics.module.d.ts +2 -0
  13. package/dist/module/ics/ics.module.js +26 -0
  14. package/dist/module/ics/ics.module.js.map +1 -0
  15. package/dist/module/ics/service/ics.service.d.ts +5 -0
  16. package/dist/module/ics/service/ics.service.js +55 -0
  17. package/dist/module/ics/service/ics.service.js.map +1 -0
  18. package/dist/module/meta/controller/entity-dynamic.controller.js +3 -3
  19. package/dist/module/meta/controller/entity-dynamic.controller.js.map +1 -1
  20. package/dist/module/meta/controller/entity-relation.controller.d.ts +6 -0
  21. package/dist/module/meta/controller/entity-relation.controller.js +43 -0
  22. package/dist/module/meta/controller/entity-relation.controller.js.map +1 -0
  23. package/dist/module/meta/entity/entity-relation-data.entity.d.ts +10 -0
  24. package/dist/module/meta/entity/entity-relation-data.entity.js +51 -0
  25. package/dist/module/meta/entity/entity-relation-data.entity.js.map +1 -0
  26. package/dist/module/meta/entity/entity-relation.entity.d.ts +10 -0
  27. package/dist/module/meta/entity/entity-relation.entity.js +51 -0
  28. package/dist/module/meta/entity/entity-relation.entity.js.map +1 -0
  29. package/dist/module/meta/entity.module.js +16 -3
  30. package/dist/module/meta/entity.module.js.map +1 -1
  31. package/dist/module/meta/service/entity-dynamic.service.d.ts +5 -0
  32. package/dist/module/meta/service/entity-dynamic.service.js +195 -5
  33. package/dist/module/meta/service/entity-dynamic.service.js.map +1 -1
  34. package/dist/module/meta/service/entity-realation-data.service.d.ts +4 -0
  35. package/dist/module/meta/service/entity-realation-data.service.js +25 -0
  36. package/dist/module/meta/service/entity-realation-data.service.js.map +1 -0
  37. package/dist/module/meta/service/entity-relation.service.d.ts +7 -0
  38. package/dist/module/meta/service/entity-relation.service.js +31 -0
  39. package/dist/module/meta/service/entity-relation.service.js.map +1 -0
  40. package/dist/tsconfig.build.tsbuildinfo +1 -1
  41. package/package.json +2 -1
  42. package/src/app.module.ts +2 -0
  43. package/src/constant/global.constant.ts +2 -0
  44. package/src/module/ics/controller/ics.controller.ts +21 -0
  45. package/src/module/ics/dto/ics.dto.ts +55 -0
  46. package/src/module/ics/ics.module.ts +13 -0
  47. package/src/module/ics/service/ics.service.ts +48 -0
  48. package/src/module/meta/controller/entity-dynamic.controller.ts +94 -78
  49. package/src/module/meta/controller/entity-relation.controller.ts +31 -0
  50. package/src/module/meta/entity/entity-relation-data.entity.ts +29 -0
  51. package/src/module/meta/entity/entity-relation.entity.ts +29 -0
  52. package/src/module/meta/entity.module.ts +17 -4
  53. package/src/module/meta/service/entity-dynamic.service.ts +417 -21
  54. package/src/module/meta/service/entity-realation-data.service.ts +9 -0
  55. package/src/module/meta/service/entity-relation.service.ts +22 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "2.2.109",
3
+ "version": "2.2.111",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -43,6 +43,7 @@
43
43
  "dotenv": "^16.4.7",
44
44
  "exceljs": "^4.4.0",
45
45
  "handlebars": "^4.7.8",
46
+ "ics": "^3.8.1",
46
47
  "moment": "^2.30.1",
47
48
  "moment-timezone": "^0.6.0",
48
49
  "multer": "^1.4.5-lts.2",
package/src/app.module.ts CHANGED
@@ -14,6 +14,7 @@ import { FilterModule } from './module/filter/filter.module';
14
14
  import { LeadModule } from './module/lead/lead.module';
15
15
  import { LayoutPreferenceModule } from './module/layout_preference/layout_preference.module';
16
16
  import { WorkflowModule } from './module/workflow/workflow.module';
17
+ import { IcsMeetingModule } from './module/ics/ics.module';
17
18
 
18
19
  @Module({
19
20
  imports: [
@@ -32,6 +33,7 @@ import { WorkflowModule } from './module/workflow/workflow.module';
32
33
  LeadModule,
33
34
  LayoutPreferenceModule,
34
35
  WorkflowModule,
36
+ IcsMeetingModule,
35
37
  ],
36
38
  })
37
39
  export class AppModule {}
@@ -14,6 +14,8 @@ export const ENTITYTYPE_FIELDMASTER = 'FLD';
14
14
  export const ENTITYTYPE_USRROLMAP = 'URM';
15
15
  export const ENTITYTYPE_SAVEDFILTERMASTER = 'SFM';
16
16
  export const ENTITYTYPE_SAVEDFILTERDETAIL = 'SFD';
17
+ export const ENTITYTYPE_ENTITY_RELATION = 'ENR';
18
+ export const ENTITYTYPE_ENTITY_RELATION_DATA = 'ERD';
17
19
 
18
20
  export const STORAGETYPE_SINGLEJSON = 'singlejson';
19
21
  export const STORAGETYPE_COLUMN = 'column';
@@ -0,0 +1,21 @@
1
+ // src/calendar/calendar.controller.ts
2
+ import { Body, Controller, Post, Res, UseGuards } from '@nestjs/common';
3
+ import { Response } from 'express';
4
+ import { IcsMeetingService } from '../service/ics.service';
5
+ import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
6
+ import { CreateInviteDto } from '../dto/ics.dto';
7
+
8
+ @Controller('/ics')
9
+ export class IcsMeetingController {
10
+ constructor(private readonly calendarService: IcsMeetingService) {}
11
+
12
+ // Download ICS file
13
+ @Post('/create')
14
+ @UseGuards(JwtAuthGuard)
15
+ async getIcs(@Body() dto: CreateInviteDto, @Res() res: Response) {
16
+ const ics = await this.calendarService.generateIcs(dto);
17
+ res.setHeader('Content-Type', 'text/calendar; charset=utf-8');
18
+ res.setHeader('Content-Disposition', 'attachment; filename="invite.ics"');
19
+ return res.send(ics);
20
+ }
21
+ }
@@ -0,0 +1,55 @@
1
+ // src/calendar/dto/create-invite.dto.ts
2
+ import {
3
+ IsArray,
4
+ IsEmail,
5
+ IsISO8601,
6
+ IsOptional,
7
+ IsString,
8
+ IsInt,
9
+ MinLength,
10
+ ValidateNested,
11
+ } from 'class-validator';
12
+ import { Type } from 'class-transformer';
13
+ import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
14
+
15
+ class IcsMeetingDto extends BaseEntity {
16
+ @IsString() name: string;
17
+ @IsEmail() email: string;
18
+ }
19
+
20
+ export class CreateInviteDto {
21
+ @IsString()
22
+ @MinLength(3)
23
+ title: string;
24
+
25
+ @IsString()
26
+ @IsOptional()
27
+ description?: string;
28
+
29
+ @IsISO8601()
30
+ startsAt: string; // ISO string e.g. "2025-08-30T10:00:00+05:30"
31
+
32
+ @IsInt()
33
+ durationMinutes: number;
34
+
35
+ @IsString()
36
+ @IsOptional()
37
+ meetingUrl?: string;
38
+
39
+ @IsString()
40
+ @IsOptional()
41
+ location?: string;
42
+
43
+ @IsString()
44
+ @IsOptional()
45
+ organizerName?: string;
46
+
47
+ @IsEmail()
48
+ @IsOptional()
49
+ organizerEmail?: string;
50
+
51
+ @IsArray()
52
+ @ValidateNested({ each: true })
53
+ @Type(() => IcsMeetingDto)
54
+ attendees: IcsMeetingDto[];
55
+ }
@@ -0,0 +1,13 @@
1
+ import { Module } from '@nestjs/common';
2
+ import { TypeOrmModule } from '@nestjs/typeorm';
3
+ import { IcsMeetingService } from './service/ics.service';
4
+ import { IcsMeetingController } from './controller/ics.controller';
5
+ import { CreateInviteDto } from './dto/ics.dto';
6
+
7
+ @Module({
8
+ imports: [TypeOrmModule.forFeature([CreateInviteDto])],
9
+ controllers: [IcsMeetingController],
10
+ providers: [IcsMeetingService],
11
+ exports: [IcsMeetingService],
12
+ })
13
+ export class IcsMeetingModule {}
@@ -0,0 +1,48 @@
1
+ // src/calendar/calendar.service.ts
2
+ import { Injectable } from '@nestjs/common';
3
+ import { createEvent } from 'ics';
4
+ import { CreateInviteDto } from '../dto/ics.dto';
5
+
6
+ @Injectable()
7
+ export class IcsMeetingService {
8
+ private toDateParts(iso: string): number[] {
9
+ const d = new Date(iso);
10
+ return [
11
+ d.getUTCFullYear(),
12
+ d.getUTCMonth() + 1,
13
+ d.getUTCDate(),
14
+ d.getUTCHours(),
15
+ d.getUTCMinutes(),
16
+ ];
17
+ }
18
+
19
+ async generateIcs(dto: CreateInviteDto): Promise<string> {
20
+ const startParts = this.toDateParts(dto.startsAt);
21
+
22
+ const event: any = {
23
+ start: startParts,
24
+ duration: {
25
+ hours: Math.floor(dto.durationMinutes / 60),
26
+ minutes: dto.durationMinutes % 60,
27
+ },
28
+ title: dto.title,
29
+ description: dto.description ?? '',
30
+ location: dto.location ?? 'Online',
31
+ url: dto.meetingUrl,
32
+ organizer: dto.organizerEmail
33
+ ? { name: dto.organizerName ?? 'Organizer', email: dto.organizerEmail }
34
+ : undefined,
35
+ attendees: dto.attendees?.map((a) => ({ name: a.name, email: a.email })),
36
+ status: 'CONFIRMED' as const,
37
+ };
38
+
39
+ return new Promise((resolve, reject) => {
40
+ createEvent(event, (err, value) => {
41
+ if (err) reject(err);
42
+
43
+ const base64 = Buffer.from(value, 'utf-8').toString('base64');
44
+ resolve(base64);
45
+ });
46
+ });
47
+ }
48
+ }
@@ -1,83 +1,99 @@
1
1
  import {
2
- Body,
3
- Controller,
4
- Get,
5
- Param,
6
- Post,
7
- Query,
8
- Req,
9
- BadRequestException,
10
- NotFoundException,
11
- HttpCode,
12
- HttpStatus,
13
- UseGuards,
14
- } from '@nestjs/common';
15
- import { Request } from 'express';
16
- import { EntityDynamicService } from '../service/entity-dynamic.service';
17
- import { JwtAuthGuard } from '../../auth/guards/jwt.guard';
18
-
19
- @UseGuards(JwtAuthGuard)
20
- @Controller('dynamic-entity')
21
- export class EntityDynamicController {
22
- constructor(private readonly entityDynamicService: EntityDynamicService) {}
23
-
24
- @Post('create')
25
- @HttpCode(HttpStatus.OK)
26
- async createEntity(
27
- @Body() data: Record<string, any>,
28
- @Query('entity_type') entityType: string,
29
- @Req() req: Request & { user: any },
30
- ) {
31
- const loggedInUser = req.user.userData;
32
-
33
- if (!entityType) {
34
- throw new BadRequestException(`Query param "entity_type" is required`);
35
- }
36
-
37
- return await this.entityDynamicService.createEntity(entityType, data, loggedInUser);
2
+ Body,
3
+ Controller,
4
+ Get,
5
+ Param,
6
+ Post,
7
+ Query,
8
+ Req,
9
+ BadRequestException,
10
+ NotFoundException,
11
+ HttpCode,
12
+ HttpStatus,
13
+ UseGuards,
14
+ } from '@nestjs/common';
15
+ import { Request } from 'express';
16
+ import { EntityDynamicService } from '../service/entity-dynamic.service';
17
+ import { JwtAuthGuard } from '../../auth/guards/jwt.guard';
18
+
19
+ @UseGuards(JwtAuthGuard)
20
+ @Controller('dynamic-entity')
21
+ export class EntityDynamicController {
22
+ constructor(private readonly entityDynamicService: EntityDynamicService) {}
23
+
24
+ @Post('create')
25
+ @HttpCode(HttpStatus.OK)
26
+ async createEntity(
27
+ @Body() data: Record<string, any>,
28
+ @Query('entity_type') entityType: string,
29
+ @Req() req: Request & { user: any },
30
+ ) {
31
+ const loggedInUser = req.user.userData;
32
+
33
+ if (!entityType) {
34
+ throw new BadRequestException(`Query param "entity_type" is required`);
38
35
  }
39
-
40
- @Post('update/:id')
41
- @HttpCode(HttpStatus.OK)
42
- async updateEntity(
43
- @Param('id') id: number,
44
- @Body() data: Record<string, any>,
45
- @Query('entity_type') entityType: string,
46
- @Req() req: Request & { user: any },
47
- ) {
48
- const loggedInUser = req.user.userData;
49
-
50
- if (!entityType) {
51
- throw new BadRequestException(`Query param "entity_type" is required`);
52
- }
53
-
54
- const existingEntity = await this.entityDynamicService.getEntity(entityType, id, loggedInUser);
55
- if (!existingEntity) {
56
- throw new NotFoundException(`No entity found for id "${id}"`);
57
- }
58
-
59
- return await this.entityDynamicService.updateEntity(entityType, id, data, loggedInUser);
36
+
37
+ return await this.entityDynamicService.createEntityWithRelation(
38
+ entityType,
39
+ data,
40
+ loggedInUser,
41
+ );
42
+ }
43
+
44
+ @Post('update/:id')
45
+ @HttpCode(HttpStatus.OK)
46
+ async updateEntity(
47
+ @Param('id') id: number,
48
+ @Body() data: Record<string, any>,
49
+ @Query('entity_type') entityType: string,
50
+ @Req() req: Request & { user: any },
51
+ ) {
52
+ const loggedInUser = req.user.userData;
53
+
54
+ if (!entityType) {
55
+ throw new BadRequestException(`Query param "entity_type" is required`);
56
+ }
57
+
58
+ const existingEntity = await this.entityDynamicService.getEntity(
59
+ entityType,
60
+ id,
61
+ loggedInUser,
62
+ );
63
+ if (!existingEntity) {
64
+ throw new NotFoundException(`No entity found for id "${id}"`);
65
+ }
66
+
67
+ return await this.entityDynamicService.updateEntityWithRelations(
68
+ entityType,
69
+ id,
70
+ data,
71
+ loggedInUser,
72
+ );
73
+ }
74
+
75
+ @Get('get/:id')
76
+ @HttpCode(HttpStatus.OK)
77
+ async getEntity(
78
+ @Param('id') id: number,
79
+ @Query('entity_type') entityType: string,
80
+ @Req() req: Request & { user: any },
81
+ ) {
82
+ const loggedInUser = req.user.userData;
83
+
84
+ if (!entityType) {
85
+ throw new BadRequestException(`Query param "entity_type" is required`);
60
86
  }
61
-
62
- @Get('get/:id')
63
- @HttpCode(HttpStatus.OK)
64
- async getEntity(
65
- @Param('id') id: number,
66
- @Query('entity_type') entityType: string,
67
- @Req() req: Request & { user: any },
68
- ) {
69
- const loggedInUser = req.user.userData;
70
-
71
- if (!entityType) {
72
- throw new BadRequestException(`Query param "entity_type" is required`);
73
- }
74
-
75
- const entity = await this.entityDynamicService.getEntity(entityType, id, loggedInUser);
76
- if (!entity) {
77
- throw new NotFoundException(`No entity found for id "${id}"`);
78
- }
79
-
80
- return entity;
87
+
88
+ const entity = await this.entityDynamicService.getEntityWithRelation(
89
+ entityType,
90
+ id,
91
+ loggedInUser,
92
+ );
93
+ if (!entity) {
94
+ throw new NotFoundException(`No entity found for id "${id}"`);
81
95
  }
96
+
97
+ return entity;
82
98
  }
83
-
99
+ }
@@ -0,0 +1,31 @@
1
+ import {
2
+ Controller,
3
+ Get,
4
+ Inject,
5
+ Param,
6
+ Request,
7
+ UseGuards,
8
+ } from '@nestjs/common';
9
+ import { JwtAuthGuard } from '../../auth/guards/jwt.guard';
10
+ import { EntityRelationService } from '../service/entity-relation.service';
11
+
12
+ @UseGuards(JwtAuthGuard)
13
+ @Controller('entity-relation')
14
+ export class EntityRelationController {
15
+ constructor(
16
+ @Inject('EntityRelationService')
17
+ private readonly entityRelationService: EntityRelationService,
18
+ ) {}
19
+
20
+ @Get(':source_entity_type')
21
+ async getEntityRelations(
22
+ @Param('source_entity_type') sourceEntityType: string,
23
+ @Request() req: any,
24
+ ): Promise<any> {
25
+ const loggedInUser = req.user.userData;
26
+ return this.entityRelationService.getEntityRelations(
27
+ sourceEntityType,
28
+ loggedInUser,
29
+ );
30
+ }
31
+ }
@@ -0,0 +1,29 @@
1
+ import { ENTITYTYPE_ENTITY_RELATION_DATA } from 'src/constant/global.constant';
2
+ import { Column, Entity } from 'typeorm';
3
+ import { BaseEntity } from './base-entity.entity';
4
+
5
+ @Entity({ name: 'cr_entity_relation_data' })
6
+ export class EntityRelationData extends BaseEntity {
7
+ constructor() {
8
+ super();
9
+ this.entity_type = ENTITYTYPE_ENTITY_RELATION_DATA;
10
+ }
11
+
12
+ @Column({ nullable: true })
13
+ source_entity_type: string;
14
+
15
+ @Column({ nullable: true })
16
+ source_entity_id: number;
17
+
18
+ @Column({ nullable: true })
19
+ target_entity_type: string;
20
+
21
+ @Column({ nullable: true })
22
+ target_entity_id: number;
23
+
24
+ @Column({ nullable: true })
25
+ relation_type: string;
26
+
27
+ @Column({ nullable: true })
28
+ relation_id: number;
29
+ }
@@ -0,0 +1,29 @@
1
+ import { ENTITYTYPE_ENTITY_RELATION } from 'src/constant/global.constant';
2
+ import { Column, Entity } from 'typeorm';
3
+ import { BaseEntity } from './base-entity.entity';
4
+
5
+ @Entity({ name: 'cr_entity_relation' })
6
+ export class EntityRelation extends BaseEntity {
7
+ constructor() {
8
+ super();
9
+ this.entity_type = ENTITYTYPE_ENTITY_RELATION;
10
+ }
11
+
12
+ @Column({ nullable: true })
13
+ source_entity_type: string;
14
+
15
+ @Column({ nullable: true })
16
+ source_entity_id: number;
17
+
18
+ @Column({ nullable: true })
19
+ target_entity_type: string;
20
+
21
+ @Column({ nullable: true })
22
+ target_entity_id: number;
23
+
24
+ @Column({ nullable: true })
25
+ relation_type: string;
26
+
27
+ @Column({ nullable: true })
28
+ relation_id: number;
29
+ }
@@ -50,6 +50,11 @@ import { AttributeMasterController } from './controller/attribute-master.control
50
50
  import { EntityDynamicController } from './controller/entity-dynamic.controller';
51
51
  import { EntityDynamicService } from './service/entity-dynamic.service';
52
52
  import { ResolverService } from './service/resolver.service';
53
+ import { EntityRelation } from './entity/entity-relation.entity';
54
+ import { EntityRelationData } from './entity/entity-relation-data.entity';
55
+ import { EntityRelationService } from './service/entity-relation.service';
56
+ import { EntityRelationDataService } from './service/entity-realation-data.service';
57
+ import { EntityRelationController } from './controller/entity-relation.controller';
53
58
 
54
59
  @Module({
55
60
  imports: [
@@ -62,8 +67,9 @@ import { ResolverService } from './service/resolver.service';
62
67
  MediaData,
63
68
  ViewMaster,
64
69
  UserRoleMapping,
65
- AppMaster
66
-
70
+ AppMaster,
71
+ EntityRelation,
72
+ EntityRelationData,
67
73
  ]),
68
74
  forwardRef(() => ListMasterModule),
69
75
  forwardRef(() => FilterModule),
@@ -91,12 +97,18 @@ import { ResolverService } from './service/resolver.service';
91
97
  ViewMaterRespository,
92
98
  EntityValidationService,
93
99
  { provide: 'ViewMasterService', useClass: ViewMasterService },
100
+ { provide: 'EntityRelationService', useClass: EntityRelationService },
101
+ {
102
+ provide: 'EntityRelationDataService',
103
+ useClass: EntityRelationDataService,
104
+ },
105
+
94
106
  // UserAppMappingService,
95
107
  // UserAppMappingRepository,
96
108
  UserRoleMappingRepository,
97
109
  AppMasterRespository,
98
110
  AppMasterService,
99
- ResolverService
111
+ ResolverService,
100
112
  ],
101
113
  exports: [
102
114
  EntityMasterService,
@@ -116,7 +128,7 @@ import { ResolverService } from './service/resolver.service';
116
128
  // UserAppMappingRepository,
117
129
  AppMasterService,
118
130
  MasterService,
119
- ResolverService
131
+ ResolverService,
120
132
  ],
121
133
  controllers: [
122
134
  EntityController,
@@ -127,6 +139,7 @@ ResolverService
127
139
  AppMasterController,
128
140
  AttributeMasterController,
129
141
  EntityDynamicController,
142
+ EntityRelationController,
130
143
  ],
131
144
  })
132
145
  export class EntityModule {}