@acorex/connectivity 21.0.0-next.24 → 21.0.0-next.31
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/fesm2022/{acorex-connectivity-api-execute.command-Di850KiF.mjs → acorex-connectivity-api-execute.command-CiBl7z_H.mjs} +4 -4
- package/fesm2022/acorex-connectivity-api-execute.command-CiBl7z_H.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-api.mjs +37 -37
- package/fesm2022/acorex-connectivity-api.mjs.map +1 -1
- package/fesm2022/acorex-connectivity-mock-acorex-connectivity-mock-G8Opk5JU.mjs +65509 -0
- package/fesm2022/acorex-connectivity-mock-acorex-connectivity-mock-G8Opk5JU.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-assign-to-manager.activity-DTPM1eU1.mjs +79 -0
- package/fesm2022/acorex-connectivity-mock-assign-to-manager.activity-DTPM1eU1.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-category-metadata-inheritance.query-CWRL1dTa.mjs +198 -0
- package/fesm2022/acorex-connectivity-mock-category-metadata-inheritance.query-CWRL1dTa.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-category-with-items.query-KB7GIYeb.mjs → acorex-connectivity-mock-category-with-items.query-Cj6FWu7S.mjs} +4 -4
- package/fesm2022/acorex-connectivity-mock-category-with-items.query-Cj6FWu7S.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-chat-generate-image.command-CPGQNlRz.mjs +114 -0
- package/fesm2022/acorex-connectivity-mock-chat-generate-image.command-CPGQNlRz.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-chat-synthesize-speech.command-BXem7bHF.mjs +130 -0
- package/fesm2022/acorex-connectivity-mock-chat-synthesize-speech.command-BXem7bHF.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-chat-transcribe-speech.command-TP4dUKlp.mjs +110 -0
- package/fesm2022/acorex-connectivity-mock-chat-transcribe-speech.command-TP4dUKlp.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-check-permission.command-C-AZTcHP.mjs → acorex-connectivity-mock-check-permission.activity-vr3OHtjC.mjs} +8 -16
- package/fesm2022/acorex-connectivity-mock-check-permission.activity-vr3OHtjC.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-complete-signature-process.activity-BO-IFsHT.mjs +56 -0
- package/fesm2022/acorex-connectivity-mock-complete-signature-process.activity-BO-IFsHT.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-contact-core.module-5TLCGWOR.mjs +968 -0
- package/fesm2022/acorex-connectivity-mock-contact-core.module-5TLCGWOR.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-content-management.module-GQdqKsPB.mjs +16 -0
- package/fesm2022/acorex-connectivity-mock-content-management.module-GQdqKsPB.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-distribution-record.command-DMoZvago.mjs → acorex-connectivity-mock-distribution-record.activity-DuNluOzA.mjs} +18 -6
- package/fesm2022/acorex-connectivity-mock-distribution-record.activity-DuNluOzA.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-entity-create.activity-Ca19tIj4.mjs +60 -0
- package/fesm2022/acorex-connectivity-mock-entity-create.activity-Ca19tIj4.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-entity-delete.activity-ErEN1c24.mjs +60 -0
- package/fesm2022/acorex-connectivity-mock-entity-delete.activity-ErEN1c24.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-entity-read.activity-1fJW8gVe.mjs +67 -0
- package/fesm2022/acorex-connectivity-mock-entity-read.activity-1fJW8gVe.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-entity-update.activity-D0hyBha-.mjs +70 -0
- package/fesm2022/acorex-connectivity-mock-entity-update.activity-D0hyBha-.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-extract-document-text.command-nGfUTSf6.mjs +64 -0
- package/fesm2022/acorex-connectivity-mock-extract-document-text.command-nGfUTSf6.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-application-versions-chart-data.query-B1TrIBvU.mjs → acorex-connectivity-mock-get-application-versions-chart-data.query-DwVuYuKx.mjs} +4 -4
- package/fesm2022/acorex-connectivity-mock-get-application-versions-chart-data.query-DwVuYuKx.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-application-versions-timeline.query-CvNjA4OH.mjs → acorex-connectivity-mock-get-application-versions-timeline.query-sFKYynZA.mjs} +4 -4
- package/fesm2022/acorex-connectivity-mock-get-application-versions-timeline.query-sFKYynZA.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-get-current-session-user.activity-C6S4ZJgp.mjs +35 -0
- package/fesm2022/acorex-connectivity-mock-get-current-session-user.activity-C6S4ZJgp.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-get-current-user-manager.activity-C1mj2bgB.mjs +69 -0
- package/fesm2022/acorex-connectivity-mock-get-current-user-manager.activity-C1mj2bgB.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-employee-list.query--f2M5RgC.mjs → acorex-connectivity-mock-get-employee-list.query-DifHwuqH.mjs} +4 -4
- package/fesm2022/acorex-connectivity-mock-get-employee-list.query-DifHwuqH.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-location-list.query-Cz55arFF.mjs → acorex-connectivity-mock-get-location-list.query-bMjkZnzq.mjs} +4 -4
- package/fesm2022/acorex-connectivity-mock-get-location-list.query-bMjkZnzq.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-product-chart-data.query-C7v7D4ep.mjs → acorex-connectivity-mock-get-product-chart-data.query-D7DBzLT-.mjs} +4 -4
- package/fesm2022/acorex-connectivity-mock-get-product-chart-data.query-D7DBzLT-.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-product-list.query-DTj8RYwR.mjs → acorex-connectivity-mock-get-product-list.query-B06aC73T.mjs} +11 -6
- package/fesm2022/acorex-connectivity-mock-get-product-list.query-B06aC73T.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-product-pdf-data.query-DdLhRbP5.mjs → acorex-connectivity-mock-get-product-pdf-data.query-CM7bsjl7.mjs} +5 -5
- package/fesm2022/acorex-connectivity-mock-get-product-pdf-data.query-CM7bsjl7.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-subscriptions-chart-data.query-ybmzmVl5.mjs → acorex-connectivity-mock-get-subscriptions-chart-data.query-BQT5a_hn.mjs} +5 -5
- package/fesm2022/acorex-connectivity-mock-get-subscriptions-chart-data.query-BQT5a_hn.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-subscriptions-timeline.query-kciEUx7d.mjs → acorex-connectivity-mock-get-subscriptions-timeline.query-D4qfDfeV.mjs} +4 -4
- package/fesm2022/acorex-connectivity-mock-get-subscriptions-timeline.query-D4qfDfeV.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-tenant-application-access.query-BDfrwf5Z.mjs → acorex-connectivity-mock-get-tenant-application-access.query-n1_Azada.mjs} +4 -4
- package/fesm2022/acorex-connectivity-mock-get-tenant-application-access.query-n1_Azada.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-tenant-registration-chart-data.query-BD4T2loB.mjs → acorex-connectivity-mock-get-tenant-registration-chart-data.query-Cg4ykZU2.mjs} +5 -5
- package/fesm2022/acorex-connectivity-mock-get-tenant-registration-chart-data.query-Cg4ykZU2.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-tenant-registration-timeline.query-CMJ8W3Ns.mjs → acorex-connectivity-mock-get-tenant-registration-timeline.query-0sCBtdbp.mjs} +4 -4
- package/fesm2022/acorex-connectivity-mock-get-tenant-registration-timeline.query-0sCBtdbp.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-get-tenant-user-distribution.query-C-gCUjbX.mjs → acorex-connectivity-mock-get-tenant-user-distribution.query-rD811gtM.mjs} +4 -4
- package/fesm2022/acorex-connectivity-mock-get-tenant-user-distribution.query-rD811gtM.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-if.activity-DvzuhItL.mjs +35 -0
- package/fesm2022/acorex-connectivity-mock-if.activity-DvzuhItL.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-notify-signers.activity-Dg0sKGip.mjs +49 -0
- package/fesm2022/acorex-connectivity-mock-notify-signers.activity-Dg0sKGip.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-request-signature.activity-CoRT_H2u.mjs +60 -0
- package/fesm2022/acorex-connectivity-mock-request-signature.activity-CoRT_H2u.mjs.map +1 -0
- package/fesm2022/{acorex-connectivity-mock-sample.command-CyrjdvEA.mjs → acorex-connectivity-mock-sample.command-CJmDL4pL.mjs} +4 -4
- package/fesm2022/acorex-connectivity-mock-sample.command-CJmDL4pL.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-structured-text-completion.command-l31pjl9-.mjs +38 -0
- package/fesm2022/acorex-connectivity-mock-structured-text-completion.command-l31pjl9-.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock-validate-all-signatures.activity-JuHjNFFS.mjs +61 -0
- package/fesm2022/acorex-connectivity-mock-validate-all-signatures.activity-JuHjNFFS.mjs.map +1 -0
- package/fesm2022/acorex-connectivity-mock.mjs +1 -66525
- package/fesm2022/acorex-connectivity-mock.mjs.map +1 -1
- package/fesm2022/acorex-connectivity-utils.mjs +7 -7
- package/fesm2022/acorex-connectivity-utils.mjs.map +1 -1
- package/fesm2022/acorex-connectivity.mjs.map +1 -1
- package/package.json +8 -7
- package/{mock/index.d.ts → types/acorex-connectivity-mock.d.ts} +2154 -1310
- package/fesm2022/acorex-connectivity-api-execute.command-Di850KiF.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-assign-to-manager.command-T6-ao4e9.mjs +0 -66
- package/fesm2022/acorex-connectivity-mock-assign-to-manager.command-T6-ao4e9.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-category-with-items.query-KB7GIYeb.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-check-permission.command-C-AZTcHP.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-complete-signature-process.command-CHci1rOa.mjs +0 -80
- package/fesm2022/acorex-connectivity-mock-complete-signature-process.command-CHci1rOa.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-distribution-record.command-DMoZvago.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-application-versions-chart-data.query-B1TrIBvU.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-application-versions-timeline.query-CvNjA4OH.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-employee-list.query--f2M5RgC.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-location-list.query-Cz55arFF.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-product-chart-data.query-C7v7D4ep.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-product-list.query-DTj8RYwR.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-product-pdf-data.query-DdLhRbP5.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-subscriptions-chart-data.query-ybmzmVl5.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-subscriptions-timeline.query-kciEUx7d.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-tenant-application-access.query-BDfrwf5Z.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-tenant-registration-chart-data.query-BD4T2loB.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-tenant-registration-timeline.query-CMJ8W3Ns.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-get-tenant-user-distribution.query-C-gCUjbX.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-notify-signers.command-DLMsWjWQ.mjs +0 -69
- package/fesm2022/acorex-connectivity-mock-notify-signers.command-DLMsWjWQ.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-request-signature.command-JNkj9-Yz.mjs +0 -72
- package/fesm2022/acorex-connectivity-mock-request-signature.command-JNkj9-Yz.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-sample.command-CyrjdvEA.mjs.map +0 -1
- package/fesm2022/acorex-connectivity-mock-validate-all-signatures.command-xKr94NrA.mjs +0 -81
- package/fesm2022/acorex-connectivity-mock-validate-all-signatures.command-xKr94NrA.mjs.map +0 -1
- /package/{api/index.d.ts → types/acorex-connectivity-api.d.ts} +0 -0
- /package/{utils/index.d.ts → types/acorex-connectivity-utils.d.ts} +0 -0
- /package/{index.d.ts → types/acorex-connectivity.d.ts} +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, Injectable } from '@angular/core';
|
|
3
|
+
import { AXPEntityStorageService } from '@acorex/platform/layout/entity';
|
|
4
|
+
import { AXPSessionService } from '@acorex/platform/auth';
|
|
5
|
+
|
|
6
|
+
const EMPLOYEE_ENTITY = 'HumanCapitalManagement.Employee';
|
|
7
|
+
/**
|
|
8
|
+
* Get Current User Manager Activity (Backend - Mock)
|
|
9
|
+
*
|
|
10
|
+
* Resolves the manager of the current user (Employee → managerId → manager's userId).
|
|
11
|
+
* Use when assigning a review task to the current user's manager (e.g. questionnaire review)
|
|
12
|
+
* without a leave request or other ref entity.
|
|
13
|
+
*
|
|
14
|
+
* Execution Mode: backend
|
|
15
|
+
* Activity Type: workflow-activity:get-current-user-manager
|
|
16
|
+
*/
|
|
17
|
+
class GetCurrentUserManagerActivity {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.entityStorage = inject(AXPEntityStorageService);
|
|
20
|
+
this.sessionService = inject(AXPSessionService);
|
|
21
|
+
}
|
|
22
|
+
async execute() {
|
|
23
|
+
let managerId = null;
|
|
24
|
+
const userId = this.sessionService.user?.id;
|
|
25
|
+
if (userId) {
|
|
26
|
+
try {
|
|
27
|
+
const result = await this.entityStorage.query(EMPLOYEE_ENTITY, {
|
|
28
|
+
skip: 0,
|
|
29
|
+
take: 1,
|
|
30
|
+
filter: {
|
|
31
|
+
field: 'userId',
|
|
32
|
+
operator: { type: 'equal' },
|
|
33
|
+
value: userId,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
const employees = result.items;
|
|
37
|
+
const employee = employees?.[0];
|
|
38
|
+
const managerEmployeeId = employee?.managerId;
|
|
39
|
+
if (managerEmployeeId) {
|
|
40
|
+
const managerEmp = (await this.entityStorage.getOne(EMPLOYEE_ENTITY, managerEmployeeId));
|
|
41
|
+
managerId = managerEmp?.userId ?? managerEmployeeId;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// keep managerId null
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
success: true,
|
|
50
|
+
data: {
|
|
51
|
+
managerId,
|
|
52
|
+
},
|
|
53
|
+
metadata: {
|
|
54
|
+
outcome: 'Done',
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetCurrentUserManagerActivity, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
59
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetCurrentUserManagerActivity, providedIn: 'root' }); }
|
|
60
|
+
}
|
|
61
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetCurrentUserManagerActivity, decorators: [{
|
|
62
|
+
type: Injectable,
|
|
63
|
+
args: [{
|
|
64
|
+
providedIn: 'root',
|
|
65
|
+
}]
|
|
66
|
+
}] });
|
|
67
|
+
|
|
68
|
+
export { GetCurrentUserManagerActivity };
|
|
69
|
+
//# sourceMappingURL=acorex-connectivity-mock-get-current-user-manager.activity-C1mj2bgB.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-get-current-user-manager.activity-C1mj2bgB.mjs","sources":["../../../../libs/connectivity/mock/src/lib/workflow-management/activities/get-current-user-manager.activity.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { AXPExecuteCommandResult } from '@acorex/platform/core';\nimport { AXPCommand } from '@acorex/platform/runtime';\nimport { AXPEntityStorageService } from '@acorex/platform/layout/entity';\nimport { AXPSessionService } from '@acorex/platform/auth';\n\nconst EMPLOYEE_ENTITY = 'HumanCapitalManagement.Employee';\n\nexport interface GetCurrentUserManagerOutput {\n managerId: string | null;\n}\n\n/**\n * Get Current User Manager Activity (Backend - Mock)\n *\n * Resolves the manager of the current user (Employee → managerId → manager's userId).\n * Use when assigning a review task to the current user's manager (e.g. questionnaire review)\n * without a leave request or other ref entity.\n *\n * Execution Mode: backend\n * Activity Type: workflow-activity:get-current-user-manager\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class GetCurrentUserManagerActivity implements AXPCommand<Record<string, never>, GetCurrentUserManagerOutput> {\n private readonly entityStorage = inject(AXPEntityStorageService);\n private readonly sessionService = inject(AXPSessionService);\n\n async execute(): Promise<AXPExecuteCommandResult<GetCurrentUserManagerOutput>> {\n let managerId: string | null = null;\n const userId = this.sessionService.user?.id;\n\n if (userId) {\n try {\n const result = await this.entityStorage.query(EMPLOYEE_ENTITY, {\n skip: 0,\n take: 1,\n filter: {\n field: 'userId',\n operator: { type: 'equal' },\n value: userId,\n },\n });\n const employees = result.items as { id: string; managerId?: string | null }[] | undefined;\n const employee = employees?.[0];\n const managerEmployeeId = employee?.managerId;\n\n if (managerEmployeeId) {\n const managerEmp = (await this.entityStorage.getOne(EMPLOYEE_ENTITY, managerEmployeeId)) as {\n userId?: string;\n } | null;\n managerId = managerEmp?.userId ?? managerEmployeeId;\n }\n } catch {\n // keep managerId null\n }\n }\n\n return {\n success: true,\n data: {\n managerId,\n },\n metadata: {\n outcome: 'Done',\n },\n };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AA;AACD,YAAA,QAAQ,EAAE;AACR,gBAAA,OAAO,EAAE,MAAM;AAChB,aAAA;SACF;IACH;8GA3CW,6BAA6B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA7B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,6BAA6B,cAF5B,MAAM,EAAA,CAAA,CAAA;;2FAEP,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBAHzC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
|
|
@@ -199,10 +199,10 @@ class GetEmployeeListQuery {
|
|
|
199
199
|
}
|
|
200
200
|
return filters;
|
|
201
201
|
}
|
|
202
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
203
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
202
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetEmployeeListQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
203
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetEmployeeListQuery, providedIn: 'root' }); }
|
|
204
204
|
}
|
|
205
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
205
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetEmployeeListQuery, decorators: [{
|
|
206
206
|
type: Injectable,
|
|
207
207
|
args: [{
|
|
208
208
|
providedIn: 'root',
|
|
@@ -210,4 +210,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
210
210
|
}] });
|
|
211
211
|
|
|
212
212
|
export { GetEmployeeListQuery };
|
|
213
|
-
//# sourceMappingURL=acorex-connectivity-mock-get-employee-list.query
|
|
213
|
+
//# sourceMappingURL=acorex-connectivity-mock-get-employee-list.query-DifHwuqH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-get-employee-list.query-DifHwuqH.mjs","sources":["../../../../libs/connectivity/mock/src/lib/report-management/samples/get-employee-list.query.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXMHumanCapitalManagementEmployeeEntityModel } from '@acorex/modules/human-capital-management';\nimport { RootConfig as HumanCapitalRootConfig } from '@acorex/modules/human-capital-management';\nimport { RootConfig as OrganizationRootConfig } from '@acorex/modules/organization-management';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetEmployeeListQueryInput {\n skip?: number;\n take?: number;\n sort?: Array<{ field: string; dir: 'asc' | 'desc' }>;\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface EmployeeByDepartmentResult {\n departmentId: string;\n departmentTitle: string;\n teamId?: string;\n teamTitle?: string;\n employeeCount: number;\n employmentTypes: string;\n averageExperience: number;\n totalEmployees: number;\n}\n\nexport interface GetEmployeeListQueryResult {\n items: EmployeeByDepartmentResult[];\n total: number;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetEmployeeListQuery implements AXPQuery<GetEmployeeListQueryInput, GetEmployeeListQueryResult> {\n private readonly entityService = inject(AXPEntityService);\n private employeeService = this.entityService\n .withEntity(`${HumanCapitalRootConfig.module.name}.${HumanCapitalRootConfig.entities.employee.name}`)\n .data<string, AXMHumanCapitalManagementEmployeeEntityModel>();\n\n async fetch(input: GetEmployeeListQueryInput | any): Promise<GetEmployeeListQueryResult> {\n // Extract employee-specific filters from AXPFilterClause format\n const extractedFilters = this.extractEmployeeFilters(input.filters);\n\n // Separate custom filters from entity filters\n const entityFilters: GetEmployeeListQueryInput['filters'] = [];\n\n if (extractedFilters && extractedFilters.length > 0) {\n for (const filter of extractedFilters) {\n entityFilters.push(filter);\n }\n }\n\n // Get all employees from storage with entity filters\n const allEmployeesResult = await this.employeeService.query({\n skip: 0,\n take: 10000, // Get all employees for aggregation\n filter:\n entityFilters.length > 0\n ? ({\n logic: input.logic || 'and',\n filters: entityFilters,\n } as any)\n : undefined,\n });\n\n const allEmployees = allEmployeesResult.items;\n\n // Group employees by department and team\n const departmentGroups = new Map<string, Map<string, AXMHumanCapitalManagementEmployeeEntityModel[]>>();\n\n for (const employee of allEmployees) {\n // Get department from position (assuming position has departmentId)\n const departmentId = (employee as any).position?.departmentId || (employee as any).departmentId || 'unknown';\n const departmentTitle = (employee as any).position?.department?.title || 'Unknown Department';\n\n // Get team from team memberships (assuming employee has teamId or teamMemberships)\n const teamId = (employee as any).teamId || (employee as any).teamMemberships?.[0]?.teamId || undefined;\n const teamTitle = (employee as any).team?.title || (employee as any).teamMemberships?.[0]?.team?.title || undefined;\n\n const teamKey = teamId || 'no-team';\n\n if (!departmentGroups.has(departmentId)) {\n departmentGroups.set(departmentId, new Map());\n }\n\n const teamMap = departmentGroups.get(departmentId)!;\n if (!teamMap.has(teamKey)) {\n teamMap.set(teamKey, []);\n }\n\n teamMap.get(teamKey)!.push(employee);\n }\n\n // Aggregate data by department and team\n const aggregatedResults: EmployeeByDepartmentResult[] = [];\n\n for (const [departmentId, teamMap] of departmentGroups.entries()) {\n const firstEmployee = Array.from(teamMap.values())[0]?.[0];\n const departmentTitle = (firstEmployee as any)?.position?.department?.title || 'Unknown Department';\n\n for (const [teamKey, employees] of teamMap.entries()) {\n const teamId = teamKey !== 'no-team' ? teamKey : undefined;\n const teamTitle =\n teamKey !== 'no-team' ? (employees[0] as any)?.team?.title || (employees[0] as any)?.teamMemberships?.[0]?.team?.title : undefined;\n\n // Calculate average experience (years since hire date)\n const now = new Date();\n const experiences = employees\n .map((emp) => {\n if (!emp.hireDate) return 0;\n const hireDate = new Date(emp.hireDate);\n const diffTime = Math.abs(now.getTime() - hireDate.getTime());\n return diffTime / (1000 * 60 * 60 * 24 * 365.25); // Convert to years\n })\n .filter((exp) => exp > 0);\n\n const averageExperience = experiences.length > 0 ? experiences.reduce((sum, exp) => sum + exp, 0) / experiences.length : 0;\n\n // Get unique employment types\n const employmentTypeSet = new Set<string>();\n for (const employee of employees) {\n if ((employee as any).employmentType?.title) {\n employmentTypeSet.add((employee as any).employmentType.title);\n }\n }\n const employmentTypes = Array.from(employmentTypeSet).join(', ') || 'N/A';\n\n aggregatedResults.push({\n departmentId,\n departmentTitle,\n teamId,\n teamTitle,\n employeeCount: employees.length,\n employmentTypes,\n averageExperience: Number(averageExperience.toFixed(2)),\n totalEmployees: employees.length,\n });\n }\n }\n\n // Apply sorting if provided\n if (input.sort && input.sort.length > 0) {\n aggregatedResults.sort((a, b) => {\n for (const sortField of input.sort!) {\n const field = sortField.field as keyof EmployeeByDepartmentResult;\n const aValue = a[field];\n const bValue = b[field];\n const dir = sortField.dir === 'asc' ? 1 : -1;\n\n // Handle undefined values\n if (aValue === undefined && bValue === undefined) continue;\n if (aValue === undefined) return 1 * dir;\n if (bValue === undefined) return -1 * dir;\n\n if (aValue < bValue) return -1 * dir;\n if (aValue > bValue) return 1 * dir;\n }\n return 0;\n });\n }\n\n // Apply pagination\n const skip = input.skip || 0;\n const take = input.take || 10;\n const total = aggregatedResults.length;\n const items = aggregatedResults.slice(skip, skip + take);\n\n return {\n items,\n total,\n };\n }\n\n //#region ---- Filter Extraction ----\n\n /**\n * Extract employee-specific filters from AXPFilterClause format\n * Maps report parameter paths to employee entity field names\n */\n private extractEmployeeFilters(parameters: any): GetEmployeeListQueryInput['filters'] {\n const filters: GetEmployeeListQueryInput['filters'] = [];\n const paramsAny = parameters as any;\n\n if (!paramsAny?.filters || !Array.isArray(paramsAny.filters)) {\n return filters;\n }\n\n for (const filter of paramsAny.filters) {\n if (!filter?.field || filter?.value === undefined || filter?.value === null) {\n continue;\n }\n\n const field = filter.field;\n const value = filter.value;\n const operator = filter.operator || { type: 'equal' };\n\n // Handle employee-specific field mappings\n if (field === 'department') {\n // Department filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'position.departmentId', // Assuming position has departmentId\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'position.departmentId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'team') {\n // Team filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'teamId', // Assuming employee has teamId or teamMemberships\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'teamId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'employmentType') {\n // Employment type filter - skip 'all' value\n if (value && value !== 'all') {\n filters.push({\n field: 'employmentTypeId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else {\n // Direct field mapping\n filters.push({\n field: field,\n operator: operator,\n value: value,\n });\n }\n }\n\n return filters;\n }\n\n //#endregion\n}\n"],"names":["HumanCapitalRootConfig"],"mappings":";;;;;AAqCA;MAKa,oBAAoB,CAAA;AAHjC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACjD,IAAA,CAAA,eAAe,GAAG,IAAI,CAAC;AAC5B,aAAA,UAAU,CAAC,CAAA,EAAGA,UAAsB,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAIA,UAAsB,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE;AACnG,aAAA,IAAI,EAAwD;AAqNhE,IAAA;IAnNC,MAAM,KA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AAM,EAAA,CAAA,CAAA;;2FAEP,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAHhC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
|
|
@@ -195,10 +195,10 @@ class GetLocationListQuery {
|
|
|
195
195
|
}
|
|
196
196
|
return filters;
|
|
197
197
|
}
|
|
198
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
199
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
198
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetLocationListQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
199
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetLocationListQuery, providedIn: 'root' }); }
|
|
200
200
|
}
|
|
201
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
201
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetLocationListQuery, decorators: [{
|
|
202
202
|
type: Injectable,
|
|
203
203
|
args: [{
|
|
204
204
|
providedIn: 'root',
|
|
@@ -206,4 +206,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
206
206
|
}] });
|
|
207
207
|
|
|
208
208
|
export { GetLocationListQuery };
|
|
209
|
-
//# sourceMappingURL=acorex-connectivity-mock-get-location-list.query-
|
|
209
|
+
//# sourceMappingURL=acorex-connectivity-mock-get-location-list.query-bMjkZnzq.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-get-location-list.query-bMjkZnzq.mjs","sources":["../../../../libs/connectivity/mock/src/lib/report-management/samples/get-location-list.query.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXMLocationManagementLocationEntityModel } from '@acorex/modules/location-management';\nimport { RootConfig as LocationRootConfig } from '@acorex/modules/location-management';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetLocationListQueryInput {\n skip?: number;\n take?: number;\n sort?: Array<{ field: string; dir: 'asc' | 'desc' }>;\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface LocationByCityResult {\n countryId?: string;\n countryTitle?: string;\n provinceId?: string;\n provinceTitle?: string;\n cityId?: string;\n cityTitle?: string;\n locationCount: number;\n totalLocations: number;\n}\n\nexport interface GetLocationListQueryResult {\n items: LocationByCityResult[];\n total: number;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetLocationListQuery implements AXPQuery<GetLocationListQueryInput, GetLocationListQueryResult> {\n private readonly entityService = inject(AXPEntityService);\n private locationService = this.entityService\n .withEntity(`${LocationRootConfig.module.name}.${LocationRootConfig.entities.location.name}`)\n .data<string, AXMLocationManagementLocationEntityModel>();\n\n async fetch(input: GetLocationListQueryInput | any): Promise<GetLocationListQueryResult> {\n // Extract location-specific filters from AXPFilterClause format\n const extractedFilters = this.extractLocationFilters(input.filters);\n // Separate custom filters from entity filters\n const entityFilters: GetLocationListQueryInput['filters'] = [];\n\n if (extractedFilters && extractedFilters.length > 0) {\n for (const filter of extractedFilters) {\n entityFilters.push(filter);\n }\n }\n // Get all locations from storage with entity filters\n const allLocationsResult = await this.locationService.query({\n skip: 0,\n take: 10000, // Get all locations for aggregation\n filter:\n entityFilters.length > 0\n ? ({\n logic: input.logic || 'and',\n filters: entityFilters,\n } as any)\n : undefined,\n });\n\n const allLocations = allLocationsResult.items;\n\n // Group locations by country, province, and city\n const locationGroups = new Map<string, Map<string, Map<string, AXMLocationManagementLocationEntityModel[]>>>();\n\n for (const location of allLocations) {\n // Get geographic information\n const countryId = (location as any).countryId || 'unknown';\n const countryTitle = (location as any).country?.title || 'Unknown Country';\n\n const provinceId = (location as any).stateId || 'unknown';\n const provinceTitle = (location as any).state?.title || 'Unknown Province';\n\n const cityId = (location as any).cityId || 'unknown';\n const cityTitle = (location as any).city?.title || 'Unknown City';\n\n // Create nested map structure: country -> province -> city -> locations[]\n if (!locationGroups.has(countryId)) {\n locationGroups.set(countryId, new Map());\n }\n\n const provinceMap = locationGroups.get(countryId)!;\n if (!provinceMap.has(provinceId)) {\n provinceMap.set(provinceId, new Map());\n }\n\n const cityMap = provinceMap.get(provinceId)!;\n if (!cityMap.has(cityId)) {\n cityMap.set(cityId, []);\n }\n\n cityMap.get(cityId)!.push(location);\n }\n\n // Aggregate data by country, province, and city\n const aggregatedResults: LocationByCityResult[] = [];\n\n for (const [countryId, provinceMap] of locationGroups.entries()) {\n const firstLocation = Array.from(provinceMap.values())[0]?.values().next().value?.[0];\n const countryTitle = (firstLocation as any)?.country?.title || 'Unknown Country';\n\n for (const [provinceId, cityMap] of provinceMap.entries()) {\n const firstLocationInProvince = cityMap.values().next().value?.[0];\n const provinceTitle = (firstLocationInProvince as any)?.state?.title || 'Unknown Province';\n\n for (const [cityId, locations] of cityMap.entries()) {\n const cityTitle = (locations[0] as any)?.city?.title || 'Unknown City';\n\n aggregatedResults.push({\n countryId,\n countryTitle,\n provinceId,\n provinceTitle,\n cityId,\n cityTitle,\n locationCount: locations.length,\n totalLocations: locations.length,\n });\n }\n }\n }\n\n // Apply sorting if provided\n if (input.sort && input.sort.length > 0) {\n aggregatedResults.sort((a, b) => {\n for (const sortField of input.sort!) {\n const field = sortField.field as keyof LocationByCityResult;\n const aValue = a[field];\n const bValue = b[field];\n const dir = sortField.dir === 'asc' ? 1 : -1;\n\n // Handle undefined values\n if (aValue === undefined && bValue === undefined) continue;\n if (aValue === undefined) return 1 * dir;\n if (bValue === undefined) return -1 * dir;\n\n if (aValue < bValue) return -1 * dir;\n if (aValue > bValue) return 1 * dir;\n }\n return 0;\n });\n }\n\n // Apply pagination\n const skip = input.skip || 0;\n const take = input.take || 10;\n const total = aggregatedResults.length;\n const items = aggregatedResults.slice(skip, skip + take);\n\n return {\n items,\n total,\n };\n }\n\n //#region ---- Filter Extraction ----\n\n /**\n * Extract location-specific filters from AXPFilterClause format\n * Maps report parameter paths to location entity field names\n */\n private extractLocationFilters(parameters: any): GetLocationListQueryInput['filters'] {\n const filters: GetLocationListQueryInput['filters'] = [];\n const paramsAny = parameters as any;\n\n if (!paramsAny?.filters || !Array.isArray(paramsAny.filters)) {\n console.log('⚠️ [extractLocationFilters] No filters array found or not an array');\n return filters;\n }\n\n\n for (const filter of paramsAny.filters) {\n if (!filter?.field || filter?.value === undefined || filter?.value === null) {\n continue;\n }\n\n const field = filter.field;\n const value = filter.value;\n const operator = filter.operator || { type: 'equal' };\n\n // Handle location-specific field mappings\n if (field === 'country') {\n // Country filter\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'countryId',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'countryId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'province') {\n // Province/State filter\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'stateId',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'stateId',\n operator: { type: 'equal' },\n value: value,\n });\n console.log('✅ [extractLocationFilters] Added province filter (equal):', value);\n }\n } else if (field === 'city') {\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'cityId',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'cityId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else {\n // Direct field mapping\n filters.push({\n field: field,\n operator: operator,\n value: value,\n });\n }\n }\n\n return filters;\n }\n\n //#endregion\n}\n"],"names":["LocationRootConfig"],"mappings":";;;;;AAoCA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
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
176
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
175
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetProductChartDataQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
176
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetProductChartDataQuery, providedIn: 'root' }); }
|
|
177
177
|
}
|
|
178
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
178
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetProductChartDataQuery, decorators: [{
|
|
179
179
|
type: Injectable,
|
|
180
180
|
args: [{
|
|
181
181
|
providedIn: 'root',
|
|
@@ -183,4 +183,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
183
183
|
}] });
|
|
184
184
|
|
|
185
185
|
export { GetProductChartDataQuery };
|
|
186
|
-
//# sourceMappingURL=acorex-connectivity-mock-get-product-chart-data.query-
|
|
186
|
+
//# sourceMappingURL=acorex-connectivity-mock-get-product-chart-data.query-D7DBzLT-.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-get-product-chart-data.query-D7DBzLT-.mjs","sources":["../../../../libs/connectivity/mock/src/lib/product-catalog/reports/get-product-chart-data.query.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXMProductCatalogProductEntityModel } from '@acorex/modules/product-catalog';\nimport { RootConfig } from '@acorex/modules/product-catalog';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetProductChartDataQueryInput {\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface ProductChartDataResult {\n brand: string;\n productCount: number;\n}\n\nexport interface GetProductChartDataQueryResult {\n items: ProductChartDataResult[];\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetProductChartDataQuery implements AXPQuery<GetProductChartDataQueryInput, GetProductChartDataQueryResult> {\n private readonly entityService = inject(AXPEntityService);\n private productService = this.entityService.withEntity(`${RootConfig.module.name}.${RootConfig.entities.product.name}`).data<string, AXMProductCatalogProductEntityModel>();\n\n async fetch(input: GetProductChartDataQueryInput | any): Promise<GetProductChartDataQueryResult> {\n // Extract product-specific filters from AXPFilterClause format\n const extractedFilters = this.extractProductFilters(input.filters);\n\n // Separate custom filters from entity filters\n const entityFilters: GetProductChartDataQueryInput['filters'] = [];\n let priceRangeFilter: string | undefined;\n\n if (extractedFilters && extractedFilters.length > 0) {\n for (const filter of extractedFilters) {\n if (filter.field === 'priceRange') {\n priceRangeFilter = filter.value;\n } else {\n entityFilters.push(filter);\n }\n }\n }\n\n // Get all products from storage with entity filters (no pagination for charts)\n const allProductsResult = await this.productService.query({\n skip: 0,\n take: 10000, // Get all products for aggregation\n filter:\n entityFilters.length > 0\n ? ({\n logic: input.logic || 'and',\n filters: entityFilters,\n } as any)\n : undefined,\n });\n\n let allProducts = allProductsResult.items;\n\n // Apply custom price range filter after fetching\n if (priceRangeFilter && priceRangeFilter !== 'all') {\n allProducts = this.applyPriceRangeFilter(allProducts, priceRangeFilter);\n }\n\n // Group products by brand\n const brandGroups = new Map<string, AXMProductCatalogProductEntityModel[]>();\n\n for (const product of allProducts) {\n const brandKey = product.brand?.title || product.brandId || 'Unknown';\n\n if (!brandGroups.has(brandKey)) {\n brandGroups.set(brandKey, []);\n }\n\n brandGroups.get(brandKey)!.push(product);\n }\n\n // Aggregate data by brand for chart\n const chartResults: ProductChartDataResult[] = [];\n\n for (const [brandName, products] of brandGroups.entries()) {\n chartResults.push({\n brand: brandName,\n productCount: products.length,\n });\n }\n\n return {\n items: chartResults,\n };\n }\n\n //#region ---- Filter Extraction ----\n\n /**\n * Extract product-specific filters from AXPFilterClause format\n * Maps report parameter paths to product entity field names\n */\n private extractProductFilters(parameters: any): GetProductChartDataQueryInput['filters'] {\n const filters: GetProductChartDataQueryInput['filters'] = [];\n const paramsAny = parameters as any;\n\n if (!paramsAny?.filters || !Array.isArray(paramsAny.filters)) {\n return filters;\n }\n\n for (const filter of paramsAny.filters) {\n if (!filter?.field || filter?.value === undefined || filter?.value === null) {\n continue;\n }\n\n const field = filter.field;\n const value = filter.value;\n const operator = filter.operator || { type: 'equal' };\n\n // Handle product-specific field mappings\n if (field === 'brand') {\n // Brand filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'brandId',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'brandId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'category') {\n // Category filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'categoryIds',\n operator: { type: 'contains' },\n value: value[0], // Use first category for contains check\n });\n } else if (value) {\n filters.push({\n field: 'categoryIds',\n operator: { type: 'contains' },\n value: value,\n });\n }\n } else if (field === 'status') {\n // Status filter - skip 'all' value\n if (value && value !== 'all') {\n filters.push({\n field: 'statusId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'priceRange') {\n // Price range filter - custom logic handled in query\n filters.push({\n field: 'priceRange',\n operator: { type: 'equal' },\n value: value,\n });\n } else if (field === 'startDate' || field === 'endDate') {\n // Date filters - can be handled if needed\n // For now, skip as they might not be directly on product entity\n } else {\n // Direct field mapping\n filters.push({\n field: field,\n operator: operator,\n value: value,\n });\n }\n }\n\n return filters;\n }\n\n //#endregion\n\n //#region ---- Custom Filter Handlers ----\n\n /**\n * Apply custom price range filter to products\n */\n private applyPriceRangeFilter(\n products: AXMProductCatalogProductEntityModel[],\n priceRange: string\n ): AXMProductCatalogProductEntityModel[] {\n return products.filter((product) => {\n const price = product.basePrice || 0;\n\n switch (priceRange) {\n case 'under-50':\n return price < 50;\n case '50-100':\n return price >= 50 && price < 100;\n case '100-500':\n return price >= 100 && price < 500;\n case '500-1000':\n return price >= 500 && price < 1000;\n case 'over-1000':\n return price >= 1000;\n default:\n return true;\n }\n });\n }\n\n //#endregion\n}\n\n"],"names":[],"mappings":";;;;;AA0BA;MAKa,wBAAwB,CAAA;AAHrC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACjD,IAAA,CAAA,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAA,EAAG,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAA,CAAE,CAAC,CAAC,IAAI,EAA+C;AA0L5K,IAAA;IAxLC,MAAM,KAAK,CAAC,KAA0C,EAAA;;QAEpD,MAAM,gBAAgB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,OAAO,CAAC;;QAGlE,MAAM,aAAa,GAA6C,EAAE;AAClE,QAAA,IAAI,gBAAoC;QAExC,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;AACnD,YAAA,KAAK,MAAM,MAAM,IAAI,gBAAgB,EAAE;AACrC,gBAAA,IAAI,MAAM,CAAC,KAAK,KAAK,YAAY,EAAE;AACjC,oBAAA,gBAAgB,GAAG,MAAM,CAAC,KAAK;gBACjC;qBAAO;AACL,oBAAA,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;gBAC5B;YACF;QACF;;QAGA,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;AACxD,YAAA,IAAI,EAAE,CAAC;YACP,IAAI,EAAE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,YAAA,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,IAAI,CAAC;YAEpC,QAAQ,UAAU;AAChB,gBAAA,KAAK,UAAU;oBACb,OAAO,KAAK,GAAG,EAAE;AACnB,gBAAA,KAAK,QAAQ;AACX,oBAAA,OAAO,KAAK,IAAI,EAAE,IAAI,KAAK,GAAG,GAAG;AACnC,gBAAA,KAAK,SAAS;AACZ,oBAAA,OAAO,KAAK,IAAI,GAAG,IAAI,KAAK,GAAG,GAAG;AACpC,gBAAA,KAAK,UAAU;AACb,oBAAA,OAAO,KAAK,IAAI,GAAG,IAAI,KAAK,GAAG,IAAI;AACrC,gBAAA,KAAK,WAAW;oBACd,OAAO,KAAK,IAAI,IAAI;AACtB,gBAAA;AACE,oBAAA,OAAO,IAAI;;AAEjB,QAAA,CAAC,CAAC;IACJ;8GAzLW,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAxB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,wBAAwB,cAFvB,MAAM,EAAA,CAAA,CAAA;;2FAEP,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBAHpC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, Injectable } from '@angular/core';
|
|
3
|
+
import { resolveMultiLanguageString } from '@acorex/platform/core';
|
|
3
4
|
import { AXPEntityService } from '@acorex/platform/layout/entity';
|
|
4
5
|
import { RootConfig } from '@acorex/modules/product-catalog';
|
|
5
6
|
|
|
@@ -65,7 +66,7 @@ class GetProductListQuery {
|
|
|
65
66
|
if (product.categories && Array.isArray(product.categories)) {
|
|
66
67
|
for (const cat of product.categories) {
|
|
67
68
|
if (cat.title) {
|
|
68
|
-
categorySet.add(cat.title);
|
|
69
|
+
categorySet.add(resolveMultiLanguageString(cat.title, 'en-US'));
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
}
|
|
@@ -74,7 +75,11 @@ class GetProductListQuery {
|
|
|
74
75
|
// Get brand ID from first product
|
|
75
76
|
const brandId = products[0]?.brandId || products[0]?.brand?.id;
|
|
76
77
|
// Get manufacturer from first product (assuming all products in a brand have same manufacturer)
|
|
77
|
-
const manufacturerName = products[0]?.manufacturer?.title
|
|
78
|
+
const manufacturerName = (products[0]?.manufacturer?.title != null
|
|
79
|
+
? resolveMultiLanguageString(products[0].manufacturer.title, 'en-US')
|
|
80
|
+
: '') ||
|
|
81
|
+
products[0]?.manufacturerId ||
|
|
82
|
+
'Unknown';
|
|
78
83
|
const manufacturerId = products[0]?.manufacturerId || products[0]?.manufacturer?.id;
|
|
79
84
|
aggregatedResults.push({
|
|
80
85
|
brand: brandName,
|
|
@@ -232,10 +237,10 @@ class GetProductListQuery {
|
|
|
232
237
|
}
|
|
233
238
|
});
|
|
234
239
|
}
|
|
235
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
236
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
240
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetProductListQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
241
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetProductListQuery, providedIn: 'root' }); }
|
|
237
242
|
}
|
|
238
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
243
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetProductListQuery, decorators: [{
|
|
239
244
|
type: Injectable,
|
|
240
245
|
args: [{
|
|
241
246
|
providedIn: 'root',
|
|
@@ -243,4 +248,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
243
248
|
}] });
|
|
244
249
|
|
|
245
250
|
export { GetProductListQuery };
|
|
246
|
-
//# sourceMappingURL=acorex-connectivity-mock-get-product-list.query-
|
|
251
|
+
//# sourceMappingURL=acorex-connectivity-mock-get-product-list.query-B06aC73T.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-get-product-list.query-B06aC73T.mjs","sources":["../../../../libs/connectivity/mock/src/lib/product-catalog/reports/get-product-list.query.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { resolveMultiLanguageString } from '@acorex/platform/core';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { AXMProductCatalogProductEntityModel } from '@acorex/modules/product-catalog';\nimport { RootConfig } from '@acorex/modules/product-catalog';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetProductListQueryInput {\n skip?: number;\n take?: number;\n sort?: Array<{ field: string; dir: 'asc' | 'desc' }>;\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface ProductByBrandResult {\n brand: string;\n brandId?: string;\n manufacturer: string;\n manufacturerId?: string;\n productCount: number;\n totalValue: number;\n averagePrice: number;\n minPrice: number;\n maxPrice: number;\n categories: string;\n}\n\nexport interface GetProductListQueryResult {\n items: ProductByBrandResult[];\n total: number;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetProductListQuery implements AXPQuery<GetProductListQueryInput, GetProductListQueryResult> {\n private readonly entityService = inject(AXPEntityService);\n private productService = this.entityService.withEntity(`${RootConfig.module.name}.${RootConfig.entities.product.name}`).data<string, AXMProductCatalogProductEntityModel>();\n\n async fetch(input: GetProductListQueryInput | any): Promise<GetProductListQueryResult> {\n // Extract product-specific filters from AXPFilterClause format\n const extractedFilters = this.extractProductFilters(input.filters);\n\n // Separate custom filters from entity filters\n const entityFilters: GetProductListQueryInput['filters'] = [];\n let priceRangeFilter: string | undefined;\n\n if (extractedFilters && extractedFilters.length > 0) {\n for (const filter of extractedFilters) {\n if (filter.field === 'priceRange') {\n priceRangeFilter = filter.value;\n } else {\n entityFilters.push(filter);\n }\n }\n }\n\n // Get all products from storage with entity filters\n const allProductsResult = await this.productService.query({\n skip: 0,\n take: 10000, // Get all products for aggregation\n filter:\n entityFilters.length > 0\n ? ({\n logic: input.logic || 'and',\n filters: entityFilters,\n } as any)\n : undefined,\n });\n\n let allProducts = allProductsResult.items;\n\n // Apply custom price range filter after fetching\n if (priceRangeFilter && priceRangeFilter !== 'all') {\n allProducts = this.applyPriceRangeFilter(allProducts, priceRangeFilter);\n }\n\n // Group products by brand\n const brandGroups = new Map<string, AXMProductCatalogProductEntityModel[]>();\n\n for (const product of allProducts) {\n const brandKey = product.brand?.title || product.brandId || 'Unknown';\n\n if (!brandGroups.has(brandKey)) {\n brandGroups.set(brandKey, []);\n }\n\n brandGroups.get(brandKey)!.push(product);\n }\n\n // Aggregate data by brand\n const aggregatedResults: ProductByBrandResult[] = [];\n\n for (const [brandName, products] of brandGroups.entries()) {\n const prices = products.map((p) => p.basePrice || 0).filter((p) => p > 0);\n const totalValue = prices.reduce((sum, price) => sum + price, 0);\n const productCount = products.length;\n const averagePrice = productCount > 0 ? totalValue / productCount : 0;\n const minPrice = prices.length > 0 ? Math.min(...prices) : 0;\n const maxPrice = prices.length > 0 ? Math.max(...prices) : 0;\n\n // Get unique categories\n const categorySet = new Set<string>();\n for (const product of products) {\n if (product.categories && Array.isArray(product.categories)) {\n for (const cat of product.categories) {\n if (cat.title) {\n categorySet.add(resolveMultiLanguageString(cat.title, 'en-US'));\n }\n }\n }\n }\n const categories = Array.from(categorySet).join(', ');\n\n // Get brand ID from first product\n const brandId = products[0]?.brandId || products[0]?.brand?.id;\n\n // Get manufacturer from first product (assuming all products in a brand have same manufacturer)\n const manufacturerName =\n (products[0]?.manufacturer?.title != null\n ? resolveMultiLanguageString(products[0].manufacturer!.title, 'en-US')\n : '') ||\n products[0]?.manufacturerId ||\n 'Unknown';\n const manufacturerId = products[0]?.manufacturerId || products[0]?.manufacturer?.id;\n\n aggregatedResults.push({\n brand: brandName,\n brandId,\n manufacturer: manufacturerName,\n manufacturerId,\n productCount,\n totalValue: Number(totalValue.toFixed(2)),\n averagePrice: Number(averagePrice.toFixed(2)),\n minPrice: Number(minPrice.toFixed(2)),\n maxPrice: Number(maxPrice.toFixed(2)),\n categories,\n });\n }\n\n // Apply sorting if provided\n if (input.sort && input.sort.length > 0) {\n aggregatedResults.sort((a, b) => {\n for (const sortField of input.sort!) {\n const field = sortField.field as keyof ProductByBrandResult;\n const aValue = a[field];\n const bValue = b[field];\n const dir = sortField.dir === 'asc' ? 1 : -1;\n\n // Handle undefined values\n if (aValue === undefined && bValue === undefined) continue;\n if (aValue === undefined) return 1 * dir;\n if (bValue === undefined) return -1 * dir;\n\n if (aValue < bValue) return -1 * dir;\n if (aValue > bValue) return 1 * dir;\n }\n return 0;\n });\n }\n\n // Apply pagination\n const skip = input.skip || 0;\n const take = input.take || 10;\n const total = aggregatedResults.length;\n const items = aggregatedResults.slice(skip, skip + take);\n\n return {\n items,\n total,\n };\n }\n\n //#region ---- Filter Extraction ----\n\n /**\n * Extract product-specific filters from AXPFilterClause format\n * Maps report parameter paths to product entity field names\n */\n private extractProductFilters(parameters: any): GetProductListQueryInput['filters'] {\n const filters: GetProductListQueryInput['filters'] = [];\n const paramsAny = parameters as any;\n\n if (!paramsAny?.filters || !Array.isArray(paramsAny.filters)) {\n return filters;\n }\n\n for (const filter of paramsAny.filters) {\n if (!filter?.field || filter?.value === undefined || filter?.value === null) {\n continue;\n }\n\n const field = filter.field;\n const value = filter.value;\n const operator = filter.operator || { type: 'equal' };\n\n // Handle product-specific field mappings\n if (field === 'brand') {\n // Brand filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'brandId',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'brandId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'category') {\n // Category filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'categoryIds',\n operator: { type: 'contains' },\n value: value[0], // Use first category for contains check\n });\n } else if (value) {\n filters.push({\n field: 'categoryIds',\n operator: { type: 'contains' },\n value: value,\n });\n }\n } else if (field === 'status') {\n // Status filter - skip 'all' value\n if (value && value !== 'all') {\n filters.push({\n field: 'statusId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'priceRange') {\n // Price range filter - custom logic handled in query\n filters.push({\n field: 'priceRange',\n operator: { type: 'equal' },\n value: value,\n });\n } else if (field === 'startDate' || field === 'endDate') {\n // Date filters - can be handled if needed\n // For now, skip as they might not be directly on product entity\n } else {\n // Direct field mapping\n filters.push({\n field: field,\n operator: operator,\n value: value,\n });\n }\n }\n\n return filters;\n }\n\n //#endregion\n\n //#region ---- Custom Filter Handlers ----\n\n /**\n * Apply custom price range filter to products\n */\n private applyPriceRangeFilter(\n products: AXMProductCatalogProductEntityModel[],\n priceRange: string\n ): AXMProductCatalogProductEntityModel[] {\n return products.filter((product) => {\n const price = product.basePrice || 0;\n\n switch (priceRange) {\n case 'under-50':\n return price < 50;\n case '50-100':\n return price >= 50 && price < 100;\n case '100-500':\n return price >= 100 && price < 500;\n case '500-1000':\n return price >= 500 && price < 1000;\n case 'over-1000':\n return price >= 1000;\n default:\n return true;\n }\n });\n }\n\n //#endregion\n}\n\n"],"names":[],"mappings":";;;;;;AAuCA;MAKa,mBAAmB,CAAA;AAHhC,IAAA,WAAA,GAAA;AAImB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A,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, Injectable } from '@angular/core';
|
|
3
|
-
import { GetProductListQuery } from './acorex-connectivity-mock-get-product-list.query-
|
|
3
|
+
import { GetProductListQuery } from './acorex-connectivity-mock-get-product-list.query-B06aC73T.mjs';
|
|
4
4
|
|
|
5
5
|
//#endregion
|
|
6
6
|
class GetProductPdfDataQuery {
|
|
@@ -178,10 +178,10 @@ startxref
|
|
|
178
178
|
%%EOF`;
|
|
179
179
|
return pdf;
|
|
180
180
|
}
|
|
181
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
182
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
181
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetProductPdfDataQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
182
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetProductPdfDataQuery, providedIn: 'root' }); }
|
|
183
183
|
}
|
|
184
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
184
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetProductPdfDataQuery, decorators: [{
|
|
185
185
|
type: Injectable,
|
|
186
186
|
args: [{
|
|
187
187
|
providedIn: 'root',
|
|
@@ -189,4 +189,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
189
189
|
}] });
|
|
190
190
|
|
|
191
191
|
export { GetProductPdfDataQuery };
|
|
192
|
-
//# sourceMappingURL=acorex-connectivity-mock-get-product-pdf-data.query-
|
|
192
|
+
//# sourceMappingURL=acorex-connectivity-mock-get-product-pdf-data.query-CM7bsjl7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-get-product-pdf-data.query-CM7bsjl7.mjs","sources":["../../../../libs/connectivity/mock/src/lib/product-catalog/reports/get-product-pdf-data.query.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { GetProductListQueryInput, GetProductListQueryResult } from './get-product-list.query';\nimport { GetProductListQuery } from './get-product-list.query';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetProductPdfDataQueryInput {\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface GetProductPdfDataQueryResult {\n url?: string;\n base64?: string;\n blob?: Blob;\n filename?: string;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetProductPdfDataQuery implements AXPQuery<GetProductPdfDataQueryInput, GetProductPdfDataQueryResult> {\n private readonly productListQuery = inject(GetProductListQuery);\n\n async fetch(input: GetProductPdfDataQueryInput | any): Promise<GetProductPdfDataQueryResult> {\n // Extract product-specific filters from AXPFilterClause format\n const extractedFilters = this.extractProductFilters(input.filters);\n\n // Get the product list data to generate PDF content\n const productListInput: GetProductListQueryInput = {\n skip: 0,\n take: 10000, // Get all products for PDF\n filters: extractedFilters,\n logic: input.logic,\n };\n\n const productData = await this.productListQuery.fetch(productListInput);\n\n // Generate a mock PDF base64 string\n // In production, this would call an actual PDF generation service\n const pdfBase64 = this.generateMockPdfBase64(productData);\n\n return {\n base64: pdfBase64,\n filename: `Product_Report_${new Date().toISOString().split('T')[0]}.pdf`,\n };\n }\n\n //#region ---- Filter Extraction ----\n\n /**\n * Extract product-specific filters from AXPFilterClause format\n * Maps report parameter paths to product entity field names\n */\n private extractProductFilters(parameters: any): GetProductListQueryInput['filters'] {\n const filters: GetProductListQueryInput['filters'] = [];\n const paramsAny = parameters as any;\n\n if (!paramsAny?.filters || !Array.isArray(paramsAny.filters)) {\n return filters;\n }\n\n for (const filter of paramsAny.filters) {\n if (!filter?.field || filter?.value === undefined || filter?.value === null) {\n continue;\n }\n\n const field = filter.field;\n const value = filter.value;\n const operator = filter.operator || { type: 'equal' };\n\n // Handle product-specific field mappings\n if (field === 'brand') {\n // Brand filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'brandId',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'brandId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'category') {\n // Category filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'categoryIds',\n operator: { type: 'contains' },\n value: value[0], // Use first category for contains check\n });\n } else if (value) {\n filters.push({\n field: 'categoryIds',\n operator: { type: 'contains' },\n value: value,\n });\n }\n } else if (field === 'status') {\n // Status filter - skip 'all' value\n if (value && value !== 'all') {\n filters.push({\n field: 'statusId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'priceRange') {\n // Price range filter - custom logic handled in query\n filters.push({\n field: 'priceRange',\n operator: { type: 'equal' },\n value: value,\n });\n } else if (field === 'startDate' || field === 'endDate') {\n // Date filters - can be handled if needed\n // For now, skip as they might not be directly on product entity\n } else {\n // Direct field mapping\n filters.push({\n field: field,\n operator: operator,\n value: value,\n });\n }\n }\n\n return filters;\n }\n\n //#endregion\n\n //#region ---- PDF Generation Helpers ----\n\n /**\n * Generate a mock PDF base64 string\n * In production, this would call an actual PDF generation service\n */\n private generateMockPdfBase64(productData: GetProductListQueryResult): string {\n // Create a minimal valid PDF with some content\n // This is a very basic PDF structure for demonstration\n // In production, use a proper PDF library like jsPDF or call a backend service\n\n const pdfContent = this.createSimplePdf(productData);\n\n // Convert to base64\n const base64 = btoa(pdfContent);\n\n return base64;\n }\n\n /**\n * Create a simple PDF document structure\n * This is a minimal valid PDF for demonstration - in production use a proper PDF library\n */\n private createSimplePdf(productData: GetProductListQueryResult): string {\n // Use a minimal valid PDF structure that browsers can render\n // This is a very basic single-page PDF\n const pdf = `%PDF-1.4\n1 0 obj\n<< /Type /Catalog /Pages 2 0 R >>\nendobj\n2 0 obj\n<< /Type /Pages /Kids [3 0 R] /Count 1 >>\nendobj\n3 0 obj\n<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R /Resources << /Font << /F1 5 0 R >> >> >>\nendobj\n4 0 obj\n<< /Length 200 >>\nstream\nBT\n/F1 12 Tf\n100 700 Td\n(Product Report) Tj\n0 -20 Td\n(Total Brands: ${productData.total}) Tj\n0 -20 Td\n(Generated: ${new Date().toLocaleDateString()}) Tj\n0 -20 Td\n(Items: ${productData.items.length}) Tj\nET\nendstream\nendobj\n5 0 obj\n<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>\nendobj\nxref\n0 6\n0000000000 65535 f \n0000000009 00000 n \n0000000058 00000 n \n0000000115 00000 n \n0000000317 00000 n \n0000000444 00000 n \ntrailer\n<< /Size 6 /Root 1 0 R >>\nstartxref\n527\n%%EOF`;\n\n return pdf;\n }\n\n //#endregion\n}\n\n"],"names":[],"mappings":";;;;AAuBA;MAKa,sBAAsB,CAAA;AAHnC,IAAA,WAAA,GAAA;AAIqB,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,mBAAmB,CAAC;AA2LlE,IAAA;IAzLG,MAAM,KAAK,CAAC,KAAwC,EAAA;;QAEhD,MAAM,gBAAgB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,OAAO,CAAC;;AAGlE,QAAA,MAAM,gBAAgB,GAA6B;AAC/C,YAAA,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,KAAK;AACX,YAAA,OAAO,EAAE,gBAAgB;YACzB,KAAK,EAAE,KAAK,CAAC,KAAK;SACrB;QAED,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,g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BAAA,UAAU,EAAE,MAAM;AACrB,iBAAA;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, Injectable } from '@angular/core';
|
|
3
|
-
import { GetSubscriptionsTimelineQuery } from './acorex-connectivity-mock-get-subscriptions-timeline.query-
|
|
3
|
+
import { GetSubscriptionsTimelineQuery } from './acorex-connectivity-mock-get-subscriptions-timeline.query-D4qfDfeV.mjs';
|
|
4
4
|
|
|
5
5
|
//#endregion
|
|
6
6
|
class GetSubscriptionsChartDataQuery {
|
|
@@ -42,10 +42,10 @@ class GetSubscriptionsChartDataQuery {
|
|
|
42
42
|
items: results,
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
46
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
45
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetSubscriptionsChartDataQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
46
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetSubscriptionsChartDataQuery, providedIn: 'root' }); }
|
|
47
47
|
}
|
|
48
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
48
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetSubscriptionsChartDataQuery, decorators: [{
|
|
49
49
|
type: Injectable,
|
|
50
50
|
args: [{
|
|
51
51
|
providedIn: 'root',
|
|
@@ -53,4 +53,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
53
53
|
}] });
|
|
54
54
|
|
|
55
55
|
export { GetSubscriptionsChartDataQuery };
|
|
56
|
-
//# sourceMappingURL=acorex-connectivity-mock-get-subscriptions-chart-data.query-
|
|
56
|
+
//# sourceMappingURL=acorex-connectivity-mock-get-subscriptions-chart-data.query-BQT5a_hn.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-get-subscriptions-chart-data.query-BQT5a_hn.mjs","sources":["../../../../libs/connectivity/mock/src/lib/tenant-management/reports/get-subscriptions-chart-data.query.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { GetSubscriptionsTimelineQueryInput } from './get-subscriptions-timeline.query';\nimport { GetSubscriptionsTimelineQuery } from './get-subscriptions-timeline.query';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetSubscriptionsChartDataQueryInput {\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface SubscriptionsChartDataResult {\n month: string;\n year: number;\n quarter: string;\n subscriptionCount: number;\n}\n\nexport interface GetSubscriptionsChartDataQueryResult {\n items: SubscriptionsChartDataResult[];\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetSubscriptionsChartDataQuery\n implements AXPQuery<GetSubscriptionsChartDataQueryInput, GetSubscriptionsChartDataQueryResult>\n{\n private readonly subscriptionsTimelineQuery = inject(GetSubscriptionsTimelineQuery);\n\n async fetch(input: GetSubscriptionsChartDataQueryInput | any): Promise<GetSubscriptionsChartDataQueryResult> {\n // Get all subscription timeline data (no pagination for charts)\n const timelineResult = await this.subscriptionsTimelineQuery.fetch({\n skip: 0,\n take: 10000,\n filters: input.filters,\n logic: input.logic,\n });\n\n // Group by month\n const monthGroups = new Map<string, SubscriptionsChartDataResult>();\n\n for (const item of timelineResult.items) {\n const monthKey = `${item.year}-${String(item.monthNumber).padStart(2, '0')}`;\n\n if (!monthGroups.has(monthKey)) {\n monthGroups.set(monthKey, {\n month: item.month,\n year: item.year,\n quarter: item.quarter,\n subscriptionCount: 0,\n });\n }\n\n const group = monthGroups.get(monthKey)!;\n group.subscriptionCount++;\n }\n\n // Convert to array and sort by date\n const results = Array.from(monthGroups.values()).sort((a, b) => {\n if (a.year !== b.year) return a.year - b.year;\n const monthA = new Date(`${a.month} 1, ${a.year}`).getMonth();\n const monthB = new Date(`${b.month} 1, ${b.year}`).getMonth();\n return monthA - monthB;\n });\n\n return {\n items: results,\n };\n }\n}\n\n"],"names":[],"mappings":";;;;AA2BA;MAKa,8BAA8B,CAAA;AAH3C,IAAA,WAAA,GAAA;AAMmB,QAAA,IAAA,CAAA,0BAA0B,GAAG,MAAM,CAAC,6BAA6B,CAAC;AA0CpF,IAAA;IAxCC,MAAM,KAAK,CAAC,KAAgD,EAAA;;QAE1D,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC;AACjE,YAAA,IAAI,EAAE,CAAC;AACP,YAAA,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,KAAK,EAAE,KAAK,CAAC,KAAK;AACnB,SAAA,CAAC;;AAGF,QAAA,MAAM,WAAW,GAAG,IAAI,GAAG,EAAwC;AAEnE,QAAA,KAAK,MAAM,IAAI,IAAI,cAAc,CAAC,KAAK,EAAE;YACvC,MAAM,QAAQ,GAAG,CAAA,EAAG,IAAI,CAAC,IAAI,CAAA,CAAA,EAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA,CAAE;YAE5E,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;AAC9B,gBAAA,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE;oBACxB,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,OAAO,EAAE,IAAI,CAAC,OAAO;AACrB,oBAAA,iBAAiB,EAAE,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A;;;;;"}
|
|
@@ -232,10 +232,10 @@ class GetSubscriptionsTimelineQuery {
|
|
|
232
232
|
(subStartDate <= startDate && (!subEndDate || subEndDate >= endDate)));
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
236
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
235
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetSubscriptionsTimelineQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
236
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetSubscriptionsTimelineQuery, providedIn: 'root' }); }
|
|
237
237
|
}
|
|
238
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
238
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetSubscriptionsTimelineQuery, decorators: [{
|
|
239
239
|
type: Injectable,
|
|
240
240
|
args: [{
|
|
241
241
|
providedIn: 'root',
|
|
@@ -243,4 +243,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
243
243
|
}] });
|
|
244
244
|
|
|
245
245
|
export { GetSubscriptionsTimelineQuery };
|
|
246
|
-
//# sourceMappingURL=acorex-connectivity-mock-get-subscriptions-timeline.query-
|
|
246
|
+
//# sourceMappingURL=acorex-connectivity-mock-get-subscriptions-timeline.query-D4qfDfeV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-get-subscriptions-timeline.query-D4qfDfeV.mjs","sources":["../../../../libs/connectivity/mock/src/lib/tenant-management/reports/get-subscriptions-timeline.query.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXMSubscriptionManagementSubscriptionEntityModel } from '@acorex/modules/subscription-management';\nimport { AXMTenantManagementTenantEntityModel } from '@acorex/modules/tenant-management';\nimport { AXPSystemStatusType } from '@acorex/platform/common';\nimport { RootConfig as SubscriptionRootConfig } from '@acorex/modules/subscription-management';\nimport { RootConfig as TenantRootConfig } from '@acorex/modules/tenant-management';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetSubscriptionsTimelineQueryInput {\n skip?: number;\n take?: number;\n sort?: Array<{ field: string; dir: 'asc' | 'desc' }>;\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface SubscriptionsTimelineResult {\n subscriptionId: string;\n subscriptionTitle: string;\n tenantId: string;\n tenantName: string;\n planId?: string;\n planName: string;\n status: string;\n startDate: Date;\n startDateStr: string;\n endDate?: Date;\n endDateStr?: string;\n durationDays: number;\n month: string;\n monthNumber: number;\n quarter: string;\n year: number;\n isActive: boolean;\n}\n\nexport interface GetSubscriptionsTimelineQueryResult {\n items: SubscriptionsTimelineResult[];\n total: number;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetSubscriptionsTimelineQuery\n implements AXPQuery<GetSubscriptionsTimelineQueryInput, GetSubscriptionsTimelineQueryResult>\n{\n private readonly entityService = inject(AXPEntityService);\n private subscriptionService = this.entityService\n .withEntity(`${SubscriptionRootConfig.module.name}.${SubscriptionRootConfig.entities.subscription.name}`)\n .data<string, AXMSubscriptionManagementSubscriptionEntityModel>();\n private tenantService = this.entityService\n .withEntity(`${TenantRootConfig.module.name}.${TenantRootConfig.entities.tenant.name}`)\n .data<string, AXMTenantManagementTenantEntityModel>();\n\n async fetch(input: GetSubscriptionsTimelineQueryInput | any): Promise<GetSubscriptionsTimelineQueryResult> {\n // Extract filters from AXPFilterClause format\n const extractedFilters = this.extractSubscriptionFilters(input.filters);\n const filterLogic = (input.filters as any)?.logic || input.logic || 'and';\n\n // Separate custom filters from entity filters\n const entityFilters: GetSubscriptionsTimelineQueryInput['filters'] = [];\n let dateRangeFilter: any;\n\n if (extractedFilters && extractedFilters.length > 0) {\n for (const filter of extractedFilters) {\n if (filter.field === 'dateRange') {\n dateRangeFilter = filter.value;\n } else {\n entityFilters.push(filter);\n }\n }\n }\n\n // Get all subscriptions\n const subscriptionsResult = await this.subscriptionService.query({\n skip: 0,\n take: 10000,\n filter:\n entityFilters.length > 0\n ? ({\n logic: filterLogic,\n filters: entityFilters,\n } as any)\n : undefined,\n });\n\n let subscriptions = subscriptionsResult.items.filter((s) => s.subscriberType === 'Tenant');\n\n // Get all tenants for lookup\n const tenantsResult = await this.tenantService.query({\n skip: 0,\n take: 10000,\n });\n const tenants = tenantsResult.items;\n const tenantMap = new Map(tenants.map((t) => [t.id, t]));\n\n // Apply date range filter if provided\n if (dateRangeFilter) {\n subscriptions = this.applyDateRangeFilter(subscriptions, dateRangeFilter);\n }\n\n const now = new Date();\n\n // Build results\n const results: SubscriptionsTimelineResult[] = [];\n\n for (const subscription of subscriptions) {\n const startDate = new Date(subscription.startDate);\n const endDate = subscription.endDate ? new Date(subscription.endDate) : undefined;\n\n // Calculate duration in days\n const durationDays = endDate\n ? Math.ceil((endDate.getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24))\n : Math.ceil((now.getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24));\n\n // Extract time period info from start date\n const year = startDate.getFullYear();\n const month = startDate.getMonth() + 1;\n const monthName = startDate.toLocaleString('en-US', { month: 'long' });\n const quarter = Math.ceil(month / 3);\n const quarterName = `Q${quarter}`;\n\n // Check if subscription is currently active\n const isActive =\n subscription.statusId === AXPSystemStatusType.Active &&\n startDate <= now &&\n (!endDate || endDate >= now);\n\n // Get tenant name\n const tenant = tenantMap.get(subscription.subscriberId);\n\n results.push({\n subscriptionId: subscription.id,\n subscriptionTitle: subscription.title || `${tenant?.title || 'Unknown'} - ${subscription.plan?.title || 'Unknown Plan'}`,\n tenantId: subscription.subscriberId,\n tenantName: tenant?.title || 'Unknown',\n planId: subscription.planId,\n planName: subscription.plan?.title || 'Unknown',\n status: subscription.statusId || 'Unknown',\n startDate: startDate,\n startDateStr: startDate.toISOString(),\n endDate: endDate,\n endDateStr: endDate?.toISOString(),\n durationDays: durationDays,\n month: monthName,\n monthNumber: month,\n quarter: quarterName,\n year: year,\n isActive: isActive,\n });\n }\n\n // Apply sorting if provided\n if (input.sort && input.sort.length > 0) {\n results.sort((a, b) => {\n for (const sortField of input.sort!) {\n const field = sortField.field as keyof SubscriptionsTimelineResult;\n const aValue = a[field];\n const bValue = b[field];\n const dir = sortField.dir === 'asc' ? 1 : -1;\n\n if (aValue === undefined && bValue === undefined) continue;\n if (aValue === undefined) return 1 * dir;\n if (bValue === undefined) return -1 * dir;\n\n // Handle date comparison\n if (field === 'startDate') {\n const aDate = a.startDate.getTime();\n const bDate = b.startDate.getTime();\n if (aDate < bDate) return -1 * dir;\n if (aDate > bDate) return 1 * dir;\n continue;\n }\n\n if (aValue < bValue) return -1 * dir;\n if (aValue > bValue) return 1 * dir;\n }\n return 0;\n });\n } else {\n // Default sort by start date descending (newest first)\n results.sort((a, b) => {\n return b.startDate.getTime() - a.startDate.getTime();\n });\n }\n\n // Apply pagination\n const skip = input.skip || 0;\n const take = input.take || 10;\n const total = results.length;\n const items = results.slice(skip, skip + take);\n\n return {\n items,\n total,\n };\n }\n\n //#region ---- Filter Extraction ----\n\n /**\n * Extract subscription-specific filters from AXPFilterClause format\n * Maps report parameter paths to subscription entity field names\n */\n private extractSubscriptionFilters(parameters: any): GetSubscriptionsTimelineQueryInput['filters'] {\n const filters: GetSubscriptionsTimelineQueryInput['filters'] = [];\n const paramsAny = parameters as any;\n\n if (!paramsAny?.filters || !Array.isArray(paramsAny.filters)) {\n return filters;\n }\n\n for (const filter of paramsAny.filters) {\n if (!filter?.field || filter?.value === undefined || filter?.value === null) {\n continue;\n }\n\n const field = filter.field;\n const value = filter.value;\n const operator = filter.operator || { type: 'equal' };\n\n // Handle subscription-specific field mappings\n if (field === 'planId') {\n // Plan ID filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'planId',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'planId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'statusId') {\n // Status filter - skip 'all' value\n if (value && value !== 'all') {\n filters.push({\n field: 'statusId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'dateRange') {\n // Date range filter - custom logic handled in query\n filters.push({\n field: 'dateRange',\n operator: { type: 'equal' },\n value: value,\n });\n } else {\n // Direct field mapping\n filters.push({\n field: field,\n operator: operator,\n value: value,\n });\n }\n }\n\n return filters;\n }\n\n //#endregion\n\n //#region ---- Custom Filter Handlers ----\n\n /**\n * Apply date range filter to subscriptions\n */\n private applyDateRangeFilter(\n subscriptions: AXMSubscriptionManagementSubscriptionEntityModel[],\n dateRange: any\n ): AXMSubscriptionManagementSubscriptionEntityModel[] {\n if (!dateRange || !dateRange.start || !dateRange.end) {\n return subscriptions;\n }\n\n const startDate = new Date(dateRange.start);\n const endDate = new Date(dateRange.end);\n endDate.setHours(23, 59, 59, 999);\n\n return subscriptions.filter((subscription) => {\n const subStartDate = new Date(subscription.startDate);\n const subEndDate = subscription.endDate ? new Date(subscription.endDate) : null;\n\n // Check if subscription overlaps with the date range\n return (\n (subStartDate >= startDate && subStartDate <= endDate) ||\n (subEndDate && subEndDate >= startDate && subEndDate <= endDate) ||\n (subStartDate <= startDate && (!subEndDate || subEndDate >= endDate))\n );\n });\n }\n\n //#endregion\n}\n\n"],"names":["SubscriptionRootConfig","TenantRootConfig"],"mappings":";;;;;;;AAgDA;MAKa,6BAA6B,CAAA;AAH1C,IAAA,WAAA,GAAA;AAMmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CA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EAAA,EAAA,IAAA,EAAA,6BAA6B,cAF5B,MAAM,EAAA,CAAA,CAAA;;2FAEP,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBAHzC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
|
|
@@ -244,10 +244,10 @@ class GetTenantApplicationAccessQuery {
|
|
|
244
244
|
return regDate >= startDate && regDate <= endDate;
|
|
245
245
|
});
|
|
246
246
|
}
|
|
247
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
248
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
247
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetTenantApplicationAccessQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
248
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetTenantApplicationAccessQuery, providedIn: 'root' }); }
|
|
249
249
|
}
|
|
250
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
250
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: GetTenantApplicationAccessQuery, decorators: [{
|
|
251
251
|
type: Injectable,
|
|
252
252
|
args: [{
|
|
253
253
|
providedIn: 'root',
|
|
@@ -255,4 +255,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
255
255
|
}] });
|
|
256
256
|
|
|
257
257
|
export { GetTenantApplicationAccessQuery };
|
|
258
|
-
//# sourceMappingURL=acorex-connectivity-mock-get-tenant-application-access.query-
|
|
258
|
+
//# sourceMappingURL=acorex-connectivity-mock-get-tenant-application-access.query-n1_Azada.mjs.map
|
package/fesm2022/acorex-connectivity-mock-get-tenant-application-access.query-n1_Azada.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-connectivity-mock-get-tenant-application-access.query-n1_Azada.mjs","sources":["../../../../libs/connectivity/mock/src/lib/tenant-management/reports/get-tenant-application-access.query.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { AXPQuery } from '@acorex/platform/runtime';\nimport { AXPEntityService } from '@acorex/platform/layout/entity';\nimport { AXMTenantManagementTenantEntityModel } from '@acorex/modules/tenant-management';\nimport { AXMSubscriptionManagementSubscriptionEntityModel } from '@acorex/modules/subscription-management';\nimport { AXMSubscriptionManagementSubscriptionPlanEntityModel } from '@acorex/modules/subscription-management';\nimport { AXMSubscriptionManagementSubscriptionPlanItemEntityModel } from '@acorex/modules/subscription-management';\nimport { AXMApplicationManagementApplicationEntityModel } from '@acorex/modules/application-management';\nimport { AXPSystemStatusType } from '@acorex/platform/common';\nimport { RootConfig as TenantRootConfig } from '@acorex/modules/tenant-management';\nimport { RootConfig as SubscriptionRootConfig } from '@acorex/modules/subscription-management';\nimport { RootConfig as ApplicationRootConfig } from '@acorex/modules/application-management';\n\n//#region ---- Query Input/Output Types ----\n\nexport interface GetTenantApplicationAccessQueryInput {\n skip?: number;\n take?: number;\n sort?: Array<{ field: string; dir: 'asc' | 'desc' }>;\n filters?: Array<{\n field: string;\n operator: { type: string };\n value: any;\n }>;\n logic?: 'and' | 'or';\n}\n\nexport interface TenantApplicationAccessResult {\n tenantId: string;\n tenantName: string;\n tenantStatus: string;\n subscriptionCount: number;\n applicationsCount: number;\n applicationsList: string;\n activeSubscriptionsCount: number;\n registrationDate?: Date;\n registrationDateStr?: string;\n}\n\nexport interface GetTenantApplicationAccessQueryResult {\n items: TenantApplicationAccessResult[];\n total: number;\n}\n\n//#endregion\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GetTenantApplicationAccessQuery\n implements AXPQuery<GetTenantApplicationAccessQueryInput, GetTenantApplicationAccessQueryResult> {\n private readonly entityService = inject(AXPEntityService);\n private tenantService = this.entityService\n .withEntity(`${TenantRootConfig.module.name}.${TenantRootConfig.entities.tenant.name}`)\n .data<string, AXMTenantManagementTenantEntityModel>();\n private subscriptionService = this.entityService\n .withEntity(`${SubscriptionRootConfig.module.name}.${SubscriptionRootConfig.entities.subscription.name}`)\n .data<string, AXMSubscriptionManagementSubscriptionEntityModel>();\n private planService = this.entityService\n .withEntity(`${SubscriptionRootConfig.module.name}.${SubscriptionRootConfig.entities.subscriptionPlan.name}`)\n .data<string, AXMSubscriptionManagementSubscriptionPlanEntityModel>();\n private planItemService = this.entityService\n .withEntity(`${SubscriptionRootConfig.module.name}.${SubscriptionRootConfig.entities.subscriptionPlanItem.name}`)\n .data<string, AXMSubscriptionManagementSubscriptionPlanItemEntityModel>();\n private applicationService = this.entityService\n .withEntity(`${ApplicationRootConfig.module.name}.${ApplicationRootConfig.entities.application.name}`)\n .data<string, AXMApplicationManagementApplicationEntityModel>();\n\n async fetch(input: GetTenantApplicationAccessQueryInput | any): Promise<GetTenantApplicationAccessQueryResult> {\n // Extract filters from AXPFilterClause format\n const extractedFilters = this.extractTenantFilters(input.filters);\n const filterLogic = (input.filters as any)?.logic || input.logic || 'and';\n\n // Separate custom filters from entity filters\n const entityFilters: GetTenantApplicationAccessQueryInput['filters'] = [];\n let dateRangeFilter: any;\n\n if (extractedFilters && extractedFilters.length > 0) {\n for (const filter of extractedFilters) {\n if (filter.field === 'dateRange') {\n dateRangeFilter = filter.value;\n } else {\n entityFilters.push(filter);\n }\n }\n }\n\n // Get all tenants\n const tenantsResult = await this.tenantService.query({\n skip: 0,\n take: 10000,\n filter:\n entityFilters.length > 0\n ? ({\n logic: filterLogic,\n filters: entityFilters,\n } as any)\n : undefined,\n });\n\n let tenants = tenantsResult.items;\n\n // Apply date range filter if provided\n if (dateRangeFilter) {\n tenants = this.applyDateRangeFilter(tenants, dateRangeFilter);\n }\n\n // Get all subscriptions\n const subscriptionsResult = await this.subscriptionService.query({\n skip: 0,\n take: 10000,\n });\n const subscriptions = subscriptionsResult.items.filter((s) => s.subscriberType === 'Tenant');\n\n // Get all plans\n const plansResult = await this.planService.query({\n skip: 0,\n take: 10000,\n });\n const plans = plansResult.items;\n\n // Get all plan items\n const planItemsResult = await this.planItemService.query({\n skip: 0,\n take: 10000,\n });\n const planItems = planItemsResult.items;\n\n // Get all applications\n const applicationsResult = await this.applicationService.query({\n skip: 0,\n take: 10000,\n });\n const applications = applicationsResult.items;\n\n // Build results for each tenant\n const results: TenantApplicationAccessResult[] = [];\n\n for (const tenant of tenants) {\n // Get tenant's subscriptions\n const tenantSubscriptions = subscriptions.filter((s) => s.subscriberId === tenant.id);\n\n // Get unique applications through subscriptions → plans → plan items → editions → applications\n const applicationSet = new Set<string>();\n const applicationNames: string[] = [];\n\n for (const subscription of tenantSubscriptions) {\n if (!subscription.planId) continue;\n\n // Get plan items for this plan\n const planPlanItems = planItems.filter((pi) => pi.planId === subscription.planId);\n\n for (const planItem of planPlanItems) {\n if (!planItem.editionId) continue;\n\n // Find applications that have this edition\n for (const application of applications) {\n if (application.editionIds && application.editionIds.includes(planItem.editionId)) {\n if (!applicationSet.has(application.id)) {\n applicationSet.add(application.id);\n applicationNames.push(application.title);\n }\n }\n }\n }\n }\n\n // Count active subscriptions\n const activeSubscriptions = tenantSubscriptions.filter(\n (s) => s.statusId === AXPSystemStatusType.Active\n );\n\n results.push({\n tenantId: tenant.id,\n tenantName: tenant.title,\n tenantStatus: tenant.statusId || 'Unknown',\n subscriptionCount: tenantSubscriptions.length,\n applicationsCount: applicationSet.size,\n applicationsList: applicationNames.join(', '),\n activeSubscriptionsCount: activeSubscriptions.length,\n registrationDate: tenant.registrationDate,\n registrationDateStr: tenant.registrationDate?.toISOString(),\n });\n }\n\n // Apply sorting if provided\n if (input.sort && input.sort.length > 0) {\n results.sort((a, b) => {\n for (const sortField of input.sort!) {\n const field = sortField.field as keyof TenantApplicationAccessResult;\n const aValue = a[field];\n const bValue = b[field];\n const dir = sortField.dir === 'asc' ? 1 : -1;\n\n if (aValue === undefined && bValue === undefined) continue;\n if (aValue === undefined) return 1 * dir;\n if (bValue === undefined) return -1 * dir;\n\n if (aValue < bValue) return -1 * dir;\n if (aValue > bValue) return 1 * dir;\n }\n return 0;\n });\n } else {\n // Default sort by tenant name\n results.sort((a, b) => a.tenantName.localeCompare(b.tenantName));\n }\n\n // Apply pagination\n const skip = input.skip || 0;\n const take = input.take || 10;\n const total = results.length;\n const items = results.slice(skip, skip + take);\n\n return {\n items,\n total,\n };\n }\n\n //#region ---- Filter Extraction ----\n\n /**\n * Extract tenant-specific filters from AXPFilterClause format\n * Maps report parameter paths to tenant entity field names\n */\n private extractTenantFilters(parameters: any): GetTenantApplicationAccessQueryInput['filters'] {\n const filters: GetTenantApplicationAccessQueryInput['filters'] = [];\n const paramsAny = parameters as any;\n\n if (!paramsAny?.filters || !Array.isArray(paramsAny.filters)) {\n return filters;\n }\n\n for (const filter of paramsAny.filters) {\n if (!filter?.field || filter?.value === undefined || filter?.value === null) {\n continue;\n }\n\n const field = filter.field;\n const value = filter.value;\n const operator = filter.operator || { type: 'equal' };\n\n // Handle tenant-specific field mappings\n if (field === 'tenantId') {\n // Tenant ID filter - can be array of IDs or single ID\n if (Array.isArray(value) && value.length > 0) {\n filters.push({\n field: 'id',\n operator: { type: 'in' },\n value: value,\n });\n } else if (value) {\n filters.push({\n field: 'id',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'statusId') {\n // Status filter - skip 'all' value\n if (value && value !== 'all') {\n filters.push({\n field: 'statusId',\n operator: { type: 'equal' },\n value: value,\n });\n }\n } else if (field === 'dateRange') {\n // Date range filter - custom logic handled in query\n filters.push({\n field: 'dateRange',\n operator: { type: 'equal' },\n value: value,\n });\n } else {\n // Direct field mapping\n filters.push({\n field: field,\n operator: operator,\n value: value,\n });\n }\n }\n\n return filters;\n }\n\n //#endregion\n\n //#region ---- Custom Filter Handlers ----\n\n /**\n * Apply date range filter to tenants\n */\n private applyDateRangeFilter(\n tenants: AXMTenantManagementTenantEntityModel[],\n dateRange: any\n ): AXMTenantManagementTenantEntityModel[] {\n if (!dateRange || !dateRange.start || !dateRange.end) {\n return tenants;\n }\n\n const startDate = new Date(dateRange.start);\n const endDate = new Date(dateRange.end);\n endDate.setHours(23, 59, 59, 999);\n\n return tenants.filter((tenant) => {\n if (!tenant.registrationDate) return false;\n const regDate = new Date(tenant.registrationDate);\n return regDate >= startDate && regDate <= endDate;\n });\n }\n\n //#endregion\n}\n\n"],"names":["TenantRootConfig","SubscriptionRootConfig","ApplicationRootConfig"],"mappings":";;;;;;;;AA4CA;MAKa,+BAA+B,CAAA;AAH5C,IAAA,WAAA,GAAA;AAKmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACjD,IAAA,CAAA,aAAa,GAAG,IAAI,CAAC;AAC1B,aAAA,UAAU,CAAC,CAAA,EAAGA,UAAgB,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAIA,UAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE;AACrF,aAAA,IAAI,EAAgD;QAC/C,IAAA,CAAA,mBAAmB,GAAG,IAAI,CAAC;AAChC,aAAA,UAAU,CAAC,CAAA,EAAGC,YAAsB,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAIA,YAAsB,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE;AACvG,aAAA,IAAI,EAA4D;QAC3D,IAAA,CAAA,WAAW,GAAG,IAAI,CAAC;AACxB,aAAA,UAAU,CAAC,CAAA,EAAGA,YAAsB,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAIA,YAAsB,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,EAAE;AAC3G,aAAA,IAAI,EAAgE;QAC/D,IAAA,CAAA,eAAe,GAAG,IAAI,CAAC;AAC5B,aAAA,UAAU,CAAC,CAAA,EAAGA,YAAsB,CAAC,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