rez_core 2.2.49 → 2.2.52
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/dist/module/meta/controller/view-master.controller.d.ts +3 -0
- package/dist/module/meta/controller/view-master.controller.js +24 -1
- package/dist/module/meta/controller/view-master.controller.js.map +1 -1
- package/dist/module/meta/repository/view-master.repository.d.ts +4 -0
- package/dist/module/meta/repository/view-master.repository.js +12 -0
- package/dist/module/meta/repository/view-master.repository.js.map +1 -1
- package/dist/module/meta/service/view-master.service.d.ts +4 -0
- package/dist/module/meta/service/view-master.service.js +3 -0
- package/dist/module/meta/service/view-master.service.js.map +1 -1
- package/dist/module/notification/controller/otp.controller.d.ts +4 -0
- package/dist/module/notification/controller/otp.controller.js +7 -5
- package/dist/module/notification/controller/otp.controller.js.map +1 -1
- package/dist/module/notification/notification.module.js +2 -0
- package/dist/module/notification/notification.module.js.map +1 -1
- package/dist/module/notification/service/otp.service.d.ts +9 -2
- package/dist/module/notification/service/otp.service.js +36 -7
- package/dist/module/notification/service/otp.service.js.map +1 -1
- package/dist/module/workflow/controller/activity-log.controller.d.ts +8 -0
- package/dist/module/workflow/controller/activity-log.controller.js +45 -0
- package/dist/module/workflow/controller/activity-log.controller.js.map +1 -0
- package/dist/module/workflow/controller/form-master.controller.d.ts +3 -0
- package/dist/module/workflow/controller/form-master.controller.js +14 -0
- package/dist/module/workflow/controller/form-master.controller.js.map +1 -1
- package/dist/module/workflow/entity/action-resources-mapping.entity.d.ts +1 -0
- package/dist/module/workflow/entity/action-resources-mapping.entity.js +4 -0
- package/dist/module/workflow/entity/action-resources-mapping.entity.js.map +1 -1
- package/dist/module/workflow/entity/activity-log.entity.d.ts +19 -0
- package/dist/module/workflow/entity/activity-log.entity.js +86 -0
- package/dist/module/workflow/entity/activity-log.entity.js.map +1 -0
- package/dist/module/workflow/entity/form.entity.d.ts +9 -0
- package/dist/module/workflow/entity/form.entity.js +46 -0
- package/dist/module/workflow/entity/form.entity.js.map +1 -0
- package/dist/module/workflow/repository/action-data.repository.d.ts +3 -1
- package/dist/module/workflow/repository/action-data.repository.js +17 -2
- package/dist/module/workflow/repository/action-data.repository.js.map +1 -1
- package/dist/module/workflow/repository/activity-log.repository.d.ts +7 -0
- package/dist/module/workflow/repository/activity-log.repository.js +38 -0
- package/dist/module/workflow/repository/activity-log.repository.js.map +1 -0
- package/dist/module/workflow/repository/form-master.repository.d.ts +4 -1
- package/dist/module/workflow/repository/form-master.repository.js +18 -2
- package/dist/module/workflow/repository/form-master.repository.js.map +1 -1
- package/dist/module/workflow/repository/form.repository.d.ts +0 -0
- package/dist/module/workflow/repository/form.repository.js +1 -0
- package/dist/module/workflow/repository/form.repository.js.map +1 -0
- package/dist/module/workflow/repository/stage-movement.repository.js +3 -1
- package/dist/module/workflow/repository/stage-movement.repository.js.map +1 -1
- package/dist/module/workflow/service/action.service.js +1 -0
- package/dist/module/workflow/service/action.service.js.map +1 -1
- package/dist/module/workflow/service/activity-log.service.d.ts +9 -0
- package/dist/module/workflow/service/activity-log.service.js +30 -0
- package/dist/module/workflow/service/activity-log.service.js.map +1 -0
- package/dist/module/workflow/service/form-master.service.d.ts +1 -0
- package/dist/module/workflow/service/form-master.service.js +8 -0
- package/dist/module/workflow/service/form-master.service.js.map +1 -1
- package/dist/module/workflow/workflow.module.js +16 -0
- package/dist/module/workflow/workflow.module.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/meta/controller/view-master.controller.ts +69 -41
- package/src/module/meta/repository/view-master.repository.ts +15 -1
- package/src/module/meta/service/view-master.service.ts +7 -0
- package/src/module/notification/controller/otp.controller.ts +7 -6
- package/src/module/notification/notification.module.ts +3 -1
- package/src/module/notification/service/otp.service.ts +57 -11
- package/src/module/workflow/controller/activity-log.controller.ts +35 -0
- package/src/module/workflow/controller/form-master.controller.ts +8 -0
- package/src/module/workflow/entity/action-resources-mapping.entity.ts +3 -0
- package/src/module/workflow/entity/activity-log.entity.ts +55 -0
- package/src/module/workflow/entity/form.entity.ts +25 -0
- package/src/module/workflow/repository/action-data.repository.ts +18 -1
- package/src/module/workflow/repository/activity-log.repository.ts +20 -0
- package/src/module/workflow/repository/form-master.repository.ts +19 -0
- package/src/module/workflow/repository/form.repository.ts +0 -0
- package/src/module/workflow/repository/stage-movement.repository.ts +3 -1
- package/src/module/workflow/service/action.service.ts +1 -0
- package/src/module/workflow/service/activity-log.service.ts +24 -0
- package/src/module/workflow/service/form-master.service.ts +10 -0
- package/src/module/workflow/workflow.module.ts +17 -0
package/package.json
CHANGED
|
@@ -1,48 +1,76 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
Controller,
|
|
3
|
+
Get,
|
|
4
|
+
Query,
|
|
5
|
+
Res,
|
|
6
|
+
HttpStatus,
|
|
7
|
+
UseGuards,
|
|
8
|
+
Inject,
|
|
9
|
+
Req,
|
|
10
|
+
} from '@nestjs/common';
|
|
11
|
+
import { JwtAuthGuard } from '../../auth/guards/jwt.guard';
|
|
12
|
+
import { Response } from 'express';
|
|
12
13
|
import { ViewMasterService } from '../service/view-master.service';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const result = await this.viewMaster.getEntityJson(entityType, type);
|
|
34
|
-
|
|
35
|
-
return res.status(HttpStatus.OK).json({
|
|
36
|
-
success: true,
|
|
37
|
-
message: 'Entity data fetched successfully',
|
|
38
|
-
data: result,
|
|
39
|
-
});
|
|
40
|
-
} catch (error) {
|
|
41
|
-
return res.status(HttpStatus.INTERNAL_SERVER_ERROR).json({
|
|
14
|
+
|
|
15
|
+
@Controller('entity')
|
|
16
|
+
@UseGuards(JwtAuthGuard)
|
|
17
|
+
export class ViewMasterController {
|
|
18
|
+
constructor(
|
|
19
|
+
@Inject('ViewMasterService') private readonly viewMaster: ViewMasterService,
|
|
20
|
+
) {}
|
|
21
|
+
|
|
22
|
+
@Get('viewMaster')
|
|
23
|
+
async getEntityJsonByType(
|
|
24
|
+
@Query('entity_type') entityType: string,
|
|
25
|
+
@Query('type') type: string,
|
|
26
|
+
@Res() res: Response,
|
|
27
|
+
) {
|
|
28
|
+
try {
|
|
29
|
+
if (!entityType || !type) {
|
|
30
|
+
return res.status(HttpStatus.BAD_REQUEST).json({
|
|
42
31
|
success: false,
|
|
43
|
-
message:
|
|
32
|
+
message: 'Missing entity_type or type query parameter',
|
|
44
33
|
});
|
|
45
34
|
}
|
|
35
|
+
|
|
36
|
+
const result = await this.viewMaster.getEntityJson(entityType, type);
|
|
37
|
+
|
|
38
|
+
return res.status(HttpStatus.OK).json({
|
|
39
|
+
success: true,
|
|
40
|
+
message: 'Entity data fetched successfully',
|
|
41
|
+
data: result,
|
|
42
|
+
});
|
|
43
|
+
} catch (error) {
|
|
44
|
+
return res.status(HttpStatus.INTERNAL_SERVER_ERROR).json({
|
|
45
|
+
success: false,
|
|
46
|
+
message: error.message || 'Error fetching entity data',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@Get('view_master/dropdown')
|
|
52
|
+
async getDropdownData(
|
|
53
|
+
@Req() req: Request & { user: any },
|
|
54
|
+
@Query() query: Record<string, string>,
|
|
55
|
+
@Res() res: Response,
|
|
56
|
+
) {
|
|
57
|
+
const loggedInUser = req.user.userData;
|
|
58
|
+
|
|
59
|
+
const entityType = query.entity_type;
|
|
60
|
+
if (!entityType) {
|
|
61
|
+
return res.status(HttpStatus.BAD_REQUEST).json({
|
|
62
|
+
success: false,
|
|
63
|
+
message: 'Missing entity_type query parameter',
|
|
64
|
+
});
|
|
46
65
|
}
|
|
66
|
+
|
|
67
|
+
const result = await this.viewMaster.getViewMasterByEntityType(
|
|
68
|
+
entityType,
|
|
69
|
+
loggedInUser,
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
return res.status(HttpStatus.OK).json({
|
|
73
|
+
data: result,
|
|
74
|
+
});
|
|
47
75
|
}
|
|
48
|
-
|
|
76
|
+
}
|
|
@@ -18,7 +18,21 @@ export class ViewMaterRespository {
|
|
|
18
18
|
mapped_entity_type: entityType,
|
|
19
19
|
type: type,
|
|
20
20
|
});
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
return viewMaster;
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
async findByEntityType(entityType: string, organizationId: number) {
|
|
26
|
+
const viewMasters = await this.viewMasterRepository.find({
|
|
27
|
+
where: {
|
|
28
|
+
mapped_entity_type: entityType,
|
|
29
|
+
organization_id: organizationId,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return viewMasters.map((vm) => ({
|
|
34
|
+
label: vm.name,
|
|
35
|
+
value: vm.id,
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
24
38
|
}
|
|
@@ -73,4 +73,11 @@ export class ViewMasterService extends EntityServiceImpl {
|
|
|
73
73
|
) {
|
|
74
74
|
return await super.getEntityData(entityType, id, loggedInUserData);
|
|
75
75
|
}
|
|
76
|
+
|
|
77
|
+
async getViewMasterByEntityType(entityType: string, loggedInUser: UserData) {
|
|
78
|
+
return await this.viewMasterRepoService.findByEntityType(
|
|
79
|
+
entityType,
|
|
80
|
+
loggedInUser.organization_id,
|
|
81
|
+
);
|
|
82
|
+
}
|
|
76
83
|
}
|
|
@@ -44,14 +44,15 @@ export class OtpController {
|
|
|
44
44
|
@Post('verify')
|
|
45
45
|
@HttpCode(HttpStatus.OK)
|
|
46
46
|
async verifyOtp(@Body() request: any) {
|
|
47
|
-
let
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
let verify = await this.otpService.verifyOtp(otp, otpId);
|
|
51
|
-
if (!verify) {
|
|
47
|
+
let verify = await this.otpService.verifyOtp(request);
|
|
48
|
+
if (!verify.isValid) {
|
|
52
49
|
throw new BadRequestException('Invalid OTP!');
|
|
53
50
|
}
|
|
54
|
-
return {
|
|
51
|
+
return {
|
|
52
|
+
message: 'OTP verified successfully!',
|
|
53
|
+
success: true,
|
|
54
|
+
data: verify,
|
|
55
|
+
};
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
@Post('send-mail')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Module } from '@nestjs/common';
|
|
1
|
+
import { forwardRef, Module } from '@nestjs/common';
|
|
2
2
|
import { OtpService } from './service/otp.service';
|
|
3
3
|
import { OtpRepository } from './repository/otp.repository';
|
|
4
4
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
@@ -9,6 +9,7 @@ import { HandlebarsAdapter } from '@nestjs-modules/mailer/dist/adapters/handleba
|
|
|
9
9
|
import { EmailService } from './service/email.service';
|
|
10
10
|
import { join } from 'path';
|
|
11
11
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
12
|
+
import { AuthModule } from '../auth/auth.module';
|
|
12
13
|
|
|
13
14
|
@Module({
|
|
14
15
|
imports: [
|
|
@@ -38,6 +39,7 @@ import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
|
38
39
|
},
|
|
39
40
|
}),
|
|
40
41
|
}),
|
|
42
|
+
AuthModule,
|
|
41
43
|
],
|
|
42
44
|
providers: [OtpService, OtpRepository, EmailService],
|
|
43
45
|
exports: [OtpService, EmailService],
|
|
@@ -3,6 +3,8 @@ import { OtpRepository } from '../repository/otp.repository';
|
|
|
3
3
|
import { Otp } from '../entity/otp.entity';
|
|
4
4
|
import { ClockIDGenService } from '../../../utils/service/clockIDGenUtil.service';
|
|
5
5
|
import { ConfigService } from '@nestjs/config';
|
|
6
|
+
import { DataSource } from 'typeorm';
|
|
7
|
+
import { JwtAuthService } from 'src/module/auth/services/jwt.service';
|
|
6
8
|
|
|
7
9
|
@Injectable()
|
|
8
10
|
export class OtpService {
|
|
@@ -10,19 +12,28 @@ export class OtpService {
|
|
|
10
12
|
private readonly otpRepository: OtpRepository,
|
|
11
13
|
private readonly idGen: ClockIDGenService,
|
|
12
14
|
private configService: ConfigService,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
// @Inject('JwtAuthService')
|
|
16
|
+
private readonly jwtAuthService: JwtAuthService,
|
|
17
|
+
private databaseSource: DataSource,
|
|
18
|
+
) {}
|
|
19
|
+
|
|
16
20
|
VERIFY_OTP = this.configService.get('VERIFY_OTP') || 'true';
|
|
17
21
|
DEFAULT_OTP = this.configService.get('DEFAULT_OTP') || '123456';
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
async generate(
|
|
24
|
+
identifier: string,
|
|
25
|
+
service: string,
|
|
26
|
+
expiresIn: number = 5,
|
|
27
|
+
otpLength: number = 6,
|
|
28
|
+
) {
|
|
21
29
|
let otp = new Otp();
|
|
22
30
|
otp.created_date = new Date();
|
|
23
31
|
otp.otp_id = this.idGen.idGenerator();
|
|
24
32
|
otp.identifier = identifier;
|
|
25
|
-
otp.otp =
|
|
33
|
+
otp.otp =
|
|
34
|
+
'true' === this.VERIFY_OTP
|
|
35
|
+
? this.generateOtp(otpLength)
|
|
36
|
+
: this.DEFAULT_OTP;
|
|
26
37
|
otp.service = service;
|
|
27
38
|
otp.verified = 0;
|
|
28
39
|
otp.expiration_date = new Date(Date.now() + expiresIn * 60 * 1000);
|
|
@@ -30,18 +41,53 @@ export class OtpService {
|
|
|
30
41
|
return await this.otpRepository.save(otp);
|
|
31
42
|
}
|
|
32
43
|
|
|
33
|
-
async verifyOtp(
|
|
44
|
+
async verifyOtp(request) {
|
|
45
|
+
let verifyOTPResponse = { isValid: false, access_token: '' };
|
|
46
|
+
|
|
47
|
+
let otp = request.otp;
|
|
48
|
+
let otpId = request.otp_id;
|
|
49
|
+
|
|
34
50
|
let otpEntity = await this.findByOtpId(otpId);
|
|
51
|
+
|
|
35
52
|
if (otpEntity) {
|
|
36
|
-
if (
|
|
53
|
+
if (
|
|
54
|
+
otpEntity.otp === otp &&
|
|
55
|
+
new Date(Date.now()) <= otpEntity.expiration_date &&
|
|
56
|
+
0 === otpEntity.verified
|
|
57
|
+
) {
|
|
37
58
|
otpEntity.verified = 1;
|
|
38
|
-
const updatedOtp = await this.otpRepository.update(
|
|
59
|
+
const updatedOtp = await this.otpRepository.update(
|
|
60
|
+
otpEntity.id,
|
|
61
|
+
otpEntity,
|
|
62
|
+
);
|
|
39
63
|
if (updatedOtp) {
|
|
40
|
-
|
|
64
|
+
verifyOTPResponse.isValid = true;
|
|
41
65
|
}
|
|
42
66
|
}
|
|
43
67
|
}
|
|
44
|
-
|
|
68
|
+
|
|
69
|
+
if (verifyOTPResponse.isValid && request.entity) {
|
|
70
|
+
const entity_type = request.entity.entity_type;
|
|
71
|
+
const entity_id = request.entity.entity_id;
|
|
72
|
+
|
|
73
|
+
const entityData = await this.databaseSource.query(
|
|
74
|
+
`SELECT level_id, level_type, organization_id FROM ether_core.crm_lead where id = ${entity_id}`,
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
if (entityData.length > 0) {
|
|
78
|
+
const level_id = entityData[0].level_id;
|
|
79
|
+
const level_type = entityData[0].level_type;
|
|
80
|
+
const organization_id = entityData[0].organization_id;
|
|
81
|
+
|
|
82
|
+
verifyOTPResponse.access_token = await this.jwtAuthService.generateJwt({
|
|
83
|
+
level_id: level_id,
|
|
84
|
+
level_type: level_type,
|
|
85
|
+
organization_id: organization_id,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return verifyOTPResponse;
|
|
45
91
|
}
|
|
46
92
|
|
|
47
93
|
async findByOtpId(otpId: string) {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Body,
|
|
3
|
+
Controller,
|
|
4
|
+
HttpCode,
|
|
5
|
+
HttpStatus,
|
|
6
|
+
Inject,
|
|
7
|
+
Post,
|
|
8
|
+
Req,
|
|
9
|
+
UseGuards,
|
|
10
|
+
} from '@nestjs/common';
|
|
11
|
+
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
12
|
+
import { ActivityLogService } from '../service/activity-log.service';
|
|
13
|
+
import { Http } from 'winston/lib/winston/transports';
|
|
14
|
+
|
|
15
|
+
@Controller('/activity-log')
|
|
16
|
+
@UseGuards(JwtAuthGuard)
|
|
17
|
+
export class ActivityLogController {
|
|
18
|
+
constructor(
|
|
19
|
+
@Inject('ActivityLogService')
|
|
20
|
+
private readonly activityLogService: ActivityLogService,
|
|
21
|
+
) {}
|
|
22
|
+
@Post('/get-all-activity-log')
|
|
23
|
+
@HttpCode(HttpStatus.OK)
|
|
24
|
+
async getAllActivityLog(
|
|
25
|
+
@Req() req: Request & { user: any },
|
|
26
|
+
@Body('entity_type') mapped_entity_type: string,
|
|
27
|
+
) {
|
|
28
|
+
const loggedInUser = req.user.userData;
|
|
29
|
+
const result = this.activityLogService.getAllActivityLog(
|
|
30
|
+
mapped_entity_type,
|
|
31
|
+
loggedInUser,
|
|
32
|
+
);
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -32,4 +32,12 @@ export class FormMasterController {
|
|
|
32
32
|
);
|
|
33
33
|
return result;
|
|
34
34
|
}
|
|
35
|
+
|
|
36
|
+
@Post('/submit')
|
|
37
|
+
@HttpCode(HttpStatus.OK)
|
|
38
|
+
async submitForm(@Req() req: Request & { user: any }, @Body() body: any) {
|
|
39
|
+
const loggedInUser = req.user.userData;
|
|
40
|
+
const result = this.formMasterService.submitForm(body);
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
35
43
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
|
|
2
|
+
import { Column, Entity } from 'typeorm';
|
|
3
|
+
|
|
4
|
+
@Entity({ name: 'eth_activity_log' })
|
|
5
|
+
export class ActivityLog extends BaseEntity {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.entity_type = 'ACLG';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@Column({ type: 'varchar', nullable: true })
|
|
12
|
+
running_id: string;
|
|
13
|
+
|
|
14
|
+
@Column({ type: 'varchar', nullable: true })
|
|
15
|
+
mapped_entity_type: string;
|
|
16
|
+
|
|
17
|
+
@Column({ type: 'varchar', nullable: true })
|
|
18
|
+
mapped_entity_id: string;
|
|
19
|
+
|
|
20
|
+
@Column({ type: 'varchar', nullable: true })
|
|
21
|
+
title: string;
|
|
22
|
+
|
|
23
|
+
@Column({ type: 'varchar', nullable: true })
|
|
24
|
+
description: string;
|
|
25
|
+
|
|
26
|
+
@Column({ type: 'varchar', nullable: true })
|
|
27
|
+
user_id: string;
|
|
28
|
+
|
|
29
|
+
@Column({ type: 'varchar', nullable: true })
|
|
30
|
+
level_type: string;
|
|
31
|
+
|
|
32
|
+
@Column({ type: 'varchar', nullable: true })
|
|
33
|
+
level_id: string;
|
|
34
|
+
|
|
35
|
+
@Column({ type: 'varchar', nullable: true })
|
|
36
|
+
category: string;
|
|
37
|
+
|
|
38
|
+
@Column({ type: 'varchar', nullable: true })
|
|
39
|
+
action: string;
|
|
40
|
+
|
|
41
|
+
@Column({ type: 'varchar', nullable: true })
|
|
42
|
+
action_icon: string;
|
|
43
|
+
|
|
44
|
+
@Column({ type: 'varchar', nullable: true })
|
|
45
|
+
action_category_color: string;
|
|
46
|
+
|
|
47
|
+
@Column({ type: 'varchar', nullable: true })
|
|
48
|
+
additional_info_1: string;
|
|
49
|
+
|
|
50
|
+
@Column({ type: 'varchar', nullable: true })
|
|
51
|
+
additional_info_2: string;
|
|
52
|
+
|
|
53
|
+
@Column({ type: 'varchar', nullable: true })
|
|
54
|
+
additional_info_3: string;
|
|
55
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
|
|
2
|
+
import { Column, Entity } from 'typeorm';
|
|
3
|
+
|
|
4
|
+
@Entity({ name: 'cr_wf_form' })
|
|
5
|
+
export class FormDataEntity extends BaseEntity {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.entity_type = 'FORM';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@Column({ nullable: true })
|
|
12
|
+
mapped_entity_id: number;
|
|
13
|
+
|
|
14
|
+
@Column({ nullable: true })
|
|
15
|
+
mapped_entity_type: string;
|
|
16
|
+
|
|
17
|
+
@Column({ nullable: true })
|
|
18
|
+
view_id: number;
|
|
19
|
+
|
|
20
|
+
@Column({ nullable: true })
|
|
21
|
+
entity_id: number;
|
|
22
|
+
|
|
23
|
+
@Column({ nullable: true })
|
|
24
|
+
action_id: number;
|
|
25
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
2
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
3
|
import { ActionDataEntity } from '../entity/action-data.entity';
|
|
4
4
|
import { DataSource, Repository } from 'typeorm';
|
|
5
5
|
import { UserData } from 'src/module/user/entity/user.entity';
|
|
6
|
+
import { FormDataEntity } from '../entity/form.entity';
|
|
6
7
|
|
|
7
8
|
@Injectable()
|
|
8
9
|
export class ActionDataRepository {
|
|
@@ -10,6 +11,8 @@ export class ActionDataRepository {
|
|
|
10
11
|
@InjectRepository(ActionDataEntity)
|
|
11
12
|
private readonly actionDataRepo: Repository<ActionDataEntity>,
|
|
12
13
|
private readonly dataSource: DataSource,
|
|
14
|
+
@InjectRepository(FormDataEntity)
|
|
15
|
+
private readonly formRepo: Repository<FormDataEntity>,
|
|
13
16
|
) {}
|
|
14
17
|
|
|
15
18
|
async saveActionData(
|
|
@@ -43,6 +46,20 @@ export class ActionDataRepository {
|
|
|
43
46
|
category: act?.action_category_code,
|
|
44
47
|
} as ActionDataEntity);
|
|
45
48
|
await this.actionDataRepo.save(actionData);
|
|
49
|
+
|
|
50
|
+
// SEND FORM related logic
|
|
51
|
+
// if the action_category_code is 'SDFM', create a entry in cr_wf_form table
|
|
52
|
+
if (act?.action_category_code === 'SDFM') {
|
|
53
|
+
this.formRepo.insert({
|
|
54
|
+
mapped_entity_type,
|
|
55
|
+
mapped_entity_id,
|
|
56
|
+
entity_type: mapped_entity_type,
|
|
57
|
+
entity_id: mapped_entity_id,
|
|
58
|
+
view_id: act.form_id,
|
|
59
|
+
status: 'N',
|
|
60
|
+
action_id: act.id,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
46
63
|
}
|
|
47
64
|
}
|
|
48
65
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { InjectRepository } from '@nestjs/typeorm';
|
|
2
|
+
import { ActivityLog } from '../entity/activity-log.entity';
|
|
3
|
+
import { Repository } from 'typeorm';
|
|
4
|
+
|
|
5
|
+
export class ActivityLogRepository {
|
|
6
|
+
constructor(
|
|
7
|
+
@InjectRepository(ActivityLog)
|
|
8
|
+
private readonly activityLogRepository: Repository<ActivityLog>,
|
|
9
|
+
) {}
|
|
10
|
+
|
|
11
|
+
async getAllActivityLog(mapped_entity_type: string, loggedInUser) {
|
|
12
|
+
const { organization_id } = loggedInUser;
|
|
13
|
+
return this.activityLogRepository.find({
|
|
14
|
+
where: {
|
|
15
|
+
mapped_entity_type: mapped_entity_type,
|
|
16
|
+
organization_id: organization_id,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
8
8
|
import { DataSource, Repository } from 'typeorm';
|
|
9
9
|
import { FormMasterDataEntity } from '../entity/form-master.entity';
|
|
10
|
+
import { FormDataEntity } from '../entity/form.entity';
|
|
10
11
|
|
|
11
12
|
@Injectable()
|
|
12
13
|
export class FormMasterRepository {
|
|
@@ -14,6 +15,8 @@ export class FormMasterRepository {
|
|
|
14
15
|
@InjectRepository(FormMasterDataEntity)
|
|
15
16
|
private readonly formMasterRepository: Repository<FormMasterDataEntity>,
|
|
16
17
|
private readonly dataSource: DataSource,
|
|
18
|
+
@InjectRepository(FormDataEntity)
|
|
19
|
+
private readonly formRepo: Repository<FormDataEntity>,
|
|
17
20
|
) {}
|
|
18
21
|
|
|
19
22
|
async getForms(organization_id: number, source_entity_type: string) {
|
|
@@ -34,4 +37,20 @@ export class FormMasterRepository {
|
|
|
34
37
|
|
|
35
38
|
return formatted;
|
|
36
39
|
}
|
|
40
|
+
|
|
41
|
+
async submitForm(formData: any) {
|
|
42
|
+
const currentForm = await this.formRepo.findOneBy({
|
|
43
|
+
mapped_entity_id: formData.entity_id,
|
|
44
|
+
mapped_entity_type: formData.entity_type,
|
|
45
|
+
view_id: formData.view_id,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
if (!currentForm) {
|
|
49
|
+
throw new NotFoundException('Form not found');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
currentForm.status = 'Y';
|
|
53
|
+
|
|
54
|
+
return this.formRepo.save(currentForm);
|
|
55
|
+
}
|
|
37
56
|
}
|
|
File without changes
|
|
@@ -186,10 +186,12 @@ export class StageMovementRepository {
|
|
|
186
186
|
SELECT
|
|
187
187
|
a.*,
|
|
188
188
|
m.stage_id,
|
|
189
|
-
ac.code AS action_category_code
|
|
189
|
+
ac.code AS action_category_code,
|
|
190
|
+
arm.form_id
|
|
190
191
|
FROM cr_wf_action a
|
|
191
192
|
INNER JOIN cr_wf_stage_action_mapping m ON a.id = m.action_id
|
|
192
193
|
LEFT JOIN cr_wf_action_category ac ON a.action_category = ac.id
|
|
194
|
+
LEFT JOIN cr_wf_action_resources_mapping arm ON m.id = arm.stg_act_mapping_id
|
|
193
195
|
WHERE m.stage_id = ?
|
|
194
196
|
`,
|
|
195
197
|
[stageId],
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { create } from 'domain';
|
|
3
|
+
import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
|
|
4
|
+
import { Entity } from 'typeorm';
|
|
5
|
+
import { ActivityLog } from '../entity/activity-log.entity';
|
|
6
|
+
import { ActivityLogRepository } from '../repository/activity-log.repository';
|
|
7
|
+
import { UserData } from 'src/module/user/entity/user.entity';
|
|
8
|
+
|
|
9
|
+
@Injectable()
|
|
10
|
+
export class ActivityLogService extends EntityServiceImpl {
|
|
11
|
+
constructor(private readonly activityLogRepository: ActivityLogRepository) {
|
|
12
|
+
super();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async getAllActivityLog(
|
|
16
|
+
mapped_entity_type: string,
|
|
17
|
+
loggedInUser: UserData,
|
|
18
|
+
): Promise<ActivityLog[]> {
|
|
19
|
+
return this.activityLogRepository.getAllActivityLog(
|
|
20
|
+
mapped_entity_type,
|
|
21
|
+
loggedInUser,
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -13,4 +13,14 @@ export class FormMasterService {
|
|
|
13
13
|
source_entity_type,
|
|
14
14
|
);
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
async submitForm(data: any) {
|
|
18
|
+
const { entity_id, entity_type, view_id } = data;
|
|
19
|
+
|
|
20
|
+
return this.formMasterRepository.submitForm({
|
|
21
|
+
entity_id,
|
|
22
|
+
entity_type,
|
|
23
|
+
view_id,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
16
26
|
}
|
|
@@ -57,6 +57,11 @@ import { ActionResourcesMapping } from './entity/action-resources-mapping.entity
|
|
|
57
57
|
import { ActionResourcesMappingService } from './service/action-resources-mapping.service';
|
|
58
58
|
import { ActionResourcesMappingController } from './controller/action-resource-mapping.controller';
|
|
59
59
|
import { ActionCategoryRepository } from './repository/action-category.repository';
|
|
60
|
+
import { FormDataEntity } from './entity/form.entity';
|
|
61
|
+
import { ActivityLog } from './entity/activity-log.entity';
|
|
62
|
+
import { ActivityLogService } from './service/activity-log.service';
|
|
63
|
+
import { ActivityLogController } from './controller/activity-log.controller';
|
|
64
|
+
import { ActivityLogRepository } from './repository/activity-log.repository';
|
|
60
65
|
|
|
61
66
|
@Module({
|
|
62
67
|
imports: [
|
|
@@ -76,7 +81,9 @@ import { ActionCategoryRepository } from './repository/action-category.repositor
|
|
|
76
81
|
TaskDataEntity,
|
|
77
82
|
ActionDataEntity,
|
|
78
83
|
FormMasterDataEntity,
|
|
84
|
+
FormDataEntity,
|
|
79
85
|
ActionResourcesMapping,
|
|
86
|
+
ActivityLog,
|
|
80
87
|
]),
|
|
81
88
|
EntityModule,
|
|
82
89
|
ListMasterModule,
|
|
@@ -102,6 +109,11 @@ import { ActionCategoryRepository } from './repository/action-category.repositor
|
|
|
102
109
|
provide: 'ActionResourcesMappingService',
|
|
103
110
|
useClass: ActionResourcesMappingService,
|
|
104
111
|
},
|
|
112
|
+
{
|
|
113
|
+
provide: 'ActivityLogService',
|
|
114
|
+
useClass: ActivityLogService,
|
|
115
|
+
},
|
|
116
|
+
|
|
105
117
|
WorkflowListMasterService,
|
|
106
118
|
ActionTemplateMappingService,
|
|
107
119
|
WorkflowRepository,
|
|
@@ -119,6 +131,8 @@ import { ActionCategoryRepository } from './repository/action-category.repositor
|
|
|
119
131
|
ActionDataService,
|
|
120
132
|
FormMasterRepository,
|
|
121
133
|
ActionCategoryRepository,
|
|
134
|
+
ActivityLogService,
|
|
135
|
+
ActivityLogRepository,
|
|
122
136
|
],
|
|
123
137
|
exports: [
|
|
124
138
|
'ActionCategoryService',
|
|
@@ -137,6 +151,8 @@ import { ActionCategoryRepository } from './repository/action-category.repositor
|
|
|
137
151
|
WorkflowMetaService,
|
|
138
152
|
PopulateWorkflowService,
|
|
139
153
|
ActionCategoryRepository,
|
|
154
|
+
'ActivityLogService',
|
|
155
|
+
ActivityLogRepository,
|
|
140
156
|
],
|
|
141
157
|
controllers: [
|
|
142
158
|
WorkflowListMasterController,
|
|
@@ -152,6 +168,7 @@ import { ActionCategoryRepository } from './repository/action-category.repositor
|
|
|
152
168
|
TaskController,
|
|
153
169
|
FormMasterController,
|
|
154
170
|
ActionResourcesMappingController,
|
|
171
|
+
ActivityLogController,
|
|
155
172
|
],
|
|
156
173
|
})
|
|
157
174
|
export class WorkflowModule {}
|