rez_core 3.1.1 → 3.1.2
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/entity-relation.controller.d.ts +1 -1
- package/dist/module/meta/controller/entity-relation.controller.js +6 -4
- package/dist/module/meta/controller/entity-relation.controller.js.map +1 -1
- package/dist/module/meta/service/entity-relation.service.d.ts +1 -1
- package/dist/module/meta/service/entity-relation.service.js +16 -2
- package/dist/module/meta/service/entity-relation.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/meta/controller/entity-relation.controller.ts +5 -0
- package/src/module/meta/service/entity-relation.service.ts +23 -3
|
@@ -2,5 +2,5 @@ import { EntityRelationService } from '../service/entity-relation.service';
|
|
|
2
2
|
export declare class EntityRelationController {
|
|
3
3
|
private readonly entityRelationService;
|
|
4
4
|
constructor(entityRelationService: EntityRelationService);
|
|
5
|
-
getEntityRelations(sourceEntityType: string, req: any): Promise<any>;
|
|
5
|
+
getEntityRelations(sourceEntityType: string, include: string, req: any): Promise<any>;
|
|
6
6
|
}
|
|
@@ -20,18 +20,20 @@ let EntityRelationController = class EntityRelationController {
|
|
|
20
20
|
constructor(entityRelationService) {
|
|
21
21
|
this.entityRelationService = entityRelationService;
|
|
22
22
|
}
|
|
23
|
-
async getEntityRelations(sourceEntityType, req) {
|
|
23
|
+
async getEntityRelations(sourceEntityType, include, req) {
|
|
24
24
|
const loggedInUser = req.user.userData;
|
|
25
|
-
|
|
25
|
+
const shouldIncludeSelf = include === 'true';
|
|
26
|
+
return this.entityRelationService.getEntityRelations(sourceEntityType, loggedInUser, shouldIncludeSelf);
|
|
26
27
|
}
|
|
27
28
|
};
|
|
28
29
|
exports.EntityRelationController = EntityRelationController;
|
|
29
30
|
__decorate([
|
|
30
31
|
(0, common_1.Get)(':source_entity_type'),
|
|
31
32
|
__param(0, (0, common_1.Param)('source_entity_type')),
|
|
32
|
-
__param(1, (0, common_1.
|
|
33
|
+
__param(1, (0, common_1.Query)('include')),
|
|
34
|
+
__param(2, (0, common_1.Request)()),
|
|
33
35
|
__metadata("design:type", Function),
|
|
34
|
-
__metadata("design:paramtypes", [String, Object]),
|
|
36
|
+
__metadata("design:paramtypes", [String, String, Object]),
|
|
35
37
|
__metadata("design:returntype", Promise)
|
|
36
38
|
], EntityRelationController.prototype, "getEntityRelations", null);
|
|
37
39
|
exports.EntityRelationController = EntityRelationController = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-relation.controller.js","sourceRoot":"","sources":["../../../../src/module/meta/controller/entity-relation.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"entity-relation.controller.js","sourceRoot":"","sources":["../../../../src/module/meta/controller/entity-relation.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAQwB;AACxB,2DAA2D;AAC3D,gFAA2E;AAIpE,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACnC,YAEmB,qBAA4C;QAA5C,0BAAqB,GAArB,qBAAqB,CAAuB;IAC5D,CAAC;IAGE,AAAN,KAAK,CAAC,kBAAkB,CACO,gBAAwB,EACnC,OAAe,EACtB,GAAQ;QAEnB,MAAM,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;QACvC,MAAM,iBAAiB,GAAG,OAAO,KAAK,MAAM,CAAC;QAE7C,OAAO,IAAI,CAAC,qBAAqB,CAAC,kBAAkB,CAClD,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,CAClB,CAAC;IACJ,CAAC;CACF,CAAA;AArBY,4DAAwB;AAO7B;IADL,IAAA,YAAG,EAAC,qBAAqB,CAAC;IAExB,WAAA,IAAA,cAAK,EAAC,oBAAoB,CAAC,CAAA;IAC3B,WAAA,IAAA,cAAK,EAAC,SAAS,CAAC,CAAA;IAChB,WAAA,IAAA,gBAAO,GAAE,CAAA;;;;kEAUX;mCApBU,wBAAwB;IAFpC,IAAA,kBAAS,EAAC,wBAAY,CAAC;IACvB,IAAA,mBAAU,EAAC,iBAAiB,CAAC;IAGzB,WAAA,IAAA,eAAM,EAAC,uBAAuB,CAAC,CAAA;qCACQ,+CAAqB;GAHpD,wBAAwB,CAqBpC"}
|
|
@@ -3,6 +3,6 @@ import { DataSource } from 'typeorm';
|
|
|
3
3
|
export declare class EntityRelationService extends EntityServiceImpl {
|
|
4
4
|
private readonly dataSource;
|
|
5
5
|
constructor(dataSource: DataSource);
|
|
6
|
-
getEntityRelations(entityType: string, loggedInUser: any): Promise<any>;
|
|
6
|
+
getEntityRelations(entityType: string, loggedInUser: any, includeSelf?: boolean): Promise<any>;
|
|
7
7
|
getRelatedEntityIds(sourceEntity: string, targetEntity: string, targetIds: number[], orgId: number): Promise<number[]>;
|
|
8
8
|
}
|
|
@@ -18,8 +18,22 @@ let EntityRelationService = class EntityRelationService extends entity_service_i
|
|
|
18
18
|
super();
|
|
19
19
|
this.dataSource = dataSource;
|
|
20
20
|
}
|
|
21
|
-
async getEntityRelations(entityType, loggedInUser) {
|
|
22
|
-
const relations = await this.dataSource.query(`SELECT name as label
|
|
21
|
+
async getEntityRelations(entityType, loggedInUser, includeSelf = false) {
|
|
22
|
+
const relations = await this.dataSource.query(`SELECT name as label, target_entity_type as value, id
|
|
23
|
+
FROM cr_entity_relation
|
|
24
|
+
WHERE source_entity_type = ? AND organization_id = ?`, [entityType, loggedInUser.organization_id]);
|
|
25
|
+
if (includeSelf) {
|
|
26
|
+
const [entity] = await this.dataSource.query(`SELECT name as label
|
|
27
|
+
FROM cr_entity_master
|
|
28
|
+
WHERE mapped_entity_type = ? AND organization_id = ?`, [entityType, loggedInUser.organization_id]);
|
|
29
|
+
if (entity) {
|
|
30
|
+
relations.unshift({
|
|
31
|
+
label: entity.label,
|
|
32
|
+
value: entityType,
|
|
33
|
+
id: null,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
23
37
|
return relations;
|
|
24
38
|
}
|
|
25
39
|
async getRelatedEntityIds(sourceEntity, targetEntity, targetIds, orgId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-relation.service.js","sourceRoot":"","sources":["../../../../src/module/meta/service/entity-relation.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,+EAAkE;AAClE,qCAAqC;AAG9B,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,+CAAiB;IAC1D,YAA6B,UAAsB;QACjD,KAAK,EAAE,CAAC;QADmB,eAAU,GAAV,UAAU,CAAY;IAEnD,CAAC;IAED,KAAK,CAAC,kBAAkB,CACtB,UAAkB,EAClB,YAAiB;
|
|
1
|
+
{"version":3,"file":"entity-relation.service.js","sourceRoot":"","sources":["../../../../src/module/meta/service/entity-relation.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,+EAAkE;AAClE,qCAAqC;AAG9B,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,+CAAiB;IAC1D,YAA6B,UAAsB;QACjD,KAAK,EAAE,CAAC;QADmB,eAAU,GAAV,UAAU,CAAY;IAEnD,CAAC;IAED,KAAK,CAAC,kBAAkB,CACtB,UAAkB,EAClB,YAAiB,EACjB,WAAW,GAAG,KAAK;QAEnB,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAC3C;;4DAEsD,EACtD,CAAC,UAAU,EAAE,YAAY,CAAC,eAAe,CAAC,CAC3C,CAAC;QAEF,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAC1C;;8DAEsD,EACtD,CAAC,UAAU,EAAE,YAAY,CAAC,eAAe,CAAC,CAC3C,CAAC;YAEF,IAAI,MAAM,EAAE,CAAC;gBACX,SAAS,CAAC,OAAO,CAAC;oBAChB,KAAK,EAAE,MAAM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