rez_core 4.0.21 → 4.0.23
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/mapper/controller/mapper.controller.d.ts +3 -1
- package/dist/module/mapper/controller/mapper.controller.js +9 -5
- package/dist/module/mapper/controller/mapper.controller.js.map +1 -1
- package/dist/module/mapper/service/mapper.service.d.ts +1 -1
- package/dist/module/mapper/service/mapper.service.js +2 -2
- package/dist/module/mapper/service/mapper.service.js.map +1 -1
- package/dist/module/meta/service/entity-validation.service.js +11 -9
- package/dist/module/meta/service/entity-validation.service.js.map +1 -1
- package/dist/module/meta/service/media-data.service.js +1 -1
- package/dist/module/meta/service/media-data.service.js.map +1 -1
- package/dist/module/workflow/repository/action-data.repository.js +2 -0
- package/dist/module/workflow/repository/action-data.repository.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/mapper/controller/mapper.controller.ts +8 -3
- package/src/module/mapper/service/mapper.service.ts +3 -3
- package/src/module/meta/service/entity-validation.service.ts +15 -13
- package/src/module/meta/service/media-data.service.ts +3 -1
- package/src/module/workflow/repository/action-data.repository.ts +7 -0
package/package.json
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import { Controller, Get, Inject, Query } from '@nestjs/common';
|
|
1
|
+
import { Controller, Get, Inject, Query, Req, Res, UseGuards } from '@nestjs/common';
|
|
2
2
|
import { MapperService } from '../service/mapper.service';
|
|
3
|
+
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
4
|
+
import { Response } from 'express';
|
|
3
5
|
|
|
4
6
|
@Controller('mapper')
|
|
7
|
+
@UseGuards(JwtAuthGuard)
|
|
5
8
|
export class MapperController {
|
|
6
9
|
constructor(@Inject('MapperService') private readonly mapperService: MapperService) {}
|
|
7
10
|
|
|
8
11
|
@Get('all')
|
|
9
12
|
async getByMappedEntityType(@Query('mapped_entity_type') mappedEntityType: string,
|
|
13
|
+
@Req() req: Request & { user: any },
|
|
10
14
|
@Query('filter') filter?: string,
|
|
11
|
-
@Query('status') status?: string
|
|
15
|
+
@Query('status') status?: string,
|
|
12
16
|
) {
|
|
13
|
-
|
|
17
|
+
const loggedInUser = req.user.userData;
|
|
18
|
+
return this.mapperService.getByMappedEntityType(mappedEntityType,loggedInUser, filter, status);
|
|
14
19
|
}
|
|
15
20
|
}
|
|
@@ -16,14 +16,14 @@ export class MapperService extends EntityServiceImpl {
|
|
|
16
16
|
super();
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
async getByMappedEntityType(mappedEntityType: string, filter?: string, status?: string) {
|
|
19
|
+
async getByMappedEntityType(mappedEntityType: string,loggedInUser, filter?: string, status?: string) {
|
|
20
20
|
if (!mappedEntityType) return [];
|
|
21
21
|
|
|
22
22
|
const mappers = await this.dataSource.query(
|
|
23
23
|
`SELECT id, name, code, status
|
|
24
24
|
FROM frm_mapper_master
|
|
25
|
-
WHERE mapped_entity_type = ? AND (-1 = ? OR name LIKE ? OR code LIKE ?)`,
|
|
26
|
-
[mappedEntityType, filter || -1, `%${filter}%`, `%${filter}%`],
|
|
25
|
+
WHERE mapped_entity_type = ? AND organization_id = ? AND (-1 = ? OR name LIKE ? OR code LIKE ?)`,
|
|
26
|
+
[mappedEntityType,loggedInUser.organization_id, filter || -1, `%${filter}%`, `%${filter}%`],
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
const distinctStatuses = [
|
|
@@ -65,19 +65,21 @@ export class EntityValidationService {
|
|
|
65
65
|
.where(`${db_table_name}.${attr.attribute_key} = :value`, { value });
|
|
66
66
|
|
|
67
67
|
// Add AND condition for organization_id/level_type/level_id if present
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
68
|
+
if (entityType !== 'ORG' && entityType !== 'ORGP') {
|
|
69
|
+
const orgId = loggedInUser.organization_id;
|
|
70
|
+
const level_type = loggedInUser.level_type;
|
|
71
|
+
const level_id = loggedInUser.level_id;
|
|
72
|
+
|
|
73
|
+
if (orgId !== undefined && orgId !== null) {
|
|
74
|
+
qb = qb.andWhere(
|
|
75
|
+
`${db_table_name}.organization_id = :organization_id AND ${db_table_name}.level_type = :level_type AND ${db_table_name}.level_id = :level_id`,
|
|
76
|
+
{
|
|
77
|
+
organization_id: orgId,
|
|
78
|
+
level_type,
|
|
79
|
+
level_id,
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
}
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
// Skip the current record when checking for uniqueness during update
|
|
@@ -400,7 +400,9 @@ export class MediaDataService extends EntityServiceImpl {
|
|
|
400
400
|
}).toString();
|
|
401
401
|
|
|
402
402
|
organizationData = await axios
|
|
403
|
-
.get(
|
|
403
|
+
.get(
|
|
404
|
+
`${baseUrl}/organization/public/${loggedInUser.organization_id}?${queryParams}`,
|
|
405
|
+
)
|
|
404
406
|
.then((res) => res.data)
|
|
405
407
|
.catch((err) => {
|
|
406
408
|
console.error('Error fetching organization data:', err.message);
|
|
@@ -68,8 +68,15 @@ export class ActionDataRepository extends EntityServiceImpl {
|
|
|
68
68
|
loggedInUser,
|
|
69
69
|
);
|
|
70
70
|
|
|
71
|
+
const viewMaster = await super.getEntityData(
|
|
72
|
+
'VMS',
|
|
73
|
+
Number(act.form_id),
|
|
74
|
+
loggedInUser,
|
|
75
|
+
);
|
|
76
|
+
|
|
71
77
|
const data = {
|
|
72
78
|
entity_type: 'LFRM',
|
|
79
|
+
name: viewMaster?.name,
|
|
73
80
|
stage_id: act.stage_id,
|
|
74
81
|
mapped_entity_type,
|
|
75
82
|
mapped_entity_id,
|