rez_core 4.0.141 → 4.0.142
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/filter/repository/saved-filter.repository.js +1 -1
- package/dist/module/filter/service/filter-evaluator.service.js +1 -1
- package/dist/module/filter/service/filter-evaluator.service.js.map +1 -1
- package/dist/module/filter/service/filter.service.js +1 -1
- package/dist/module/filter/service/filter.service.js.map +1 -1
- package/dist/module/integration/service/wrapper.service.js +10 -9
- package/dist/module/integration/service/wrapper.service.js.map +1 -1
- package/dist/module/listmaster/service/list-master-item.service.js +1 -1
- package/dist/module/listmaster/service/list-master-item.service.js.map +1 -1
- package/dist/module/mapper/service/field-mapper.service.js +3 -3
- package/dist/module/mapper/service/field-mapper.service.js.map +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/repository/attribute-master.repository.js +2 -2
- package/dist/module/meta/repository/attribute-master.repository.js.map +1 -1
- package/dist/module/meta/repository/entity-master.repository.js +1 -1
- package/dist/module/meta/repository/entity-master.repository.js.map +1 -1
- package/dist/module/meta/service/entity-dynamic.service.js +19 -19
- package/dist/module/meta/service/entity-dynamic.service.js.map +1 -1
- package/dist/module/meta/service/entity-master.service.js +2 -2
- package/dist/module/meta/service/entity-master.service.js.map +1 -1
- package/dist/module/meta/service/entity-relation.service.js +6 -6
- package/dist/module/meta/service/entity-relation.service.js.map +1 -1
- package/dist/module/meta/service/media-data.service.js +9 -9
- package/dist/module/meta/service/media-data.service.js.map +1 -1
- package/dist/module/meta/service/resolver.service.js +14 -14
- package/dist/module/meta/service/resolver.service.js.map +1 -1
- package/dist/module/notification/service/notification.service.js +1 -1
- package/dist/module/user/service/login.service.js +1 -1
- package/dist/module/user/service/login.service.js.map +1 -1
- package/dist/module/user/service/user-session.service.js +3 -3
- package/dist/module/user/service/user-session.service.js.map +1 -1
- package/dist/module/workflow/repository/action-data.repository.js +4 -4
- package/dist/module/workflow/repository/action-data.repository.js.map +1 -1
- package/dist/module/workflow/repository/action.repository.js +2 -2
- package/dist/module/workflow/repository/action.repository.js.map +1 -1
- package/dist/module/workflow/repository/comm-template.repository.js +4 -4
- package/dist/module/workflow/repository/comm-template.repository.js.map +1 -1
- package/dist/module/workflow/repository/form-master.repository.js +1 -1
- package/dist/module/workflow/repository/form-master.repository.js.map +1 -1
- package/dist/module/workflow/repository/stage-group.repository.js +4 -4
- package/dist/module/workflow/repository/stage-movement.repository.js +4 -4
- package/dist/module/workflow/repository/stage-movement.repository.js.map +1 -1
- package/dist/module/workflow/service/action-template-mapping.service.js +7 -7
- package/dist/module/workflow/service/action.service.js +7 -7
- package/dist/module/workflow/service/action.service.js.map +1 -1
- package/dist/module/workflow/service/entity-modification.service.js +2 -2
- package/dist/module/workflow/service/populate-workflow.service.js +8 -8
- package/dist/module/workflow/service/populate-workflow.service.js.map +1 -1
- package/dist/module/workflow/service/stage-group.service.js +4 -4
- package/dist/module/workflow/service/stage-group.service.js.map +1 -1
- package/dist/module/workflow/service/stage.service.js +2 -2
- package/dist/module/workflow/service/stage.service.js.map +1 -1
- package/dist/module/workflow/service/task.service.js +6 -6
- package/dist/module/workflow/service/task.service.js.map +1 -1
- package/dist/module/workflow/service/workflow-list-master.service.js +3 -3
- package/dist/module/workflow/service/workflow-list-master.service.js.map +1 -1
- package/dist/module/workflow/service/workflow-meta.service.js +22 -22
- package/dist/module/workflow/service/workflow-meta.service.js.map +1 -1
- package/dist/module/workflow/service/workflow.service.js +4 -4
- package/dist/module/workflow/service/workflow.service.js.map +1 -1
- package/dist/module/workflow-automation/service/workflow-automation-engine.service.js +1 -1
- package/dist/module/workflow-automation/service/workflow-automation-engine.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/service/reflection-helper.service.js +1 -1
- package/dist/utils/service/reflection-helper.service.js.map +1 -1
- package/package.json +1 -1
- package/src/module/filter/repository/saved-filter.repository.ts +1 -1
- package/src/module/filter/service/filter-evaluator.service.ts +1 -1
- package/src/module/filter/service/filter.service.ts +1 -1
- package/src/module/integration/service/wrapper.service.ts +10 -9
- package/src/module/listmaster/service/list-master-item.service.ts +1 -1
- package/src/module/mapper/service/field-mapper.service.ts +3 -3
- package/src/module/mapper/service/mapper.service.ts +2 -2
- package/src/module/meta/repository/attribute-master.repository.ts +2 -2
- package/src/module/meta/repository/entity-master.repository.ts +1 -1
- package/src/module/meta/service/entity-dynamic.service.ts +19 -19
- package/src/module/meta/service/entity-master.service.ts +2 -2
- package/src/module/meta/service/entity-relation.service.ts +6 -6
- package/src/module/meta/service/media-data.service.ts +9 -9
- package/src/module/meta/service/resolver.service.ts +14 -14
- package/src/module/notification/service/notification.service.ts +1 -1
- package/src/module/user/service/login.service.ts +1 -1
- package/src/module/user/service/user-session.service.ts +3 -3
- package/src/module/workflow/repository/action-data.repository.ts +4 -4
- package/src/module/workflow/repository/action.repository.ts +2 -2
- package/src/module/workflow/repository/comm-template.repository.ts +4 -4
- package/src/module/workflow/repository/form-master.repository.ts +1 -1
- package/src/module/workflow/repository/stage-group.repository.ts +4 -4
- package/src/module/workflow/repository/stage-movement.repository.ts +4 -4
- package/src/module/workflow/service/action-template-mapping.service.ts +7 -7
- package/src/module/workflow/service/action.service.ts +7 -7
- package/src/module/workflow/service/entity-modification.service.ts +2 -2
- package/src/module/workflow/service/populate-workflow.service.ts +8 -8
- package/src/module/workflow/service/stage-group.service.ts +4 -4
- package/src/module/workflow/service/stage.service.ts +2 -2
- package/src/module/workflow/service/task.service.ts +6 -6
- package/src/module/workflow/service/workflow-list-master.service.ts +3 -3
- package/src/module/workflow/service/workflow-meta.service.ts +22 -22
- package/src/module/workflow/service/workflow.service.ts +4 -4
- package/src/module/workflow-automation/service/workflow-automation-engine.service.ts +1 -1
- package/src/utils/service/reflection-helper.service.ts +1 -1
|
@@ -53,7 +53,7 @@ let ReflectionHelper = class ReflectionHelper {
|
|
|
53
53
|
async getEntityData(id, tableName) {
|
|
54
54
|
const entityList = await this.dataSource.query(`SELECT *
|
|
55
55
|
FROM ${tableName}
|
|
56
|
-
WHERE id =
|
|
56
|
+
WHERE id = $1`, [id]);
|
|
57
57
|
return entityList.length > 0 ? entityList[0] : null;
|
|
58
58
|
}
|
|
59
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reflection-helper.service.js","sourceRoot":"","sources":["../../../src/utils/service/reflection-helper.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,uCAAyC;AACzC,qCAAiD;AACjD,6CAAqD;AAG9C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YACU,SAAoB,EACpB,UAAsB;QADtB,cAAS,GAAT,SAAS,CAAW;QACpB,eAAU,GAAV,UAAU,CAAY;IAEhC,CAAC;IAED,cAAc,CAAC,UAAkB;QAC/B,MAAM,cAAc,GAAQ,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,IAAI,CAC9D,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,IAAI,KAAK,UAAU;YACxB,CAAC,IAAI,CAAC,MAAM,IAAK,IAAI,CAAC,MAAc,CAAC,IAAI,KAAK,UAAU,CAAC,CAC5D,CAAC;QAEF,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,WAAW,UAAU,iCAAiC,CAAC,CAAC;YACtE,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CACvB,IAAA,4BAAkB,EAAC,cAAc,CAAC,MAAM,CAAC,EACzC,EAAE,MAAM,EAAE,KAAK,EAAE,CAClB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,mBAAmB,UAAU,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YAC1E,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAO,CAAI,QAAgB;QAC/B,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAI,QAAe,EAAE;gBACtD,MAAM,EAAE,KAAK;aACd,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,OAAO,CAAC,KAAK,CAAC,SAAS,QAAQ,2BAA2B,CAAC,CAAC;gBAC5D,OAAO,IAAI,CAAC;YACd,CAAC;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,SAAS,QAAQ,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YAC9D,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,EAAU,EAAE,SAAiB;QAC/C,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;2DACQ,SAAS;
|
|
1
|
+
{"version":3,"file":"reflection-helper.service.js","sourceRoot":"","sources":["../../../src/utils/service/reflection-helper.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,uCAAyC;AACzC,qCAAiD;AACjD,6CAAqD;AAG9C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YACU,SAAoB,EACpB,UAAsB;QADtB,cAAS,GAAT,SAAS,CAAW;QACpB,eAAU,GAAV,UAAU,CAAY;IAEhC,CAAC;IAED,cAAc,CAAC,UAAkB;QAC/B,MAAM,cAAc,GAAQ,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,IAAI,CAC9D,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,IAAI,KAAK,UAAU;YACxB,CAAC,IAAI,CAAC,MAAM,IAAK,IAAI,CAAC,MAAc,CAAC,IAAI,KAAK,UAAU,CAAC,CAC5D,CAAC;QAEF,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,WAAW,UAAU,iCAAiC,CAAC,CAAC;YACtE,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CACvB,IAAA,4BAAkB,EAAC,cAAc,CAAC,MAAM,CAAC,EACzC,EAAE,MAAM,EAAE,KAAK,EAAE,CAClB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,mBAAmB,UAAU,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YAC1E,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAO,CAAI,QAAgB;QAC/B,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAI,QAAe,EAAE;gBACtD,MAAM,EAAE,KAAK;aACd,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,OAAO,CAAC,KAAK,CAAC,SAAS,QAAQ,2BAA2B,CAAC,CAAC;gBAC5D,OAAO,IAAI,CAAC;YACd,CAAC;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,SAAS,QAAQ,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YAC9D,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,EAAU,EAAE,SAAiB;QAC/C,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;2DACQ,SAAS;kEACF,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAEtE,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACtD,CAAC;CACF,CAAA;AAvDY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAGU,gBAAS;QACR,oBAAU;GAHrB,gBAAgB,CAuD5B"}
|
package/package.json
CHANGED
|
@@ -148,7 +148,7 @@ export class SavedFilterRepositoryService {
|
|
|
148
148
|
const [filterMaster] = await this.dataSource.query(
|
|
149
149
|
`SELECT id, name, code
|
|
150
150
|
FROM frm_saved_filter_master
|
|
151
|
-
WHERE code =
|
|
151
|
+
WHERE code = $1 AND organization_id = $2
|
|
152
152
|
LIMIT 1
|
|
153
153
|
`,
|
|
154
154
|
[code, loggedInUser.organization_id],
|
|
@@ -366,7 +366,7 @@ export class FilterService {
|
|
|
366
366
|
const layoutPreference = await this.dataSource.query(
|
|
367
367
|
`SELECT mapped_json
|
|
368
368
|
FROM frm_entity_layout_pref
|
|
369
|
-
WHERE user_id =
|
|
369
|
+
WHERE user_id = $1 AND mapped_entity_type = $2 AND mapped_level_id = $3 AND mapped_level_type = $4 AND type = 'layout'`,
|
|
370
370
|
[user_id, entity_type, level_id, level_type],
|
|
371
371
|
);
|
|
372
372
|
|
|
@@ -32,8 +32,8 @@ export class WrapperService {
|
|
|
32
32
|
);
|
|
33
33
|
const configs = await this.datasource.query(
|
|
34
34
|
`SELECT * FROM frm_integration_config
|
|
35
|
-
WHERE level_id =
|
|
36
|
-
AND level_type =
|
|
35
|
+
WHERE level_id = $1
|
|
36
|
+
AND level_type = $2
|
|
37
37
|
AND status = 1
|
|
38
38
|
AND integration_type = 'EMAIL'`,
|
|
39
39
|
[level_id, level_type],
|
|
@@ -47,7 +47,7 @@ export class WrapperService {
|
|
|
47
47
|
`Looking up templateCode=${payload.templateCode} for current level`,
|
|
48
48
|
);
|
|
49
49
|
const template = await this.datasource.query(
|
|
50
|
-
`SELECT rich_text FROM frm_wf_comm_template WHERE code =
|
|
50
|
+
`SELECT rich_text FROM frm_wf_comm_template WHERE code = $1 AND level_id = $2 AND level_type = $3 LIMIT 1`,
|
|
51
51
|
[payload.templateCode, level_id, level_type],
|
|
52
52
|
);
|
|
53
53
|
this.logger.debug(
|
|
@@ -220,9 +220,9 @@ export class WrapperService {
|
|
|
220
220
|
|
|
221
221
|
templates = await this.datasource.query(
|
|
222
222
|
`SELECT id FROM frm_wf_comm_template
|
|
223
|
-
WHERE code =
|
|
223
|
+
WHERE code = $1
|
|
224
224
|
AND level_type = 'ORG'
|
|
225
|
-
AND organization_id =
|
|
225
|
+
AND organization_id = $2
|
|
226
226
|
LIMIT 1`,
|
|
227
227
|
[entity.template_code, organization_id],
|
|
228
228
|
);
|
|
@@ -393,7 +393,7 @@ export class WrapperService {
|
|
|
393
393
|
const configRes = await this.datasource.query(
|
|
394
394
|
`SELECT config_json
|
|
395
395
|
FROM frm_integration_config
|
|
396
|
-
WHERE id =
|
|
396
|
+
WHERE id = $1`,
|
|
397
397
|
[configId],
|
|
398
398
|
);
|
|
399
399
|
this.logger.debug(`Config fetch result: ${JSON.stringify(configRes)}`);
|
|
@@ -413,10 +413,11 @@ export class WrapperService {
|
|
|
413
413
|
if (payload.template_code) {
|
|
414
414
|
let templates = await this.datasource.query(
|
|
415
415
|
`SELECT id FROM frm_wf_comm_template
|
|
416
|
-
WHERE code =
|
|
417
|
-
|
|
416
|
+
WHERE code = $1
|
|
417
|
+
AND level_id = $2
|
|
418
|
+
AND level_type = $3
|
|
418
419
|
LIMIT 1`,
|
|
419
|
-
[payload.template_code],
|
|
420
|
+
[payload.template_code, levelId, levelType],
|
|
420
421
|
);
|
|
421
422
|
this.logger.log(`template by code ${JSON.stringify(payload)}`);
|
|
422
423
|
if (templates && templates.length > 0) {
|
|
@@ -192,7 +192,7 @@ export class ListMasterItemService extends EntityServiceImpl {
|
|
|
192
192
|
const data = await this.dataSource.query(
|
|
193
193
|
`SELECT name AS label, type AS value
|
|
194
194
|
FROM frm_list_master
|
|
195
|
-
WHERE organization_id =
|
|
195
|
+
WHERE organization_id = $1 AND source = $2`,
|
|
196
196
|
[loggedInUser.organization_id, source],
|
|
197
197
|
);
|
|
198
198
|
return data;
|
|
@@ -142,9 +142,9 @@ export class FieldMapperService extends EntityServiceImpl {
|
|
|
142
142
|
const relations = await this.datasource.query(
|
|
143
143
|
`SELECT target_entity_id
|
|
144
144
|
FROM frm_entity_relation_data
|
|
145
|
-
WHERE source_entity_type =
|
|
146
|
-
AND source_entity_id =
|
|
147
|
-
AND target_entity_type =
|
|
145
|
+
WHERE source_entity_type = $1
|
|
146
|
+
AND source_entity_id = $2
|
|
147
|
+
AND target_entity_type = $3`,
|
|
148
148
|
[parent_type, parent_id, field.mapped_entity_type],
|
|
149
149
|
);
|
|
150
150
|
|
|
@@ -22,7 +22,7 @@ export class MapperService extends EntityServiceImpl {
|
|
|
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 =
|
|
25
|
+
WHERE mapped_entity_type = $1 AND organization_id = $2 AND (-1 = $3 OR name LIKE $4 OR code LIKE $5)`,
|
|
26
26
|
[mappedEntityType,loggedInUser.organization_id, filter || -1, `%${filter}%`, `%${filter}%`],
|
|
27
27
|
);
|
|
28
28
|
|
|
@@ -34,7 +34,7 @@ export class MapperService extends EntityServiceImpl {
|
|
|
34
34
|
const statusMap = new Map();
|
|
35
35
|
if (distinctStatuses.length > 0) {
|
|
36
36
|
const statuses = await this.dataSource.query(
|
|
37
|
-
`SELECT id, name FROM frm_list_master_items WHERE id IN (
|
|
37
|
+
`SELECT id, name FROM frm_list_master_items WHERE id IN ($1)`,
|
|
38
38
|
[distinctStatuses],
|
|
39
39
|
);
|
|
40
40
|
statuses.forEach((status) => {
|
|
@@ -82,7 +82,7 @@ export class AttributeMasterRepository {
|
|
|
82
82
|
loggedInUser: UserData,
|
|
83
83
|
): Promise<string | null> {
|
|
84
84
|
const result = await this.dataSource.query(
|
|
85
|
-
`SELECT db_table_name FROM frm_entity_master WHERE mapped_entity_type =
|
|
85
|
+
`SELECT db_table_name FROM frm_entity_master WHERE mapped_entity_type = $1 AND organization_id = $2`,
|
|
86
86
|
[entityType, loggedInUser.organization_id],
|
|
87
87
|
);
|
|
88
88
|
return result.length ? result[0].db_table_name : null;
|
|
@@ -93,7 +93,7 @@ export class AttributeMasterRepository {
|
|
|
93
93
|
columnName: string,
|
|
94
94
|
): Promise<boolean> {
|
|
95
95
|
const result = await this.dataSource.query(
|
|
96
|
-
`SHOW COLUMNS FROM \`${tableName}\` LIKE
|
|
96
|
+
`SHOW COLUMNS FROM \`${tableName}\` LIKE $1`,
|
|
97
97
|
[columnName],
|
|
98
98
|
);
|
|
99
99
|
return result.length > 0;
|
|
@@ -55,7 +55,7 @@ export class EntityMasterRepository {
|
|
|
55
55
|
const organization_id = loggedInUser.organization_id;
|
|
56
56
|
|
|
57
57
|
const attributes = await this.dataSource.query(
|
|
58
|
-
`SELECT * FROM frm_entity_attribute WHERE mapped_entity_type =
|
|
58
|
+
`SELECT * FROM frm_entity_attribute WHERE mapped_entity_type = $1 AND data_type = 'DATE' AND organization_id = $2`,
|
|
59
59
|
[entity_type, organization_id],
|
|
60
60
|
);
|
|
61
61
|
|
|
@@ -33,7 +33,7 @@ export class EntityDynamicService {
|
|
|
33
33
|
);
|
|
34
34
|
|
|
35
35
|
const statusList = await this.dataSource.query(
|
|
36
|
-
`SELECT id FROM frm_list_master_items WHERE code =
|
|
36
|
+
`SELECT id FROM frm_list_master_items WHERE code = $1 AND organization_id = $2`,
|
|
37
37
|
[STATUS_ACTIVE, loggedInUser?.organization_id || 0],
|
|
38
38
|
);
|
|
39
39
|
|
|
@@ -55,7 +55,7 @@ export class EntityDynamicService {
|
|
|
55
55
|
const result = await this.dataSource.query(
|
|
56
56
|
`SELECT MAX(CAST(SUBSTRING(code, LENGTH(entity_type) + 1) AS UNSIGNED)) AS max_seq_no
|
|
57
57
|
FROM ${tableName}
|
|
58
|
-
WHERE entity_type =
|
|
58
|
+
WHERE entity_type = $1`,
|
|
59
59
|
[entityData.entity_type],
|
|
60
60
|
);
|
|
61
61
|
|
|
@@ -148,7 +148,7 @@ export class EntityDynamicService {
|
|
|
148
148
|
const organizationId = loggedInUser.organization_id;
|
|
149
149
|
|
|
150
150
|
const getRelation = await this.dataSource.query(
|
|
151
|
-
`SELECT * FROM frm_entity_relation WHERE organization_id =
|
|
151
|
+
`SELECT * FROM frm_entity_relation WHERE organization_id = $1 AND source_entity_type = $2`,
|
|
152
152
|
[organizationId, entityType],
|
|
153
153
|
);
|
|
154
154
|
|
|
@@ -189,7 +189,7 @@ export class EntityDynamicService {
|
|
|
189
189
|
);
|
|
190
190
|
|
|
191
191
|
await this.dataSource.query(
|
|
192
|
-
`INSERT INTO frm_entity_relation_data (organization_id, source_entity_id, source_entity_type, target_entity_id, target_entity_type, relation_type) VALUES (
|
|
192
|
+
`INSERT INTO frm_entity_relation_data (organization_id, source_entity_id, source_entity_type, target_entity_id, target_entity_type, relation_type) VALUES ($1, $2, $3, $4, $5, $6)`,
|
|
193
193
|
[
|
|
194
194
|
organizationId,
|
|
195
195
|
mainID,
|
|
@@ -225,8 +225,8 @@ export class EntityDynamicService {
|
|
|
225
225
|
);
|
|
226
226
|
|
|
227
227
|
const relatedEntities = await this.dataSource.query(
|
|
228
|
-
`SELECT * FROM frm_entity_relation_data WHERE source_entity_id =
|
|
229
|
-
SELECT target_entity_type FROM frm_entity_relation WHERE source_entity_type =
|
|
228
|
+
`SELECT * FROM frm_entity_relation_data WHERE source_entity_id = $1 AND target_entity_type IN (
|
|
229
|
+
SELECT target_entity_type FROM frm_entity_relation WHERE source_entity_type = $2)`,
|
|
230
230
|
[id, entityType],
|
|
231
231
|
);
|
|
232
232
|
|
|
@@ -297,7 +297,7 @@ export class EntityDynamicService {
|
|
|
297
297
|
|
|
298
298
|
if (mappedEntities) {
|
|
299
299
|
const getRelationDefs = await this.dataSource.query(
|
|
300
|
-
`SELECT * FROM frm_entity_relation WHERE organization_id =
|
|
300
|
+
`SELECT * FROM frm_entity_relation WHERE organization_id = $1 AND source_entity_type = $2`,
|
|
301
301
|
[organizationId, entityType],
|
|
302
302
|
);
|
|
303
303
|
|
|
@@ -316,7 +316,7 @@ export class EntityDynamicService {
|
|
|
316
316
|
|
|
317
317
|
// Delete previous relations and related entities
|
|
318
318
|
const existingRelationsForType = await this.dataSource.query(
|
|
319
|
-
`SELECT * FROM frm_entity_relation_data WHERE source_entity_type =
|
|
319
|
+
`SELECT * FROM frm_entity_relation_data WHERE source_entity_type = $1 AND source_entity_id = $2 AND target_entity_type = $3`,
|
|
320
320
|
[entityType, id, targetEntityType],
|
|
321
321
|
);
|
|
322
322
|
|
|
@@ -375,7 +375,7 @@ export class EntityDynamicService {
|
|
|
375
375
|
await this.dataSource.query(
|
|
376
376
|
`INSERT INTO frm_entity_relation_data
|
|
377
377
|
(organization_id, source_entity_id, source_entity_type, target_entity_id, target_entity_type, relation_type)
|
|
378
|
-
VALUES (
|
|
378
|
+
VALUES ($1, $2, $3, $4, $5, $6)`,
|
|
379
379
|
[
|
|
380
380
|
organizationId,
|
|
381
381
|
id,
|
|
@@ -517,7 +517,7 @@ export class EntityDynamicService {
|
|
|
517
517
|
throw new Error('No valid attributes to update.');
|
|
518
518
|
}
|
|
519
519
|
|
|
520
|
-
const updateQuery = `UPDATE \`${tableName}\` SET ${updates.join(', ')} WHERE id =
|
|
520
|
+
const updateQuery = `UPDATE \`${tableName}\` SET ${updates.join(', ')} WHERE id = $1`;
|
|
521
521
|
values.push(id); // Add id for WHERE clause
|
|
522
522
|
|
|
523
523
|
const result = await this.dataSource.query(updateQuery, values);
|
|
@@ -544,7 +544,7 @@ export class EntityDynamicService {
|
|
|
544
544
|
const columns = validAttributes
|
|
545
545
|
.map((attr) => `\`${attr.attribute_key}\``)
|
|
546
546
|
.join(', ');
|
|
547
|
-
const selectQuery = `SELECT ${columns} FROM \`${dataSource}\` WHERE id =
|
|
547
|
+
const selectQuery = `SELECT ${columns} FROM \`${dataSource}\` WHERE id = $1`;
|
|
548
548
|
|
|
549
549
|
const result = await this.dataSource.query(selectQuery, [id]);
|
|
550
550
|
if (!result.length) return null;
|
|
@@ -596,7 +596,7 @@ export class EntityDynamicService {
|
|
|
596
596
|
const columns = validAttributes
|
|
597
597
|
.map((attr) => `\`${attr.attribute_key}\``)
|
|
598
598
|
.join(', ');
|
|
599
|
-
const selectQuery = `SELECT ${columns} FROM \`${tableName}\` WHERE id =
|
|
599
|
+
const selectQuery = `SELECT ${columns} FROM \`${tableName}\` WHERE id = $1`;
|
|
600
600
|
|
|
601
601
|
const result = await this.dataSource.query(selectQuery, [id]);
|
|
602
602
|
if (!result.length) return null;
|
|
@@ -632,7 +632,7 @@ export class EntityDynamicService {
|
|
|
632
632
|
organizationId: string,
|
|
633
633
|
): Promise<string> {
|
|
634
634
|
const result = await this.dataSource.query(
|
|
635
|
-
`SELECT data_source, db_table_name FROM frm_entity_master WHERE organization_id =
|
|
635
|
+
`SELECT data_source, db_table_name FROM frm_entity_master WHERE organization_id = $1 AND mapped_entity_type = $2`,
|
|
636
636
|
[organizationId, entityType],
|
|
637
637
|
);
|
|
638
638
|
if (!result.length) {
|
|
@@ -648,7 +648,7 @@ export class EntityDynamicService {
|
|
|
648
648
|
organizationId: string,
|
|
649
649
|
): Promise<string> {
|
|
650
650
|
const result = await this.dataSource.query(
|
|
651
|
-
`SELECT db_table_name FROM frm_entity_master WHERE organization_id =
|
|
651
|
+
`SELECT db_table_name FROM frm_entity_master WHERE organization_id = $1 AND mapped_entity_type = $2`,
|
|
652
652
|
[organizationId, entityType],
|
|
653
653
|
);
|
|
654
654
|
|
|
@@ -713,7 +713,7 @@ export class EntityDynamicService {
|
|
|
713
713
|
|
|
714
714
|
const tableName = await this.getTableName(entityType, organizationId);
|
|
715
715
|
|
|
716
|
-
const deleteQuery = `DELETE FROM \`${tableName}\` WHERE id =
|
|
716
|
+
const deleteQuery = `DELETE FROM \`${tableName}\` WHERE id = $1`;
|
|
717
717
|
const result = await this.dataSource.query(deleteQuery, [id]);
|
|
718
718
|
return result;
|
|
719
719
|
}
|
|
@@ -726,11 +726,11 @@ export class EntityDynamicService {
|
|
|
726
726
|
): Promise<any> {
|
|
727
727
|
const organizationId = loggedInUser.organization_id;
|
|
728
728
|
|
|
729
|
-
let query = `SELECT name as label,mapped_entity_type as value FROM frm_entity_master WHERE organization_id =
|
|
729
|
+
let query = `SELECT name as label,mapped_entity_type as value FROM frm_entity_master WHERE organization_id = $1`;
|
|
730
730
|
const params = [organizationId];
|
|
731
731
|
|
|
732
732
|
if (appcode) {
|
|
733
|
-
query += ` AND appcode =
|
|
733
|
+
query += ` AND appcode = $2`;
|
|
734
734
|
params.push(appcode);
|
|
735
735
|
}
|
|
736
736
|
|
|
@@ -745,7 +745,7 @@ export class EntityDynamicService {
|
|
|
745
745
|
const result = await this.dataSource.query(
|
|
746
746
|
`SELECT db_table_name
|
|
747
747
|
FROM frm_entity_master
|
|
748
|
-
WHERE mapped_entity_type =
|
|
748
|
+
WHERE mapped_entity_type = $1 AND organization_id = $2`,
|
|
749
749
|
[entityType, organizationId],
|
|
750
750
|
);
|
|
751
751
|
|
|
@@ -761,7 +761,7 @@ export class EntityDynamicService {
|
|
|
761
761
|
const seqResult = await this.dataSource.query(
|
|
762
762
|
`SELECT MAX(CAST(SUBSTRING(code, LENGTH(entity_type) + 1) AS UNSIGNED)) AS max_seq_no
|
|
763
763
|
FROM \`${tableName}\`
|
|
764
|
-
WHERE entity_type =
|
|
764
|
+
WHERE entity_type = $1`,
|
|
765
765
|
[entityType],
|
|
766
766
|
);
|
|
767
767
|
|
|
@@ -91,8 +91,8 @@ export class EntityMasterService {
|
|
|
91
91
|
const attributes = await this.dataSource.query(
|
|
92
92
|
`SELECT *
|
|
93
93
|
FROM frm_entity_attribute
|
|
94
|
-
WHERE mapped_entity_type =
|
|
95
|
-
AND organization_id =
|
|
94
|
+
WHERE mapped_entity_type = $1
|
|
95
|
+
AND organization_id = $2 `,
|
|
96
96
|
[entityMasterData.mapped_entity_type, loggedInUser.organization_id],
|
|
97
97
|
);
|
|
98
98
|
|
|
@@ -16,7 +16,7 @@ export class EntityRelationService extends EntityServiceImpl {
|
|
|
16
16
|
const relations = await this.dataSource.query(
|
|
17
17
|
`SELECT name as label, target_entity_type as value, id
|
|
18
18
|
FROM frm_entity_relation
|
|
19
|
-
WHERE source_entity_type =
|
|
19
|
+
WHERE source_entity_type = $1 AND organization_id = $2`,
|
|
20
20
|
[entityType, loggedInUser.organization_id],
|
|
21
21
|
);
|
|
22
22
|
|
|
@@ -24,7 +24,7 @@ export class EntityRelationService extends EntityServiceImpl {
|
|
|
24
24
|
const [entity] = await this.dataSource.query(
|
|
25
25
|
`SELECT name as label
|
|
26
26
|
FROM frm_entity_master
|
|
27
|
-
WHERE mapped_entity_type =
|
|
27
|
+
WHERE mapped_entity_type = $1 AND organization_id = $2`,
|
|
28
28
|
[entityType, loggedInUser.organization_id],
|
|
29
29
|
);
|
|
30
30
|
|
|
@@ -53,10 +53,10 @@ export class EntityRelationService extends EntityServiceImpl {
|
|
|
53
53
|
`
|
|
54
54
|
SELECT DISTINCT source_entity_id
|
|
55
55
|
FROM frm_entity_relation_data
|
|
56
|
-
WHERE source_entity_type =
|
|
57
|
-
AND target_entity_type =
|
|
58
|
-
AND target_entity_id IN (
|
|
59
|
-
AND organization_id =
|
|
56
|
+
WHERE source_entity_type = $1
|
|
57
|
+
AND target_entity_type = $2
|
|
58
|
+
AND target_entity_id IN ($3)
|
|
59
|
+
AND organization_id = $4
|
|
60
60
|
`,
|
|
61
61
|
[sourceEntity, targetEntity, targetIds, orgId],
|
|
62
62
|
);
|
|
@@ -198,7 +198,7 @@ export class MediaDataService extends EntityServiceImpl {
|
|
|
198
198
|
|
|
199
199
|
// --- ORG ---
|
|
200
200
|
let organizationData = await this.dataSource.query(
|
|
201
|
-
'SELECT * FROM sso_organization WHERE id =
|
|
201
|
+
'SELECT * FROM sso_organization WHERE id = $1',
|
|
202
202
|
[loggedInUser.organization_id],
|
|
203
203
|
);
|
|
204
204
|
replacements['org_code'] = organizationData[0].code;
|
|
@@ -222,13 +222,13 @@ export class MediaDataService extends EntityServiceImpl {
|
|
|
222
222
|
|
|
223
223
|
// Get entity data for level_code
|
|
224
224
|
const getEntityData = await this.dataSource.query(
|
|
225
|
-
`SELECT * FROM cr_entity_master WHERE mapped_entity_type =
|
|
225
|
+
`SELECT * FROM cr_entity_master WHERE mapped_entity_type = $1 and organization_id = $2`,
|
|
226
226
|
[levelEntityType, loggedInUser.organization_id],
|
|
227
227
|
);
|
|
228
228
|
|
|
229
229
|
if (getEntityData.length == 0) return null;
|
|
230
230
|
const levelEntityDataResult = await this.dataSource.query(
|
|
231
|
-
`SELECT * FROM ${getEntityData[0]?.db_table_name} WHERE id =
|
|
231
|
+
`SELECT * FROM ${getEntityData[0]?.db_table_name} WHERE id = $1`,
|
|
232
232
|
[levelEntityId],
|
|
233
233
|
);
|
|
234
234
|
|
|
@@ -270,13 +270,13 @@ export class MediaDataService extends EntityServiceImpl {
|
|
|
270
270
|
|
|
271
271
|
// Get entity data for level_code
|
|
272
272
|
const getEntityData = await this.dataSource.query(
|
|
273
|
-
`SELECT * FROM cr_entity_master WHERE mapped_entity_type =
|
|
273
|
+
`SELECT * FROM cr_entity_master WHERE mapped_entity_type = $1 and organization_id = $2`,
|
|
274
274
|
[mappedEntityType, loggedInUser.organization_id],
|
|
275
275
|
);
|
|
276
276
|
|
|
277
277
|
if (getEntityData.length == 0) return null;
|
|
278
278
|
const levelEntityDataResult = await this.dataSource.query(
|
|
279
|
-
`SELECT * FROM ${getEntityData[0]?.db_table_name} WHERE id =
|
|
279
|
+
`SELECT * FROM ${getEntityData[0]?.db_table_name} WHERE id = $1`,
|
|
280
280
|
[mappedEntityId],
|
|
281
281
|
);
|
|
282
282
|
|
|
@@ -290,13 +290,13 @@ export class MediaDataService extends EntityServiceImpl {
|
|
|
290
290
|
pathTemplate = '${org_code}/template/${template_code}';
|
|
291
291
|
} else {
|
|
292
292
|
const getEntityData = await this.dataSource.query(
|
|
293
|
-
`SELECT * FROM cr_entity_master WHERE mapped_entity_type =
|
|
293
|
+
`SELECT * FROM cr_entity_master WHERE mapped_entity_type = $1 and organization_id = $2`,
|
|
294
294
|
[mappedEntityType, loggedInUser.organization_id],
|
|
295
295
|
);
|
|
296
296
|
|
|
297
297
|
if (getEntityData.length == 0) return null;
|
|
298
298
|
const levelEntityDataResult = await this.dataSource.query(
|
|
299
|
-
`SELECT * FROM ${getEntityData[0]?.db_table_name} WHERE id =
|
|
299
|
+
`SELECT * FROM ${getEntityData[0]?.db_table_name} WHERE id = $1`,
|
|
300
300
|
[mappedEntityId],
|
|
301
301
|
);
|
|
302
302
|
|
|
@@ -418,11 +418,11 @@ export class MediaDataService extends EntityServiceImpl {
|
|
|
418
418
|
});
|
|
419
419
|
} else {
|
|
420
420
|
organizationData = await this.dataSource.query(
|
|
421
|
-
'SELECT * FROM adm_org_profile WHERE id =
|
|
421
|
+
'SELECT * FROM adm_org_profile WHERE id = $1',
|
|
422
422
|
[loggedInUser.organization_id],
|
|
423
423
|
);
|
|
424
424
|
levelData = await this.dataSource.query(
|
|
425
|
-
'SELECT * FROM adm_school_profile WHERE id =
|
|
425
|
+
'SELECT * FROM adm_school_profile WHERE id = $1',
|
|
426
426
|
[loggedInUser.level_id],
|
|
427
427
|
);
|
|
428
428
|
}
|
|
@@ -32,7 +32,7 @@ export class ResolverService {
|
|
|
32
32
|
entityType: string,
|
|
33
33
|
): Promise<any> {
|
|
34
34
|
const attributeItems = await this.dataSource.query(
|
|
35
|
-
`SELECT * FROM frm_entity_attribute WHERE mapped_entity_type =
|
|
35
|
+
`SELECT * FROM frm_entity_attribute WHERE mapped_entity_type = $1 AND organization_id = $2`,
|
|
36
36
|
[entityType, loggedInUser.organization_id],
|
|
37
37
|
);
|
|
38
38
|
|
|
@@ -129,7 +129,7 @@ export class ResolverService {
|
|
|
129
129
|
|
|
130
130
|
// fetch attribute meta only for the given attributeKey
|
|
131
131
|
const [attr] = await this.dataSource.query(
|
|
132
|
-
`SELECT * FROM frm_entity_attribute WHERE mapped_entity_type =
|
|
132
|
+
`SELECT * FROM frm_entity_attribute WHERE mapped_entity_type = $1 AND organization_id = $2 AND attribute_key = $3`,
|
|
133
133
|
[entityType, loggedInUser.organization_id, attrKey],
|
|
134
134
|
);
|
|
135
135
|
|
|
@@ -138,7 +138,7 @@ export class ResolverService {
|
|
|
138
138
|
// -------- ENTITY data_source_type --------
|
|
139
139
|
if (attr.data_source_type === 'entity') {
|
|
140
140
|
const [entityDef] = await this.dataSource.query(
|
|
141
|
-
`SELECT * FROM frm_entity_master WHERE mapped_entity_type =
|
|
141
|
+
`SELECT * FROM frm_entity_master WHERE mapped_entity_type = $1 AND organization_id = $2`,
|
|
142
142
|
[attr.datasource_list, loggedInUser.organization_id],
|
|
143
143
|
);
|
|
144
144
|
|
|
@@ -151,8 +151,8 @@ export class ResolverService {
|
|
|
151
151
|
for (const code of rawValue) {
|
|
152
152
|
const query =
|
|
153
153
|
tableName === 'sso_organization'
|
|
154
|
-
? `SELECT * FROM ${tableName} WHERE code =
|
|
155
|
-
: `SELECT * FROM ${tableName} WHERE id =
|
|
154
|
+
? `SELECT * FROM ${tableName} WHERE code = $1`
|
|
155
|
+
: `SELECT * FROM ${tableName} WHERE id = $1 AND organization_id = $2`;
|
|
156
156
|
|
|
157
157
|
const params =
|
|
158
158
|
tableName === 'sso_organization'
|
|
@@ -166,8 +166,8 @@ export class ResolverService {
|
|
|
166
166
|
} else {
|
|
167
167
|
const query =
|
|
168
168
|
tableName === 'sso_organization'
|
|
169
|
-
? `SELECT * FROM ${tableName} WHERE id =
|
|
170
|
-
: `SELECT * FROM ${tableName} WHERE id =
|
|
169
|
+
? `SELECT * FROM ${tableName} WHERE id = $1`
|
|
170
|
+
: `SELECT * FROM ${tableName} WHERE id = $1 AND organization_id = $2`;
|
|
171
171
|
|
|
172
172
|
const params =
|
|
173
173
|
tableName === 'sso_organization'
|
|
@@ -185,7 +185,7 @@ export class ResolverService {
|
|
|
185
185
|
const resolvedValues: string[] = [];
|
|
186
186
|
for (const code of rawValue) {
|
|
187
187
|
const [item] = await this.dataSource.query(
|
|
188
|
-
`SELECT * FROM frm_list_master_items WHERE id =
|
|
188
|
+
`SELECT * FROM frm_list_master_items WHERE id = $1 AND organization_id = $2`,
|
|
189
189
|
[code, loggedInUser.organization_id],
|
|
190
190
|
);
|
|
191
191
|
resolvedValues.push(item?.[attr.data_source_attribute] ?? code);
|
|
@@ -193,7 +193,7 @@ export class ResolverService {
|
|
|
193
193
|
return resolvedValues;
|
|
194
194
|
} else {
|
|
195
195
|
const [item] = await this.dataSource.query(
|
|
196
|
-
`SELECT * FROM frm_list_master_items WHERE id =
|
|
196
|
+
`SELECT * FROM frm_list_master_items WHERE id = $1 AND organization_id = $2`,
|
|
197
197
|
[rawValue, loggedInUser.organization_id],
|
|
198
198
|
);
|
|
199
199
|
return item?.[attr.data_source_attribute] ?? rawValue;
|
|
@@ -220,7 +220,7 @@ export class ResolverService {
|
|
|
220
220
|
// fetch attribute meta
|
|
221
221
|
const [attr] = await this.dataSource.query(
|
|
222
222
|
`SELECT * FROM frm_entity_attribute
|
|
223
|
-
WHERE mapped_entity_type =
|
|
223
|
+
WHERE mapped_entity_type = $1 AND organization_id = $2 AND attribute_key = $3`,
|
|
224
224
|
[entityType, loggedInUser.organization_id, attrKey],
|
|
225
225
|
);
|
|
226
226
|
|
|
@@ -230,7 +230,7 @@ export class ResolverService {
|
|
|
230
230
|
if (attr.data_source_type === 'entity') {
|
|
231
231
|
const [entityDef] = await this.dataSource.query(
|
|
232
232
|
`SELECT * FROM frm_entity_master
|
|
233
|
-
WHERE mapped_entity_type =
|
|
233
|
+
WHERE mapped_entity_type = $1 AND organization_id = $2`,
|
|
234
234
|
[attr.datasource_list, loggedInUser.organization_id],
|
|
235
235
|
);
|
|
236
236
|
|
|
@@ -240,8 +240,8 @@ export class ResolverService {
|
|
|
240
240
|
|
|
241
241
|
const query =
|
|
242
242
|
tableName === 'sso_organization'
|
|
243
|
-
? `SELECT id FROM ${tableName} WHERE ${attr.data_source_attribute} =
|
|
244
|
-
: `SELECT id FROM ${tableName} WHERE ${attr.data_source_attribute} =
|
|
243
|
+
? `SELECT id FROM ${tableName} WHERE ${attr.data_source_attribute} = $1`
|
|
244
|
+
: `SELECT id FROM ${tableName} WHERE ${attr.data_source_attribute} = $1 AND organization_id = $2`;
|
|
245
245
|
|
|
246
246
|
const params =
|
|
247
247
|
tableName === 'sso_organization'
|
|
@@ -256,7 +256,7 @@ export class ResolverService {
|
|
|
256
256
|
else if (attr.data_source_type === 'master') {
|
|
257
257
|
const [item] = await this.dataSource.query(
|
|
258
258
|
`SELECT id FROM frm_list_master_items
|
|
259
|
-
WHERE ${attr.data_source_attribute} =
|
|
259
|
+
WHERE ${attr.data_source_attribute} = $1 AND organization_id = $2 AND listtype = $3`,
|
|
260
260
|
[displayValue, loggedInUser.organization_id, attr.datasource_list],
|
|
261
261
|
);
|
|
262
262
|
return item?.id ?? displayValue;
|
|
@@ -151,7 +151,7 @@ export class NotificationsService {
|
|
|
151
151
|
const query = `
|
|
152
152
|
UPDATE frm_notification
|
|
153
153
|
SET is_read = 1
|
|
154
|
-
WHERE user_id =
|
|
154
|
+
WHERE user_id = $1 AND level_id = $2 AND level_type = $3 AND is_read = 0
|
|
155
155
|
`;
|
|
156
156
|
|
|
157
157
|
const params = [id, level_id, level_type];
|
|
@@ -239,7 +239,7 @@ export class LoginService {
|
|
|
239
239
|
const brandId = brnAccesses[0].level_id;
|
|
240
240
|
|
|
241
241
|
const rows = await this.dataSource.query(
|
|
242
|
-
`SELECT id FROM sso_school WHERE brand_id =
|
|
242
|
+
`SELECT id FROM sso_school WHERE brand_id = $1 ORDER BY id ASC LIMIT 1`,
|
|
243
243
|
[brandId],
|
|
244
244
|
);
|
|
245
245
|
|
|
@@ -92,7 +92,7 @@ export class UserSessionService {
|
|
|
92
92
|
// Check if user has any role mappings for the given appcode
|
|
93
93
|
getUserDetails = await this.dataSource.query(
|
|
94
94
|
`
|
|
95
|
-
SELECT * from sso_user where id =
|
|
95
|
+
SELECT * from sso_user where id = $1
|
|
96
96
|
`,
|
|
97
97
|
[currentUser.id],
|
|
98
98
|
);
|
|
@@ -103,7 +103,7 @@ export class UserSessionService {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
await this.dataSource.query(
|
|
106
|
-
`UPDATE sso_user SET last_app_access =
|
|
106
|
+
`UPDATE sso_user SET last_app_access = $1 , last_level_type = $2, last_level_id = $3 WHERE id = $4`,
|
|
107
107
|
[data.appcode, data.level_type, data.level_id, currentUser.id],
|
|
108
108
|
);
|
|
109
109
|
|
|
@@ -150,7 +150,7 @@ export class UserSessionService {
|
|
|
150
150
|
//DONE
|
|
151
151
|
// If BRN, resolve first SCH under this brand
|
|
152
152
|
const schools = await this.dataSource.query(
|
|
153
|
-
`SELECT id FROM sso_school WHERE brand_id =
|
|
153
|
+
`SELECT id FROM sso_school WHERE brand_id = $1 ORDER BY id ASC LIMIT 1`,
|
|
154
154
|
[mapping.level_id],
|
|
155
155
|
);
|
|
156
156
|
|
|
@@ -40,7 +40,7 @@ export class ActionDataRepository extends EntityServiceImpl {
|
|
|
40
40
|
if (action.length > 0) {
|
|
41
41
|
for (const act of action) {
|
|
42
42
|
const is_mandatory = await this.dataSource.query(
|
|
43
|
-
`SELECT code FROM frm_list_master_items WHERE id =
|
|
43
|
+
`SELECT code FROM frm_list_master_items WHERE id = $1 and organization_id = $2 LIMIT 1;`,
|
|
44
44
|
[act.action_requirement, loggedInUser.organization_id],
|
|
45
45
|
);
|
|
46
46
|
const isFirst = act.sequence == minSequence;
|
|
@@ -100,13 +100,13 @@ export class ActionDataRepository extends EntityServiceImpl {
|
|
|
100
100
|
// THEN INSERT SDFM IN RELATION TASK TABLE
|
|
101
101
|
|
|
102
102
|
let relationData = await this.dataSource.query(
|
|
103
|
-
`SELECT * FROM frm_entity_relation WHERE source_entity_type =
|
|
103
|
+
`SELECT * FROM frm_entity_relation WHERE source_entity_type = $1 AND target_entity_type = $2`,
|
|
104
104
|
[createdEntity.mapped_entity_type, createdEntity.entity_type],
|
|
105
105
|
);
|
|
106
106
|
|
|
107
107
|
if (relationData) {
|
|
108
108
|
await this.dataSource.query(
|
|
109
|
-
`INSERT INTO frm_entity_relation_data (organization_id, source_entity_id, source_entity_type, target_entity_id, target_entity_type, relation_type) VALUES (
|
|
109
|
+
`INSERT INTO frm_entity_relation_data (organization_id, source_entity_id, source_entity_type, target_entity_id, target_entity_type, relation_type) VALUES ($1, $2, $3, $4, $5,$6)`,
|
|
110
110
|
[
|
|
111
111
|
loggedInUser.organization_id,
|
|
112
112
|
createdEntity.mapped_entity_id,
|
|
@@ -256,7 +256,7 @@ export class ActionDataRepository extends EntityServiceImpl {
|
|
|
256
256
|
|
|
257
257
|
// Reset status (optional: set to something like 'pending' if needed)
|
|
258
258
|
const pendingListMasterItemId = await this.dataSource.query(
|
|
259
|
-
`SELECT id FROM frm_list_master_items WHERE code = 'in_progress' AND organization_id =
|
|
259
|
+
`SELECT id FROM frm_list_master_items WHERE code = 'in_progress' AND organization_id = $1 AND listtype = 'TKST' LIMIT 1;`,
|
|
260
260
|
[organization_id],
|
|
261
261
|
);
|
|
262
262
|
task.status = pendingListMasterItemId[0]?.id ?? task.status;
|