rez_core 2.2.7 → 2.2.9
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/constant/global.constant.d.ts +2 -1
- package/dist/constant/global.constant.js +3 -2
- package/dist/constant/global.constant.js.map +1 -1
- package/dist/module/enterprise/repository/school.repository.js +18 -2
- package/dist/module/enterprise/repository/school.repository.js.map +1 -1
- package/dist/module/filter/controller/filter.controller.d.ts +1 -1
- package/dist/module/filter/controller/filter.controller.js +7 -4
- package/dist/module/filter/controller/filter.controller.js.map +1 -1
- package/dist/module/filter/dto/filter-request.dto.d.ts +1 -0
- package/dist/module/filter/service/filter.service.js +26 -4
- package/dist/module/filter/service/filter.service.js.map +1 -1
- package/dist/module/layout_preference/controller/layout_preference.controller.js +4 -4
- package/dist/module/layout_preference/controller/layout_preference.controller.js.map +1 -1
- package/dist/module/layout_preference/entity/layout_preference.entity.d.ts +2 -0
- package/dist/module/layout_preference/entity/layout_preference.entity.js +13 -0
- package/dist/module/layout_preference/entity/layout_preference.entity.js.map +1 -1
- package/dist/module/layout_preference/repository/layout_preference.repository.d.ts +1 -1
- package/dist/module/layout_preference/repository/layout_preference.repository.js +4 -2
- package/dist/module/layout_preference/repository/layout_preference.repository.js.map +1 -1
- package/dist/module/layout_preference/service/layout_preference.service.d.ts +1 -1
- package/dist/module/layout_preference/service/layout_preference.service.js +17 -4
- package/dist/module/layout_preference/service/layout_preference.service.js.map +1 -1
- package/dist/module/listmaster/entity/list-master-items.entity.js +5 -5
- package/dist/module/listmaster/entity/list-master-items.entity.js.map +1 -1
- package/dist/module/meta/controller/media.controller.d.ts +1 -1
- package/dist/module/meta/controller/media.controller.js +1 -1
- package/dist/module/meta/controller/media.controller.js.map +1 -1
- package/dist/module/meta/entity/base-entity.entity.js.map +1 -1
- package/dist/module/module/controller/module-access.controller.d.ts +1 -1
- package/dist/module/module/controller/module-access.controller.js +6 -6
- package/dist/module/module/controller/module-access.controller.js.map +1 -1
- package/dist/module/module/service/module-access.service.d.ts +2 -1
- package/dist/module/module/service/module-access.service.js +5 -3
- package/dist/module/module/service/module-access.service.js.map +1 -1
- package/dist/module/workflow/controller/action-category.controller.d.ts +8 -0
- package/dist/module/workflow/controller/action-category.controller.js +45 -0
- package/dist/module/workflow/controller/action-category.controller.js.map +1 -0
- package/dist/module/workflow/controller/action.controller.d.ts +28 -0
- package/dist/module/workflow/controller/action.controller.js +88 -0
- package/dist/module/workflow/controller/action.controller.js.map +1 -0
- package/dist/module/workflow/controller/comm-template.controller.d.ts +11 -0
- package/dist/module/workflow/controller/comm-template.controller.js +44 -0
- package/dist/module/workflow/controller/comm-template.controller.js.map +1 -0
- package/dist/module/workflow/controller/entity-modification.controller.d.ts +8 -0
- package/dist/module/workflow/controller/entity-modification.controller.js +44 -0
- package/dist/module/workflow/controller/entity-modification.controller.js.map +1 -0
- package/dist/module/workflow/controller/stage-group.controller.d.ts +10 -0
- package/dist/module/workflow/controller/stage-group.controller.js +43 -0
- package/dist/module/workflow/controller/stage-group.controller.js.map +1 -0
- package/dist/module/workflow/controller/stage.controller.d.ts +13 -0
- package/dist/module/workflow/controller/stage.controller.js +56 -0
- package/dist/module/workflow/controller/stage.controller.js.map +1 -0
- package/dist/module/workflow/controller/task.controller.d.ts +21 -0
- package/dist/module/workflow/controller/task.controller.js +58 -0
- package/dist/module/workflow/controller/task.controller.js.map +1 -0
- package/dist/module/workflow/controller/workflow-meta.controller.d.ts +15 -0
- package/dist/module/workflow/controller/workflow-meta.controller.js +70 -0
- package/dist/module/workflow/controller/workflow-meta.controller.js.map +1 -0
- package/dist/module/workflow/controller/workflow.controller.d.ts +25 -10
- package/dist/module/workflow/controller/workflow.controller.js +32 -15
- package/dist/module/workflow/controller/workflow.controller.js.map +1 -1
- package/dist/module/workflow/entity/action-category.entity.d.ts +1 -0
- package/dist/module/workflow/entity/action-category.entity.js +4 -0
- package/dist/module/workflow/entity/action-category.entity.js.map +1 -1
- package/dist/module/workflow/entity/action-data.entity.d.ts +15 -0
- package/dist/module/workflow/entity/action-data.entity.js +70 -0
- package/dist/module/workflow/entity/action-data.entity.js.map +1 -0
- package/dist/module/workflow/entity/action.entity.d.ts +7 -2
- package/dist/module/workflow/entity/action.entity.js +30 -10
- package/dist/module/workflow/entity/action.entity.js.map +1 -1
- package/dist/module/workflow/entity/comm-template.entity.d.ts +5 -0
- package/dist/module/workflow/entity/comm-template.entity.js +21 -1
- package/dist/module/workflow/entity/comm-template.entity.js.map +1 -1
- package/dist/module/workflow/entity/entity-modification.entity.d.ts +13 -0
- package/dist/module/workflow/entity/entity-modification.entity.js +63 -0
- package/dist/module/workflow/entity/entity-modification.entity.js.map +1 -0
- package/dist/module/workflow/entity/stage-group.entity.d.ts +1 -1
- package/dist/module/workflow/entity/stage-group.entity.js +1 -1
- package/dist/module/workflow/entity/stage-group.entity.js.map +1 -1
- package/dist/module/workflow/entity/stage-movement-data.entity.d.ts +4 -0
- package/dist/module/workflow/entity/stage-movement-data.entity.js +16 -0
- package/dist/module/workflow/entity/stage-movement-data.entity.js.map +1 -1
- package/dist/module/workflow/entity/stage.entity.d.ts +2 -2
- package/dist/module/workflow/entity/stage.entity.js +5 -5
- package/dist/module/workflow/entity/stage.entity.js.map +1 -1
- package/dist/module/workflow/entity/task-data.entity.d.ts +25 -0
- package/dist/module/workflow/entity/task-data.entity.js +110 -0
- package/dist/module/workflow/entity/task-data.entity.js.map +1 -0
- package/dist/module/workflow/entity/template-attach-mapper.entity.d.ts +11 -0
- package/dist/module/workflow/entity/template-attach-mapper.entity.js +54 -0
- package/dist/module/workflow/entity/template-attach-mapper.entity.js.map +1 -0
- package/dist/module/workflow/entity/workflow-level-mapping.entity.d.ts +7 -0
- package/dist/module/workflow/entity/workflow-level-mapping.entity.js +38 -0
- package/dist/module/workflow/entity/workflow-level-mapping.entity.js.map +1 -0
- package/dist/module/workflow/entity/workflow.entity.d.ts +2 -0
- package/dist/module/workflow/entity/workflow.entity.js +8 -0
- package/dist/module/workflow/entity/workflow.entity.js.map +1 -1
- package/dist/module/workflow/repository/action-data.repository.d.ts +10 -0
- package/dist/module/workflow/repository/action-data.repository.js +85 -0
- package/dist/module/workflow/repository/action-data.repository.js.map +1 -0
- package/dist/module/workflow/repository/action.repository.d.ts +17 -0
- package/dist/module/workflow/repository/action.repository.js +97 -0
- package/dist/module/workflow/repository/action.repository.js.map +1 -0
- package/dist/module/workflow/repository/comm-template.repository.d.ts +14 -0
- package/dist/module/workflow/repository/comm-template.repository.js +87 -0
- package/dist/module/workflow/repository/comm-template.repository.js.map +1 -0
- package/dist/module/workflow/repository/stage-group.repository.d.ts +7 -0
- package/dist/module/workflow/repository/stage-group.repository.js +50 -0
- package/dist/module/workflow/repository/stage-group.repository.js.map +1 -0
- package/dist/module/workflow/repository/stage-movement.repository.d.ts +23 -0
- package/dist/module/workflow/repository/stage-movement.repository.js +142 -0
- package/dist/module/workflow/repository/stage-movement.repository.js.map +1 -0
- package/dist/module/workflow/repository/stage.repository.d.ts +7 -0
- package/dist/module/workflow/repository/stage.repository.js +50 -0
- package/dist/module/workflow/repository/stage.repository.js.map +1 -0
- package/dist/module/workflow/repository/task.repository.d.ts +10 -0
- package/dist/module/workflow/repository/task.repository.js +77 -0
- package/dist/module/workflow/repository/task.repository.js.map +1 -0
- package/dist/module/workflow/repository/workflow.repository.d.ts +9 -1
- package/dist/module/workflow/repository/workflow.repository.js +38 -6
- package/dist/module/workflow/repository/workflow.repository.js.map +1 -1
- package/dist/module/workflow/service/action-category.service.d.ts +5 -0
- package/dist/module/workflow/service/action-category.service.js +23 -1
- package/dist/module/workflow/service/action-category.service.js.map +1 -1
- package/dist/module/workflow/service/action-data.service.d.ts +11 -0
- package/dist/module/workflow/service/action-data.service.js +36 -0
- package/dist/module/workflow/service/action-data.service.js.map +1 -0
- package/dist/module/workflow/service/action.service.d.ts +19 -1
- package/dist/module/workflow/service/action.service.js +159 -10
- package/dist/module/workflow/service/action.service.js.map +1 -1
- package/dist/module/workflow/service/comm-template.service.d.ts +11 -0
- package/dist/module/workflow/service/comm-template.service.js +59 -1
- package/dist/module/workflow/service/comm-template.service.js.map +1 -1
- package/dist/module/workflow/service/entity-modification.service.d.ts +8 -0
- package/dist/module/workflow/service/entity-modification.service.js +52 -0
- package/dist/module/workflow/service/entity-modification.service.js.map +1 -0
- package/dist/module/workflow/service/populate-workflow.service.d.ts +21 -0
- package/dist/module/workflow/service/populate-workflow.service.js +124 -0
- package/dist/module/workflow/service/populate-workflow.service.js.map +1 -0
- package/dist/module/workflow/service/stage-group.service.d.ts +13 -0
- package/dist/module/workflow/service/stage-group.service.js +39 -1
- package/dist/module/workflow/service/stage-group.service.js.map +1 -1
- package/dist/module/workflow/service/stage.service.d.ts +14 -4
- package/dist/module/workflow/service/stage.service.js +57 -13
- package/dist/module/workflow/service/stage.service.js.map +1 -1
- package/dist/module/workflow/service/task.service.d.ts +18 -0
- package/dist/module/workflow/service/task.service.js +63 -0
- package/dist/module/workflow/service/task.service.js.map +1 -0
- package/dist/module/workflow/service/workflow-list-master.service.js +4 -4
- package/dist/module/workflow/service/workflow-meta.service.d.ts +20 -0
- package/dist/module/workflow/service/workflow-meta.service.js +137 -0
- package/dist/module/workflow/service/workflow-meta.service.js.map +1 -0
- package/dist/module/workflow/service/workflow.service.d.ts +28 -5
- package/dist/module/workflow/service/workflow.service.js +108 -41
- package/dist/module/workflow/service/workflow.service.js.map +1 -1
- package/dist/module/workflow/workflow.module.js +82 -15
- package/dist/module/workflow/workflow.module.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/constant/global.constant.ts +3 -1
- package/src/module/enterprise/repository/school.repository.ts +23 -2
- package/src/module/filter/controller/filter.controller.ts +10 -4
- package/src/module/filter/dto/filter-request.dto.ts +1 -0
- package/src/module/filter/service/filter.service.ts +39 -5
- package/src/module/layout_preference/controller/layout_preference.controller.ts +6 -4
- package/src/module/layout_preference/entity/layout_preference.entity.ts +11 -0
- package/src/module/layout_preference/repository/layout_preference.repository.ts +6 -2
- package/src/module/layout_preference/service/layout_preference.service.ts +31 -6
- package/src/module/listmaster/entity/list-master-items.entity.ts +5 -5
- package/src/module/meta/controller/media.controller.ts +5 -7
- package/src/module/meta/entity/base-entity.entity.ts +1 -1
- package/src/module/module/controller/module-access.controller.ts +9 -4
- package/src/module/module/service/module-access.service.ts +15 -8
- package/src/module/workflow/controller/action-category.controller.ts +35 -0
- package/src/module/workflow/controller/action.controller.ts +73 -0
- package/src/module/workflow/controller/comm-template.controller.ts +32 -0
- package/src/module/workflow/controller/entity-modification.controller.ts +35 -0
- package/src/module/workflow/controller/stage-group.controller.ts +33 -0
- package/src/module/workflow/controller/stage.controller.ts +50 -0
- package/src/module/workflow/controller/task.controller.ts +57 -0
- package/src/module/workflow/controller/workflow-meta.controller.ts +76 -0
- package/src/module/workflow/controller/workflow.controller.ts +32 -12
- package/src/module/workflow/entity/action-category.entity.ts +3 -0
- package/src/module/workflow/entity/action-data.entity.ts +43 -0
- package/src/module/workflow/entity/action.entity.ts +18 -3
- package/src/module/workflow/entity/comm-template.entity.ts +18 -1
- package/src/module/workflow/entity/entity-modification.entity.ts +38 -0
- package/src/module/workflow/entity/stage-group.entity.ts +1 -1
- package/src/module/workflow/entity/stage-movement-data.entity.ts +12 -0
- package/src/module/workflow/entity/stage.entity.ts +4 -4
- package/src/module/workflow/entity/task-data.entity.ts +73 -0
- package/src/module/workflow/entity/template-attach-mapper.entity.ts +30 -0
- package/src/module/workflow/entity/workflow-level-mapping.entity.ts +18 -0
- package/src/module/workflow/entity/workflow.entity.ts +6 -0
- package/src/module/workflow/repository/action-data.repository.ts +93 -0
- package/src/module/workflow/repository/action.repository.ts +104 -0
- package/src/module/workflow/repository/comm-template.repository.ts +102 -0
- package/src/module/workflow/repository/stage-group.repository.ts +46 -0
- package/src/module/workflow/repository/stage-movement.repository.ts +219 -0
- package/src/module/workflow/repository/stage.repository.ts +47 -0
- package/src/module/workflow/repository/task.repository.ts +85 -0
- package/src/module/workflow/repository/workflow.repository.ts +40 -2
- package/src/module/workflow/service/action-category.service.ts +26 -1
- package/src/module/workflow/service/action-data.service.ts +45 -0
- package/src/module/workflow/service/action-template-mapping.service.ts +1 -1
- package/src/module/workflow/service/action.service.ts +279 -19
- package/src/module/workflow/service/comm-template.service.ts +90 -1
- package/src/module/workflow/service/entity-modification.service.ts +67 -0
- package/src/module/workflow/service/populate-workflow.service.ts +189 -0
- package/src/module/workflow/service/stage-group.service.ts +67 -2
- package/src/module/workflow/service/stage.service.ts +104 -28
- package/src/module/workflow/service/task.service.ts +95 -0
- package/src/module/workflow/service/workflow-list-master.service.ts +4 -4
- package/src/module/workflow/service/workflow-meta.service.ts +231 -0
- package/src/module/workflow/service/workflow.service.ts +181 -50
- package/src/module/workflow/workflow.module.ts +82 -15
package/package.json
CHANGED
|
@@ -46,7 +46,9 @@ export const STAGE = 'STG';
|
|
|
46
46
|
export const STAGE_GROUP = 'STGP';
|
|
47
47
|
export const ACTION_CATEGORY = 'ACTC';
|
|
48
48
|
export const STAGE_ACTION_MAPPING = 'STGM';
|
|
49
|
-
export const COMM_TEMPLATE = '
|
|
49
|
+
export const COMM_TEMPLATE = 'TEM';
|
|
50
50
|
export const ACTION_TEMPLATE_MAPPING = 'ATMP';
|
|
51
51
|
export const WORKFLOW_DATA = 'WFDT';
|
|
52
52
|
export const STAGE_MOVEMENT_DATA = 'STMV';
|
|
53
|
+
|
|
54
|
+
export const ENTITY_MODIFICATION = 'ENMD';
|
|
@@ -3,6 +3,7 @@ import { Injectable } from '@nestjs/common';
|
|
|
3
3
|
import { DataSource, Repository } from 'typeorm';
|
|
4
4
|
// import { SchoolData } from '../entity/school.entity';
|
|
5
5
|
import { UserRoleMapping } from 'src/module/user/entity/user-role-mapping.entity';
|
|
6
|
+
import { STATUS_INACTIVE } from 'src/constant/global.constant';
|
|
6
7
|
|
|
7
8
|
@Injectable()
|
|
8
9
|
export class SchoolRepository {
|
|
@@ -43,6 +44,16 @@ export class SchoolRepository {
|
|
|
43
44
|
currentORGLevel_id = org_id;
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
const resolvedInactiveStatus = await this.dataSource
|
|
48
|
+
.createQueryBuilder()
|
|
49
|
+
.select('*')
|
|
50
|
+
.from('cr_list_master_items', 'cli')
|
|
51
|
+
.where('cli.code = :code AND cli.organization_id = :orgId', {
|
|
52
|
+
code: STATUS_INACTIVE,
|
|
53
|
+
orgId: org_id,
|
|
54
|
+
})
|
|
55
|
+
.getRawOne();
|
|
56
|
+
|
|
46
57
|
if (hasOrgAccess.length > 0) {
|
|
47
58
|
const schools = await this.dataSource
|
|
48
59
|
.createQueryBuilder()
|
|
@@ -142,9 +153,14 @@ export class SchoolRepository {
|
|
|
142
153
|
})
|
|
143
154
|
.getRawOne();
|
|
144
155
|
|
|
156
|
+
const finalSchoolName =
|
|
157
|
+
schoolStatus?.id === resolvedInactiveStatus?.id
|
|
158
|
+
? `${school_name} [INACTIVE]`
|
|
159
|
+
: school_name;
|
|
160
|
+
|
|
145
161
|
result[org_id].brands[brand_id].schools.push({
|
|
146
162
|
school_id,
|
|
147
|
-
school_name,
|
|
163
|
+
school_name: finalSchoolName,
|
|
148
164
|
school_location,
|
|
149
165
|
status: schoolStatus ? schoolStatus.name : school_status,
|
|
150
166
|
type: 'School',
|
|
@@ -238,13 +254,18 @@ export class SchoolRepository {
|
|
|
238
254
|
};
|
|
239
255
|
}
|
|
240
256
|
|
|
257
|
+
const finalSchoolName =
|
|
258
|
+
school_status === resolvedInactiveStatus?.id
|
|
259
|
+
? `${school_name} [INACTIVE]`
|
|
260
|
+
: school_name;
|
|
261
|
+
|
|
241
262
|
if (
|
|
242
263
|
school_id &&
|
|
243
264
|
!result[brand_id].schools.some((s) => s.school_id === school_id)
|
|
244
265
|
) {
|
|
245
266
|
result[brand_id].schools.push({
|
|
246
267
|
school_id,
|
|
247
|
-
school_name,
|
|
268
|
+
school_name: finalSchoolName,
|
|
248
269
|
school_location,
|
|
249
270
|
status: school_status,
|
|
250
271
|
type: 'School',
|
|
@@ -26,11 +26,16 @@ export class FilterController {
|
|
|
26
26
|
@UseGuards(JwtAuthGuard)
|
|
27
27
|
async applyFilter(
|
|
28
28
|
@Body() body: any,
|
|
29
|
-
@Query('page', ParseIntPipe) page
|
|
30
|
-
@Query('size', ParseIntPipe) size
|
|
29
|
+
@Query('page', ParseIntPipe) page = 1,
|
|
30
|
+
@Query('size', ParseIntPipe) size = 10,
|
|
31
31
|
@Req() req: Request & { user: any },
|
|
32
|
+
@Query() queryParams: Record<string, string>,
|
|
32
33
|
) {
|
|
33
|
-
const
|
|
34
|
+
const loggedInUser = req.user.userData;
|
|
35
|
+
|
|
36
|
+
// Remove page and size from queryParams
|
|
37
|
+
const { page: _p, size: _s, ...otherQueryParams } = queryParams;
|
|
38
|
+
|
|
34
39
|
const {
|
|
35
40
|
entity_type,
|
|
36
41
|
quickFilter,
|
|
@@ -49,7 +54,8 @@ export class FilterController {
|
|
|
49
54
|
sortby,
|
|
50
55
|
page,
|
|
51
56
|
size,
|
|
52
|
-
loggedInUser
|
|
57
|
+
loggedInUser,
|
|
58
|
+
queryParams: otherQueryParams, // only remaining query params
|
|
53
59
|
});
|
|
54
60
|
}
|
|
55
61
|
|
|
@@ -78,8 +78,10 @@ export class FilterService {
|
|
|
78
78
|
tabs,
|
|
79
79
|
sortby,
|
|
80
80
|
loggedInUser,
|
|
81
|
+
queryParams,
|
|
81
82
|
} = dto;
|
|
82
83
|
|
|
84
|
+
// abstract user details
|
|
83
85
|
const {
|
|
84
86
|
level_type,
|
|
85
87
|
level_id,
|
|
@@ -88,15 +90,18 @@ export class FilterService {
|
|
|
88
90
|
organization_id,
|
|
89
91
|
} = loggedInUser || {};
|
|
90
92
|
|
|
91
|
-
// Fetch meta
|
|
93
|
+
// Fetch meta from entity table service
|
|
92
94
|
const entityMeta = await this.entityTableService.getEntityData(
|
|
93
95
|
entity_type,
|
|
94
96
|
loggedInUser,
|
|
95
97
|
);
|
|
96
98
|
const tableName = entityMeta?.data_source; // data_souce is the table name
|
|
97
|
-
|
|
99
|
+
|
|
100
|
+
if (!tableName) {
|
|
98
101
|
throw new BadRequestException(`Invalid entity_type: ${entity_type}`);
|
|
102
|
+
}
|
|
99
103
|
|
|
104
|
+
// get table meta from cr_entity_table
|
|
100
105
|
const getTableMeta =
|
|
101
106
|
await this.entityTableService.findByEntityTypeAndListTypeAndDisplayType(
|
|
102
107
|
entity_type,
|
|
@@ -110,6 +115,7 @@ export class FilterService {
|
|
|
110
115
|
`Table meta not found for entity_type: ${entity_type}`,
|
|
111
116
|
);
|
|
112
117
|
}
|
|
118
|
+
|
|
113
119
|
const getTableColumnMeta =
|
|
114
120
|
await this.entityTableColumnService.findByParentIdAndParentType(
|
|
115
121
|
getTableMeta.id,
|
|
@@ -153,6 +159,32 @@ export class FilterService {
|
|
|
153
159
|
});
|
|
154
160
|
}
|
|
155
161
|
|
|
162
|
+
// andWhere search with attributeName && attributeValue
|
|
163
|
+
if (queryParams) {
|
|
164
|
+
Object.entries(queryParams).forEach(([key, value]) => {
|
|
165
|
+
if (!value) return;
|
|
166
|
+
|
|
167
|
+
// Handle custom attributeName/attributeValue
|
|
168
|
+
if (key === 'attributeName' && queryParams['attributeValue']) {
|
|
169
|
+
const attrName = value;
|
|
170
|
+
const attrValue = queryParams['attributeValue'];
|
|
171
|
+
|
|
172
|
+
baseWhere.push({
|
|
173
|
+
query: `e.${attrName} = :${attrName}`,
|
|
174
|
+
params: { [attrName]: attrValue },
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Ignore attributeValue itself from being added again
|
|
179
|
+
else if (key !== 'attributeValue') {
|
|
180
|
+
baseWhere.push({
|
|
181
|
+
query: `e.${key} = :${key}`,
|
|
182
|
+
params: { [key]: value },
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
156
188
|
// if (!this.skipAppCodeFilterEntities.includes(entity_type)) {
|
|
157
189
|
// baseWhere.push({
|
|
158
190
|
// query: 'e.appcode = :appcode',
|
|
@@ -163,11 +195,13 @@ export class FilterService {
|
|
|
163
195
|
// layout preference query
|
|
164
196
|
const layoutPreference = await this.dataSource.query(
|
|
165
197
|
`SELECT layout_json
|
|
166
|
-
FROM
|
|
167
|
-
WHERE user_id = ? AND mapped_entity_type = ?`,
|
|
168
|
-
[user_id, entity_type],
|
|
198
|
+
FROM cr_layout_preference
|
|
199
|
+
WHERE user_id = ? AND mapped_entity_type = ? AND mapped_level_id = ? AND mapped_level_type = ?`,
|
|
200
|
+
[user_id, entity_type, level_id, level_type],
|
|
169
201
|
);
|
|
170
202
|
|
|
203
|
+
console.log('found layoutPreference', layoutPreference);
|
|
204
|
+
|
|
171
205
|
// Extract layout preference
|
|
172
206
|
const layout = layoutPreference?.[0]?.layout_json?.quick_tab || {};
|
|
173
207
|
|
|
@@ -15,11 +15,13 @@ export class LayoutPreferenceController {
|
|
|
15
15
|
@Query('entity_type') entity_type: string,
|
|
16
16
|
@Req() req: Request & { user: any },
|
|
17
17
|
) {
|
|
18
|
-
const
|
|
18
|
+
const userDat = req.user.userData;
|
|
19
19
|
|
|
20
20
|
return this.layoutPreferenceService.getLayoutPreferenceByUserID(
|
|
21
|
-
|
|
21
|
+
userDat.id,
|
|
22
22
|
entity_type,
|
|
23
|
+
userDat.level_id,
|
|
24
|
+
userDat.level_type,
|
|
23
25
|
);
|
|
24
26
|
}
|
|
25
27
|
|
|
@@ -31,13 +33,13 @@ export class LayoutPreferenceController {
|
|
|
31
33
|
@Query('sort_by') sort_by: string,
|
|
32
34
|
@Req() req: Request & { user: any },
|
|
33
35
|
) {
|
|
34
|
-
const
|
|
36
|
+
const loggedInUser = req.user.userData;
|
|
35
37
|
|
|
36
38
|
return this.layoutPreferenceService.getColumnValue(
|
|
37
39
|
entity_type,
|
|
38
40
|
column,
|
|
39
41
|
sort_by,
|
|
40
|
-
|
|
42
|
+
loggedInUser,
|
|
41
43
|
);
|
|
42
44
|
}
|
|
43
45
|
}
|
|
@@ -14,4 +14,15 @@ export class LayoutPreference extends BaseEntity {
|
|
|
14
14
|
|
|
15
15
|
@Column({ nullable: true, type: 'json' })
|
|
16
16
|
navigation_tabs_json: any;
|
|
17
|
+
|
|
18
|
+
@Column({
|
|
19
|
+
name: 'mapped_level_id',
|
|
20
|
+
type: 'varchar',
|
|
21
|
+
length: 100,
|
|
22
|
+
nullable: true,
|
|
23
|
+
})
|
|
24
|
+
mapped_level_id: string;
|
|
25
|
+
|
|
26
|
+
@Column({ name: 'mapped_level_type', type: 'varchar', nullable: true })
|
|
27
|
+
mapped_level_type: string;
|
|
17
28
|
}
|
|
@@ -11,13 +11,17 @@ export class LayoutPreferenceRepository {
|
|
|
11
11
|
) {}
|
|
12
12
|
|
|
13
13
|
async findByEntityUserId(
|
|
14
|
-
|
|
14
|
+
mapped_entity_type: string,
|
|
15
|
+
mapped_level_id: string,
|
|
16
|
+
mapped_level_type: string,
|
|
15
17
|
userId: number,
|
|
16
18
|
): Promise<LayoutPreference | null> {
|
|
17
19
|
return this.layoutPreferenceRepo.findOne({
|
|
18
20
|
where: {
|
|
19
21
|
user_id: userId.toString(),
|
|
20
|
-
mapped_entity_type:
|
|
22
|
+
mapped_entity_type: mapped_entity_type,
|
|
23
|
+
mapped_level_id: mapped_level_id,
|
|
24
|
+
mapped_level_type: mapped_level_type,
|
|
21
25
|
},
|
|
22
26
|
});
|
|
23
27
|
}
|
|
@@ -27,6 +27,8 @@ export class LayoutPreferenceService extends EntityServiceImpl {
|
|
|
27
27
|
const existingLayoutPreference =
|
|
28
28
|
await this.layoutPreferenceRepository.findByEntityUserId(
|
|
29
29
|
mapped_entity_type,
|
|
30
|
+
loggedInUser.level_id,
|
|
31
|
+
loggedInUser.level_type,
|
|
30
32
|
userId,
|
|
31
33
|
);
|
|
32
34
|
|
|
@@ -38,16 +40,31 @@ export class LayoutPreferenceService extends EntityServiceImpl {
|
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
return await super.createEntity(
|
|
41
|
-
{
|
|
43
|
+
{
|
|
44
|
+
...entityData,
|
|
45
|
+
user_id: userId,
|
|
46
|
+
mapped_level_id: loggedInUser.level_id,
|
|
47
|
+
mapped_level_type: loggedInUser.level_type,
|
|
48
|
+
} as any,
|
|
42
49
|
loggedInUser,
|
|
43
50
|
);
|
|
44
51
|
}
|
|
45
52
|
|
|
46
|
-
async getLayoutPreferenceByUserID(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
async getLayoutPreferenceByUserID(
|
|
54
|
+
user_id,
|
|
55
|
+
mapped_entity_type,
|
|
56
|
+
mapped_level_id,
|
|
57
|
+
mapped_level_type,
|
|
58
|
+
) {
|
|
59
|
+
const layoutPreference =
|
|
60
|
+
await this.layoutPreferenceRepository.findByEntityUserId(
|
|
61
|
+
mapped_entity_type,
|
|
62
|
+
mapped_level_id,
|
|
63
|
+
mapped_level_type,
|
|
64
|
+
user_id,
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
return layoutPreference;
|
|
51
68
|
}
|
|
52
69
|
|
|
53
70
|
async getColumnValue(
|
|
@@ -65,6 +82,7 @@ export class LayoutPreferenceService extends EntityServiceImpl {
|
|
|
65
82
|
);
|
|
66
83
|
|
|
67
84
|
const tableName = getTableMeta?.data_source;
|
|
85
|
+
|
|
68
86
|
if (!tableName) {
|
|
69
87
|
throw new Error('Invalid or missing table name in metadata');
|
|
70
88
|
}
|
|
@@ -77,6 +95,13 @@ export class LayoutPreferenceService extends EntityServiceImpl {
|
|
|
77
95
|
.addSelect(`COUNT(*) AS count`)
|
|
78
96
|
.from(tableName, tableName)
|
|
79
97
|
.where(`${column} IS NOT NULL`)
|
|
98
|
+
.andWhere(`organization_id = :organizationId`, {
|
|
99
|
+
organizationId: loggedInUser?.organization_id,
|
|
100
|
+
})
|
|
101
|
+
.andWhere(`level_id = :levelId`, { levelId: loggedInUser?.level_id })
|
|
102
|
+
.andWhere(`level_type = :levelType`, {
|
|
103
|
+
levelType: loggedInUser?.level_type,
|
|
104
|
+
})
|
|
80
105
|
.groupBy(column)
|
|
81
106
|
.getRawMany();
|
|
82
107
|
|
|
@@ -12,19 +12,19 @@ export class ListMasterItems extends BaseEntity {
|
|
|
12
12
|
@PrimaryGeneratedColumn()
|
|
13
13
|
id: number;
|
|
14
14
|
|
|
15
|
-
@Column()
|
|
15
|
+
@Column({ nullable: true })
|
|
16
16
|
listtype: string;
|
|
17
17
|
|
|
18
|
-
@Column()
|
|
18
|
+
@Column({ nullable: true })
|
|
19
19
|
name: string;
|
|
20
20
|
|
|
21
|
-
@Column()
|
|
21
|
+
@Column({ nullable: true })
|
|
22
22
|
parent_code: string;
|
|
23
23
|
|
|
24
|
-
@Column()
|
|
24
|
+
@Column({ nullable: true })
|
|
25
25
|
value: string;
|
|
26
26
|
|
|
27
|
-
@Column()
|
|
27
|
+
@Column({ nullable: true })
|
|
28
28
|
status: string;
|
|
29
29
|
|
|
30
30
|
@Column({ default: 0 })
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Body,
|
|
3
3
|
Controller,
|
|
4
|
+
Get,
|
|
4
5
|
HttpStatus,
|
|
6
|
+
Param,
|
|
5
7
|
Post,
|
|
8
|
+
Req,
|
|
6
9
|
Res,
|
|
7
|
-
Get,
|
|
8
|
-
Param,
|
|
9
10
|
UseGuards,
|
|
10
|
-
Req,
|
|
11
11
|
} from '@nestjs/common';
|
|
12
|
-
import {
|
|
12
|
+
import { Response } from 'express';
|
|
13
13
|
import { JwtAuthGuard } from '../../auth/guards/jwt.guard';
|
|
14
|
-
import
|
|
15
|
-
import { ENTITYTYPE_MEDIA } from 'src/constant/global.constant';
|
|
16
|
-
import { MediaData } from '../entity/media-data.entity';
|
|
14
|
+
import { MediaDataService } from '../service/media-data.service';
|
|
17
15
|
|
|
18
16
|
@Controller('media')
|
|
19
17
|
@UseGuards(JwtAuthGuard)
|
|
@@ -23,16 +23,21 @@ export class ModuleAccessController {
|
|
|
23
23
|
private readonly menuService: MenuService,
|
|
24
24
|
) {}
|
|
25
25
|
|
|
26
|
+
|
|
26
27
|
@Get('roles')
|
|
27
|
-
async getRoles(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
async getRoles(
|
|
29
|
+
@Query('appcode') appcode: string,
|
|
30
|
+
@Query('include') include: string, // ✅ declare it as boolean
|
|
31
|
+
@Request() req
|
|
32
|
+
) {
|
|
33
|
+
const { level_type, level_id, organization_id } = req.user.userData;
|
|
34
|
+
|
|
31
35
|
return this.moduleAccessService.getRoles({
|
|
32
36
|
appcode,
|
|
33
37
|
level_type,
|
|
34
38
|
level_id,
|
|
35
39
|
organization_id,
|
|
40
|
+
include: include === "true", // ensure it's either true or false
|
|
36
41
|
});
|
|
37
42
|
}
|
|
38
43
|
|
|
@@ -33,42 +33,49 @@ export class ModuleAccessService {
|
|
|
33
33
|
level_type,
|
|
34
34
|
level_id,
|
|
35
35
|
organization_id,
|
|
36
|
+
include
|
|
36
37
|
}: {
|
|
37
38
|
appcode: string;
|
|
38
39
|
level_type?: string;
|
|
39
40
|
level_id?: number;
|
|
40
41
|
organization_id?: number;
|
|
42
|
+
include?: boolean;
|
|
41
43
|
}) {
|
|
42
44
|
const query = this.dataSource
|
|
43
45
|
.createQueryBuilder()
|
|
44
46
|
.select('*')
|
|
45
47
|
.from('cr_role', 'role')
|
|
46
|
-
.where('role.appcode = :appcode', { appcode })
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
.where('role.appcode = :appcode', { appcode });
|
|
49
|
+
|
|
50
|
+
// Only add this condition if `include` is false (exclude factory roles)
|
|
51
|
+
if (!include) {
|
|
52
|
+
query.andWhere('(role.is_factory IS NULL OR role.is_factory != 1)');
|
|
53
|
+
}
|
|
54
|
+
|
|
49
55
|
if (level_type) {
|
|
50
56
|
query.andWhere('role.level_type = :level_type', { level_type });
|
|
51
57
|
}
|
|
52
|
-
|
|
58
|
+
|
|
53
59
|
if (organization_id) {
|
|
54
60
|
query.andWhere('role.organization_id = :organization_id', {
|
|
55
61
|
organization_id,
|
|
56
62
|
});
|
|
57
63
|
}
|
|
58
|
-
|
|
64
|
+
|
|
59
65
|
if (level_id !== undefined) {
|
|
60
66
|
query.andWhere('role.level_id = :level_id', {
|
|
61
67
|
level_id: String(level_id),
|
|
62
68
|
});
|
|
63
69
|
}
|
|
64
|
-
|
|
65
|
-
const roles = await query.getRawMany();
|
|
66
|
-
|
|
70
|
+
|
|
71
|
+
const roles = await query.getRawMany();
|
|
72
|
+
|
|
67
73
|
return roles.map((role) => ({
|
|
68
74
|
label: role.name,
|
|
69
75
|
value: role.id,
|
|
70
76
|
}));
|
|
71
77
|
}
|
|
78
|
+
|
|
72
79
|
|
|
73
80
|
async getAccessListing(
|
|
74
81
|
roleIds: number[],
|
|
@@ -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 { ActionCategoryService } from '../service/action-category.service';
|
|
13
|
+
|
|
14
|
+
@Controller('/actionCategory')
|
|
15
|
+
@UseGuards(JwtAuthGuard)
|
|
16
|
+
export class ActionCategoryController {
|
|
17
|
+
constructor(
|
|
18
|
+
@Inject('ActionCategoryService')
|
|
19
|
+
private readonly actionCategoryService: ActionCategoryService,
|
|
20
|
+
) {}
|
|
21
|
+
|
|
22
|
+
@Post('/getActionsCategory')
|
|
23
|
+
@HttpCode(HttpStatus.OK)
|
|
24
|
+
async getActionsCat(
|
|
25
|
+
@Req() req: Request & { user: any },
|
|
26
|
+
@Body('entity_type') entity_type: string,
|
|
27
|
+
) {
|
|
28
|
+
const loggedInUser = req.user.userData;
|
|
29
|
+
const result = this.actionCategoryService.getActionsCat(
|
|
30
|
+
loggedInUser,
|
|
31
|
+
entity_type,
|
|
32
|
+
);
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Body,
|
|
3
|
+
Controller,
|
|
4
|
+
Get,
|
|
5
|
+
HttpCode,
|
|
6
|
+
HttpStatus,
|
|
7
|
+
Inject,
|
|
8
|
+
Post,
|
|
9
|
+
Req,
|
|
10
|
+
UseGuards,
|
|
11
|
+
} from '@nestjs/common';
|
|
12
|
+
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
13
|
+
import { ActionService } from '../service/action.service';
|
|
14
|
+
|
|
15
|
+
@Controller('/action')
|
|
16
|
+
@UseGuards(JwtAuthGuard)
|
|
17
|
+
export class ActionController {
|
|
18
|
+
constructor(
|
|
19
|
+
@Inject('ActionService')
|
|
20
|
+
private readonly actionService: ActionService,
|
|
21
|
+
) {}
|
|
22
|
+
|
|
23
|
+
@Get('/getReasonCode')
|
|
24
|
+
@HttpCode(HttpStatus.OK)
|
|
25
|
+
async getReasonCode(@Req() req: Request & { user: any }) {
|
|
26
|
+
const loggedInUser = req.user.userData;
|
|
27
|
+
const result = this.actionService.getReasonCode(loggedInUser);
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Post('/defaultReasonCode')
|
|
32
|
+
@HttpCode(HttpStatus.OK)
|
|
33
|
+
async defaultReasonCode(
|
|
34
|
+
@Req() req: Request & { user: any },
|
|
35
|
+
@Body() body: { list_type: string },
|
|
36
|
+
) {
|
|
37
|
+
const loggedInUser = req.user.userData;
|
|
38
|
+
const result = this.actionService.defaultReasonCode(
|
|
39
|
+
body.list_type,
|
|
40
|
+
loggedInUser,
|
|
41
|
+
);
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@Post('/getactions')
|
|
46
|
+
@HttpCode(HttpStatus.OK)
|
|
47
|
+
async getActions(
|
|
48
|
+
@Req() req: Request & { user: any },
|
|
49
|
+
@Body('stage_id') stage_id: number,
|
|
50
|
+
) {
|
|
51
|
+
const loggedInUser = req.user.userData;
|
|
52
|
+
const result = this.actionService.getActions(loggedInUser, stage_id);
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@Post('/getaction')
|
|
57
|
+
@HttpCode(HttpStatus.OK)
|
|
58
|
+
async getAction(
|
|
59
|
+
@Req() req: Request & { user: any },
|
|
60
|
+
@Body('stage_id') stage_id: number,
|
|
61
|
+
@Body('mapped_entity_id') mapped_entity_id: number,
|
|
62
|
+
@Body('mapped_entity_type') mapped_entity_type: string,
|
|
63
|
+
) {
|
|
64
|
+
const loggedInUser = req.user.userData;
|
|
65
|
+
const result = this.actionService.getAction(
|
|
66
|
+
loggedInUser,
|
|
67
|
+
stage_id,
|
|
68
|
+
mapped_entity_id,
|
|
69
|
+
mapped_entity_type,
|
|
70
|
+
);
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Body,
|
|
3
|
+
Controller,
|
|
4
|
+
HttpCode,
|
|
5
|
+
HttpStatus,
|
|
6
|
+
Post,
|
|
7
|
+
Query,
|
|
8
|
+
Req,
|
|
9
|
+
UseGuards,
|
|
10
|
+
} from '@nestjs/common';
|
|
11
|
+
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
12
|
+
import { CommTemplateService } from '../service/comm-template.service';
|
|
13
|
+
|
|
14
|
+
@Controller('/templates')
|
|
15
|
+
@UseGuards(JwtAuthGuard)
|
|
16
|
+
export class CommTemplateController {
|
|
17
|
+
constructor(private readonly commTemplateService: CommTemplateService) {}
|
|
18
|
+
|
|
19
|
+
@Post('/getTemplates')
|
|
20
|
+
@HttpCode(HttpStatus.OK)
|
|
21
|
+
async getTemplate(
|
|
22
|
+
@Req() req: Request & { user: any },
|
|
23
|
+
@Body('entity_type') entity_type: string,
|
|
24
|
+
) {
|
|
25
|
+
const loggedInUser = req.user.userData;
|
|
26
|
+
const result = this.commTemplateService.getAllCommTemplate(
|
|
27
|
+
entity_type || '',
|
|
28
|
+
loggedInUser,
|
|
29
|
+
);
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Body,
|
|
3
|
+
Controller,
|
|
4
|
+
Get,
|
|
5
|
+
HttpCode,
|
|
6
|
+
HttpStatus,
|
|
7
|
+
Inject,
|
|
8
|
+
Post,
|
|
9
|
+
Req,
|
|
10
|
+
UseGuards,
|
|
11
|
+
} from '@nestjs/common';
|
|
12
|
+
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
13
|
+
import { EntityModificationService } from '../service/entity-modification.service';
|
|
14
|
+
|
|
15
|
+
@Controller('/entity-modification')
|
|
16
|
+
@UseGuards(JwtAuthGuard)
|
|
17
|
+
export class EntityModificationController {
|
|
18
|
+
constructor(
|
|
19
|
+
@Inject('EntityModificationService')
|
|
20
|
+
private readonly entityModificationService: EntityModificationService,
|
|
21
|
+
) {}
|
|
22
|
+
|
|
23
|
+
@Post('/logModification')
|
|
24
|
+
@HttpCode(HttpStatus.OK)
|
|
25
|
+
async logModification(
|
|
26
|
+
@Body() modificationData: any,
|
|
27
|
+
@Req() req: Request & { user: any },
|
|
28
|
+
) {
|
|
29
|
+
const loggedInUser = req.user.userData;
|
|
30
|
+
return await this.entityModificationService.logModification(
|
|
31
|
+
modificationData,
|
|
32
|
+
loggedInUser,
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|