@studyportals/campaign-management-api-interface 0.13.0 → 0.13.1
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/.vscode/launch.json +36 -0
- package/.vscode/settings.json +4 -0
- package/.vscode/tasks.json +41 -0
- package/README.md +2 -0
- package/{index.d.ts → index.ts} +22 -1
- package/jest.config.single-file.json +20 -0
- package/jest.config.unit.json +19 -0
- package/package.json +2 -2
- package/src/auditor-campaign-management-api.client.ts +54 -0
- package/src/campaign-management-api.client.ts +68 -0
- package/src/domain/auditor/campaigns/geotargeting.entities.ts +20 -0
- package/src/domain/auditor/enums/auditor-entity-type.enum.ts +3 -0
- package/src/domain/auditor/enums/{auditor-operation.enum.d.ts → auditor-operation.enum.ts} +2 -2
- package/src/domain/auditor/get-auditor.dto.ts +33 -0
- package/src/domain/campaign/CampaignsEntitiesConfig.dto.ts +7 -0
- package/src/private-campaign-management-api.client.ts +80 -0
- package/tests-u/domain/auditor/auditor-campaign-management-api-client.test.ts +99 -0
- package/tests-u/domain/auditor/enums/auditor-entity-type-enum.test.ts +22 -0
- package/tests-u/domain/auditor/enums/auditor-operation-enum.test.ts +34 -0
- package/tests-u/domain/auditor/get-auditor-entity.test.ts +34 -0
- package/tests-u/domain/campaign/campaign-management-api-client.test.ts +111 -0
- package/tests-u/domain/campaign/private-campaign-management-api-client.test.ts +114 -0
- package/tsconfig.json +39 -0
- package/index.js +0 -18
- package/index.js.map +0 -1
- package/src/auditor-campaign-management-api.client.d.ts +0 -12
- package/src/auditor-campaign-management-api.client.js +0 -56
- package/src/auditor-campaign-management-api.client.js.map +0 -1
- package/src/campaign-management-api.client.d.ts +0 -13
- package/src/campaign-management-api.client.js +0 -57
- package/src/campaign-management-api.client.js.map +0 -1
- package/src/domain/auditor/campaigns/geotargeting.entities.d.ts +0 -14
- package/src/domain/auditor/campaigns/geotargeting.entities.js +0 -11
- package/src/domain/auditor/campaigns/geotargeting.entities.js.map +0 -1
- package/src/domain/auditor/enums/auditor-entity-type.enum.d.ts +0 -3
- package/src/domain/auditor/enums/auditor-entity-type.enum.js +0 -8
- package/src/domain/auditor/enums/auditor-entity-type.enum.js.map +0 -1
- package/src/domain/auditor/enums/auditor-operation.enum.js +0 -14
- package/src/domain/auditor/enums/auditor-operation.enum.js.map +0 -1
- package/src/domain/auditor/get-auditor.dto.d.ts +0 -13
- package/src/domain/auditor/get-auditor.dto.js +0 -17
- package/src/domain/auditor/get-auditor.dto.js.map +0 -1
- package/src/domain/campaign/CampaignsEntitiesConfig.dto.d.ts +0 -7
- package/src/domain/campaign/CampaignsEntitiesConfig.dto.js +0 -10
- package/src/domain/campaign/CampaignsEntitiesConfig.dto.js.map +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2.0",
|
|
3
|
+
"configurations": [
|
|
4
|
+
{
|
|
5
|
+
"type": "node",
|
|
6
|
+
"request": "launch",
|
|
7
|
+
"name": "Jest watch current file",
|
|
8
|
+
"program": "${workspaceFolder}/node_modules/jest-cli/bin/jest",
|
|
9
|
+
"args": [
|
|
10
|
+
"${fileBasename}",
|
|
11
|
+
"--verbose",
|
|
12
|
+
"-i",
|
|
13
|
+
"--no-cache",
|
|
14
|
+
"--watchAll"
|
|
15
|
+
],
|
|
16
|
+
"console": "integratedTerminal",
|
|
17
|
+
"internalConsoleOptions": "neverOpen"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "TypeScript - All Tests Files",
|
|
21
|
+
"type": "node",
|
|
22
|
+
"request": "launch",
|
|
23
|
+
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
|
|
24
|
+
"args": [
|
|
25
|
+
"--require",
|
|
26
|
+
"ts-node/register",
|
|
27
|
+
"--colors",
|
|
28
|
+
"${relativeFile}",
|
|
29
|
+
"--no-timeouts",
|
|
30
|
+
"src/*-tests/*.test.ts"
|
|
31
|
+
],
|
|
32
|
+
"cwd": "${workspaceRoot}",
|
|
33
|
+
"protocol": "inspector"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2.0.0",
|
|
3
|
+
"tasks": [
|
|
4
|
+
{
|
|
5
|
+
"label": "runCurrentTest",
|
|
6
|
+
"type": "shell",
|
|
7
|
+
"command": "cross-env NODE_ENV=tst npx jest -c jest.config.single-file.json --maxWorkers=1 \"${relativeFile}\"",
|
|
8
|
+
"group": "test",
|
|
9
|
+
"presentation": {
|
|
10
|
+
"echo": true,
|
|
11
|
+
"reveal": "always",
|
|
12
|
+
"focus": true,
|
|
13
|
+
"panel": "dedicated"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"label": "runCurrentTestWatch",
|
|
18
|
+
"type": "shell",
|
|
19
|
+
"command": "npx jest -c jest.config.unit.json --maxWorkers=1 --watch \"${relativeFile}\"",
|
|
20
|
+
"group": "test",
|
|
21
|
+
"presentation": {
|
|
22
|
+
"echo": true,
|
|
23
|
+
"reveal": "always",
|
|
24
|
+
"focus": true,
|
|
25
|
+
"panel": "dedicated"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"label": "runCurrentTestClearCache",
|
|
30
|
+
"type": "shell",
|
|
31
|
+
"command": "npx jest -c jest.config.unit.json --maxWorkers=1 --clearCache",
|
|
32
|
+
"group": "test",
|
|
33
|
+
"presentation": {
|
|
34
|
+
"echo": true,
|
|
35
|
+
"reveal": "always",
|
|
36
|
+
"focus": true,
|
|
37
|
+
"panel": "dedicated"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
]
|
|
41
|
+
}
|
package/README.md
ADDED
package/{index.d.ts → index.ts}
RENAMED
|
@@ -5,4 +5,25 @@ import { AuditorOperation } from "./src/domain/auditor/enums/auditor-operation.e
|
|
|
5
5
|
import { GetAuditorDto } from "./src/domain/auditor/get-auditor.dto";
|
|
6
6
|
import { CampaignsEntitiesConfigDto } from "./src/domain/campaign/CampaignsEntitiesConfig.dto";
|
|
7
7
|
import { NumberMap, Pricing, ICampaignAuditorData } from "./src/domain/auditor/campaigns/geotargeting.entities";
|
|
8
|
-
|
|
8
|
+
import { PrivateCampaignManagementAPIClient } from "./src/private-campaign-management-api.client";
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
// Clients
|
|
12
|
+
AuditorCampaignManagementAPIClient,
|
|
13
|
+
CampaignManagementAPIClient,
|
|
14
|
+
PrivateCampaignManagementAPIClient,
|
|
15
|
+
|
|
16
|
+
// Enums
|
|
17
|
+
AuditorEntityType,
|
|
18
|
+
AuditorOperation,
|
|
19
|
+
|
|
20
|
+
// Output Dto
|
|
21
|
+
GetAuditorDto,
|
|
22
|
+
|
|
23
|
+
// Input Dto
|
|
24
|
+
CampaignsEntitiesConfigDto,
|
|
25
|
+
|
|
26
|
+
NumberMap,
|
|
27
|
+
Pricing,
|
|
28
|
+
ICampaignAuditorData
|
|
29
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"moduleFileExtensions": [
|
|
3
|
+
"js",
|
|
4
|
+
"json",
|
|
5
|
+
"ts"
|
|
6
|
+
],
|
|
7
|
+
"rootDir": "",
|
|
8
|
+
"transform": {
|
|
9
|
+
"^.+\\.(t|j)s$": "ts-jest"
|
|
10
|
+
},
|
|
11
|
+
"collectCoverageFrom": [
|
|
12
|
+
"src/**/*.(t|j)s"
|
|
13
|
+
],
|
|
14
|
+
"coverageDirectory": "../coverage",
|
|
15
|
+
"testEnvironment": "node",
|
|
16
|
+
"testMatch": [
|
|
17
|
+
"<rootDir>/tests-u/**/*\\.(spec|test)\\.ts",
|
|
18
|
+
"<rootDir>/tests-i/**/*\\.(spec|test)\\.ts"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"moduleFileExtensions": [
|
|
3
|
+
"js",
|
|
4
|
+
"json",
|
|
5
|
+
"ts"
|
|
6
|
+
],
|
|
7
|
+
"rootDir": "",
|
|
8
|
+
"transform": {
|
|
9
|
+
"^.+\\.(t|j)s$": "ts-jest"
|
|
10
|
+
},
|
|
11
|
+
"collectCoverageFrom": [
|
|
12
|
+
"src/**/*.(t|j)s"
|
|
13
|
+
],
|
|
14
|
+
"coverageDirectory": "../coverage",
|
|
15
|
+
"testEnvironment": "node",
|
|
16
|
+
"testMatch": [
|
|
17
|
+
"<rootDir>/tests-u/**/*\\.(spec|test)\\.ts"
|
|
18
|
+
]
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studyportals/campaign-management-api-interface",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"compile": "rm -fR bin && npx tsc",
|
|
6
6
|
"test-u": "jest -c jest.config.unit.json --silent --maxWorkers=1",
|
|
7
7
|
"test-i": "nyc mocha src tests-i",
|
|
8
8
|
"prepare-deployment": "npm run test-u && npm run compile && cp package.json bin/package.json && rm -fR bin/tests-u",
|
|
9
|
-
"deploy": "npm run prepare-deployment && npm publish
|
|
9
|
+
"deploy": "npm run prepare-deployment && npm publish --access=public",
|
|
10
10
|
"deploy-patch": "npm version patch && npm run deploy",
|
|
11
11
|
"deploy-minor": "npm version minor && npm run deploy",
|
|
12
12
|
"deploy-major": "npm version major && npm run deploy",
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
|
|
3
|
+
import { SuperAgentRequest } from "superagent";
|
|
4
|
+
import { GetAuditorDto } from "./domain/auditor/get-auditor.dto";
|
|
5
|
+
import { AuditorOperation } from "./domain/auditor/enums/auditor-operation.enum";
|
|
6
|
+
import { injectable } from "inversify";
|
|
7
|
+
|
|
8
|
+
import * as superagent from "superagent";
|
|
9
|
+
|
|
10
|
+
@injectable()
|
|
11
|
+
export class AuditorCampaignManagementAPIClient {
|
|
12
|
+
public constructor(
|
|
13
|
+
private readonly baseUrl: string
|
|
14
|
+
) { }
|
|
15
|
+
|
|
16
|
+
public async getCampaignAuditorData(campaignID: number, jwt = ""): Promise<GetAuditorDto[]> {
|
|
17
|
+
const result = await this.getRequest(`auditor/campaigns/${campaignID}`, jwt);
|
|
18
|
+
const getAuditorDtos = result.body as GetAuditorDto[];
|
|
19
|
+
|
|
20
|
+
return getAuditorDtos;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public async storeCampaignAuditorData(operation: AuditorOperation, campaignID: number, username: string, isUserAction: boolean, data: any, jwt = ""): Promise<GetAuditorDto> {
|
|
24
|
+
const sendData = {
|
|
25
|
+
"operation": operation,
|
|
26
|
+
"entityID": campaignID,
|
|
27
|
+
"username": username,
|
|
28
|
+
"isUserAction": isUserAction,
|
|
29
|
+
"data": data
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const result = await this.postRequest(`auditor/campaigns`, sendData, jwt);
|
|
33
|
+
|
|
34
|
+
return result.body as GetAuditorDto;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
private async getRequest(relative: string = "", jwt = ""): Promise<SuperAgentRequest> {
|
|
39
|
+
return await superagent.get(this.buildBaseUrl(relative))
|
|
40
|
+
.set("Content-Type", "application/json")
|
|
41
|
+
.set("Authorization", jwt);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private async postRequest(relative: string = "", data: any, jwt = ""): Promise<SuperAgentRequest> {
|
|
45
|
+
return await superagent.post(this.buildBaseUrl(relative))
|
|
46
|
+
.set("Content-Type", "application/json")
|
|
47
|
+
.set("Authorization", jwt)
|
|
48
|
+
.send(data);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private buildBaseUrl(relative: string): string {
|
|
52
|
+
return `${this.baseUrl}/${relative}`;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
|
|
3
|
+
import { SuperAgentRequest } from "superagent";
|
|
4
|
+
import { injectable } from "inversify";
|
|
5
|
+
import { CampaignsEntitiesConfigDto } from "./domain/campaign/CampaignsEntitiesConfig.dto";
|
|
6
|
+
|
|
7
|
+
import * as superagent from "superagent";
|
|
8
|
+
|
|
9
|
+
@injectable()
|
|
10
|
+
export class CampaignManagementAPIClient {
|
|
11
|
+
public constructor(
|
|
12
|
+
private readonly baseUrl: string
|
|
13
|
+
) { }
|
|
14
|
+
|
|
15
|
+
public async addCampaignsEntitiesConfigs(campaignID: number, campaignsEntitiesConfigs: CampaignsEntitiesConfigDto[]): Promise<any> {
|
|
16
|
+
const path = `campaigns/add-campaigns-entities-configs`;
|
|
17
|
+
const data = {
|
|
18
|
+
campaignsEntitiesConfigs: campaignsEntitiesConfigs,
|
|
19
|
+
campaignID: campaignID
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return await this.postRequest(path, data);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public async removeCampaignsEntitiesConfigsByID(campaignID: number, campaignsEntitiesConfigsIDs: number[]): Promise<any> {
|
|
26
|
+
const path = `campaigns/remove-campaigns-entities-configs`;
|
|
27
|
+
const data = { campaignsEntitiesConfigsIDs: campaignsEntitiesConfigsIDs, campaignID: campaignID };
|
|
28
|
+
|
|
29
|
+
return await this.postRequest(path, data);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public async clearCampaignsEntitiesConfigsByCampaignID(campaignID: number): Promise<any> {
|
|
33
|
+
const path = `campaigns/clear-campaigns-entities-configs`;
|
|
34
|
+
const data = { campaignID: campaignID };
|
|
35
|
+
|
|
36
|
+
return await this.postRequest(path, data);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public async setEntitiesBasic(campaignID: number, organisationIDs: number[], studyIDs: number[]): Promise<any> {
|
|
40
|
+
const path = `campaigns/set-entities-basic`;
|
|
41
|
+
const data = {
|
|
42
|
+
organisationIDs: organisationIDs,
|
|
43
|
+
studyIDs: studyIDs,
|
|
44
|
+
campaignID: campaignID
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
return await this.postRequest(path, data);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public async setEntitiesPremium(campaignID: number, organisationIDs: number[], studyIDs: number[]): Promise<any> {
|
|
51
|
+
const path = `campaigns/set-entities-premium`;
|
|
52
|
+
const data = {
|
|
53
|
+
organisationIDs: organisationIDs,
|
|
54
|
+
studyIDs: studyIDs,
|
|
55
|
+
campaignID: campaignID
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return await this.postRequest(path, data);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private async postRequest(relative: string = "", data: any): Promise<SuperAgentRequest> {
|
|
62
|
+
return await superagent.post(this.buildBaseUrl(relative)).set("Content-Type", "application/json").send(data);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private buildBaseUrl(relative: string): string {
|
|
66
|
+
return `${this.baseUrl}/${relative}`;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface NumberMap { [key: string]: number; }
|
|
2
|
+
|
|
3
|
+
interface ICampaignAuditorData {
|
|
4
|
+
geo: any[];
|
|
5
|
+
pricing: Pricing;
|
|
6
|
+
geo_remainders: NumberMap;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
class Pricing {
|
|
10
|
+
public constructor(
|
|
11
|
+
public s: NumberMap = {},
|
|
12
|
+
public o: NumberMap = {}
|
|
13
|
+
) {}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
ICampaignAuditorData,
|
|
18
|
+
NumberMap,
|
|
19
|
+
Pricing
|
|
20
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AuditorEntityType } from "./enums/auditor-entity-type.enum";
|
|
2
|
+
import { AuditorOperation } from "./enums/auditor-operation.enum";
|
|
3
|
+
|
|
4
|
+
export class GetAuditorDto {
|
|
5
|
+
public readonly id: number;
|
|
6
|
+
public readonly auditTime: string
|
|
7
|
+
public readonly operation: AuditorOperation
|
|
8
|
+
public readonly entityID: number
|
|
9
|
+
public readonly entityType: AuditorEntityType
|
|
10
|
+
public readonly username: string
|
|
11
|
+
public readonly isUserAction: boolean
|
|
12
|
+
public readonly data: any
|
|
13
|
+
|
|
14
|
+
public constructor(
|
|
15
|
+
id: number,
|
|
16
|
+
auditTime: string,
|
|
17
|
+
operation: AuditorOperation,
|
|
18
|
+
entityID: number,
|
|
19
|
+
entityType: AuditorEntityType,
|
|
20
|
+
username: string,
|
|
21
|
+
isUserAction: boolean,
|
|
22
|
+
data: any
|
|
23
|
+
) {
|
|
24
|
+
this.id = id;
|
|
25
|
+
this.auditTime = auditTime;
|
|
26
|
+
this.operation = operation;
|
|
27
|
+
this.entityID = entityID;
|
|
28
|
+
this.entityType = entityType;
|
|
29
|
+
this.username = username;
|
|
30
|
+
this.isUserAction = isUserAction;
|
|
31
|
+
this.data = data;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
|
|
3
|
+
import { SuperAgentRequest } from "superagent";
|
|
4
|
+
import { injectable } from "inversify";
|
|
5
|
+
import { CampaignsEntitiesConfigDto } from "./domain/campaign/CampaignsEntitiesConfig.dto";
|
|
6
|
+
import { ISuperAgentRequestFactory, SignedRequestSender } from "@studyportals/mb-platform-http-requests";
|
|
7
|
+
|
|
8
|
+
@injectable()
|
|
9
|
+
export class PrivateCampaignManagementAPIClient {
|
|
10
|
+
public constructor(
|
|
11
|
+
private readonly superAgentRequestFactory: ISuperAgentRequestFactory,
|
|
12
|
+
private readonly requestSender: SignedRequestSender,
|
|
13
|
+
private readonly baseUrl: string
|
|
14
|
+
) { }
|
|
15
|
+
|
|
16
|
+
public async addCampaignsEntitiesConfigs(campaignID: number, campaignsEntitiesConfigs: CampaignsEntitiesConfigDto[]): Promise<any> {
|
|
17
|
+
const path = `private/campaigns/add-campaigns-entities-configs`;
|
|
18
|
+
const data = {
|
|
19
|
+
campaignsEntitiesConfigs: campaignsEntitiesConfigs,
|
|
20
|
+
campaignID: campaignID
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return await this.postRequest(path, data);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public async removeCampaignsEntitiesConfigsByID(campaignID: number, campaignsEntitiesConfigsIDs: number[]): Promise<any> {
|
|
27
|
+
const path = `private/campaigns/remove-campaigns-entities-configs`;
|
|
28
|
+
const data = { campaignsEntitiesConfigsIDs: campaignsEntitiesConfigsIDs, campaignID: campaignID };
|
|
29
|
+
|
|
30
|
+
return await this.postRequest(path, data);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public async clearCampaignsEntitiesConfigsByCampaignID(campaignID: number): Promise<any> {
|
|
34
|
+
const path = `private/campaigns/clear-campaigns-entities-configs`;
|
|
35
|
+
const data = { campaignID: campaignID };
|
|
36
|
+
|
|
37
|
+
return await this.postRequest(path, data);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public async setEntitiesBasic(campaignID: number, organisationIDs: number[], studyIDs: number[]): Promise<any> {
|
|
41
|
+
const path = `private/campaigns/set-entities-basic`;
|
|
42
|
+
const data = {
|
|
43
|
+
organisationIDs: organisationIDs,
|
|
44
|
+
studyIDs: studyIDs,
|
|
45
|
+
campaignID: campaignID
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return await this.postRequest(path, data);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public async setEntitiesPremium(campaignID: number, organisationIDs: number[], studyIDs: number[]): Promise<any> {
|
|
52
|
+
const path = `private/campaigns/set-entities-premium`;
|
|
53
|
+
const data = {
|
|
54
|
+
organisationIDs: organisationIDs,
|
|
55
|
+
studyIDs: studyIDs,
|
|
56
|
+
campaignID: campaignID
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return await this.postRequest(path, data);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private async postRequest(relative: string = "", data: any): Promise<any> {
|
|
63
|
+
const request = this.createPostRequest(relative);
|
|
64
|
+
return await this.sendRequest(request, data);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private createPostRequest(relative: string = ""): SuperAgentRequest {
|
|
68
|
+
const url = this.buildBaseUrl(relative);
|
|
69
|
+
return this.superAgentRequestFactory.post(url);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private async sendRequest(request: SuperAgentRequest, payload: any): Promise<any> {
|
|
73
|
+
request.send(payload);
|
|
74
|
+
return await this.requestSender.send(request);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private buildBaseUrl(relative: string): string {
|
|
78
|
+
return `${this.baseUrl}/${relative}`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { suite, test } from "@testdeck/jest";
|
|
2
|
+
import { MockProxy, mock } from "jest-mock-extended";
|
|
3
|
+
import { assert } from "chai";
|
|
4
|
+
import { AuditorCampaignManagementAPIClient } from "../../../src/auditor-campaign-management-api.client";
|
|
5
|
+
import { IRequestSender, ISuperAgentRequestFactory, RequestSender } from "@studyportals/mb-platform-http-requests";
|
|
6
|
+
import { SuperAgentRequest } from "superagent";
|
|
7
|
+
import { AuditorOperation } from "../../../src/domain/auditor/enums/auditor-operation.enum";
|
|
8
|
+
import * as superagent from "superagent";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const superagentMock = require("superagent-mocker")(superagent);
|
|
12
|
+
|
|
13
|
+
@suite
|
|
14
|
+
class AuditorCampaignManagementAPIClientTest {
|
|
15
|
+
private auditorCampaignManagementAPIClient: AuditorCampaignManagementAPIClient;
|
|
16
|
+
private mockedRequestSender: MockProxy<IRequestSender> = mock<IRequestSender>();
|
|
17
|
+
private mockedRequest: MockProxy<SuperAgentRequest> = mock<SuperAgentRequest>();
|
|
18
|
+
private mockedSuperAgentRequestFactory: MockProxy<ISuperAgentRequestFactory> = mock<ISuperAgentRequestFactory>();
|
|
19
|
+
private mockedBaseUrl = "SomeBaseUrl";
|
|
20
|
+
|
|
21
|
+
public before() {
|
|
22
|
+
this.mockedSuperAgentRequestFactory.get.mockReturnValue(this.mockedRequest);
|
|
23
|
+
this.mockedSuperAgentRequestFactory.post.mockReturnValue(this.mockedRequest);
|
|
24
|
+
|
|
25
|
+
this.auditorCampaignManagementAPIClient = new AuditorCampaignManagementAPIClient(this.mockedBaseUrl);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@test()
|
|
29
|
+
public async getCampaignAuditorData__CorrectlyCalled() {
|
|
30
|
+
const receivedAuditorData = [
|
|
31
|
+
{
|
|
32
|
+
"id": 17428964,
|
|
33
|
+
"auditTime": "2023-00-00 13:55:09",
|
|
34
|
+
"operation": "update",
|
|
35
|
+
"entityID": 1,
|
|
36
|
+
"entityType": "campaign",
|
|
37
|
+
"username": "Jens Testing",
|
|
38
|
+
"isUserAction": true,
|
|
39
|
+
"data": "{\"geo\":[{\"s\":10000,\"o\":10000,\"c\":{\"sp\":1000,\"lp\":2000,\"p\":3000,\"b\":4000}},{\"s\":10000,\"o\":10000,\"c\":{\"sp\":1000,\"lp\":2000,\"p\":3000,\"b\":4000}},{\"s\":10000,\"o\":10000,\"c\":{\"sp\":1000,\"lp\":2000,\"p\":3000,\"b\":4000}}],\"pricing\":{\"s\":{\"100\":1000,\"200\":2000,\"300\":3000,\"400\":3000,\"500\":3000},\"o\":{\"100\":1000,\"200\":2000,\"300\":3000,\"400\":3000,\"500\":3000}},\"cpm\":{\"s\":{\"p\":1000,\"b\":2000},\"o\":{\"p\":1000,\"b\":2000}}}"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": 17428967,
|
|
43
|
+
"auditTime": "2023-00-00 14:55:54",
|
|
44
|
+
"operation": "update",
|
|
45
|
+
"entityID": 1,
|
|
46
|
+
"entityType": "campaign",
|
|
47
|
+
"username": "Jens Testing",
|
|
48
|
+
"isUserAction": true,
|
|
49
|
+
"data": "{\"geo\":[{\"s\":10000,\"o\":10000,\"c\":{\"sp\":1000,\"lp\":2000,\"p\":3000,\"b\":4000}},{\"s\":10000,\"o\":10000,\"c\":{\"sp\":1000,\"lp\":2000,\"p\":3000,\"b\":4000}},{\"s\":10000,\"o\":10000,\"c\":{\"sp\":1000,\"lp\":2000,\"p\":3000,\"b\":4000}}],\"pricing\":{\"s\":{\"100\":1000,\"200\":2000,\"300\":3000,\"400\":3000,\"500\":3000},\"o\":{\"100\":1000,\"200\":2000,\"300\":3000,\"400\":3000,\"500\":3000}},\"cpm\":{\"s\":{\"p\":1000,\"b\":2000},\"o\":{\"p\":1000,\"b\":2000}}}"
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
this.mockedRequestSender.sendAndExtractBody.mockResolvedValue(receivedAuditorData);
|
|
53
|
+
|
|
54
|
+
const campaignID = 1;
|
|
55
|
+
superagentMock.get(`${this.mockedBaseUrl}/auditor/campaigns/${campaignID}`, () => {
|
|
56
|
+
return {
|
|
57
|
+
body: receivedAuditorData
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const result = await this.auditorCampaignManagementAPIClient.getCampaignAuditorData(campaignID);
|
|
62
|
+
|
|
63
|
+
assert.equal(result[0].id, receivedAuditorData[0].id);
|
|
64
|
+
assert.equal(result[1].id, receivedAuditorData[1].id);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@test()
|
|
68
|
+
public async storeCampaignAuditorData__CorrectlyCalled() {
|
|
69
|
+
const sendData = {
|
|
70
|
+
"operation": "update",
|
|
71
|
+
"entityID": 1,
|
|
72
|
+
"username": "SomeName",
|
|
73
|
+
"isUserAction": true,
|
|
74
|
+
"data": {"some":"data"}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const id = 17428967;
|
|
78
|
+
const receivedData = {
|
|
79
|
+
"id": id,
|
|
80
|
+
"auditTime": "2023-00-00 14:55:54",
|
|
81
|
+
"operation": "update",
|
|
82
|
+
"entityID": 1,
|
|
83
|
+
"entityType": "campaign",
|
|
84
|
+
"username": "Jens Testing",
|
|
85
|
+
"isUserAction": true,
|
|
86
|
+
"data": "{\"geo\":[{\"s\":10000,\"o\":10000,\"c\":{\"sp\":1000,\"lp\":2000,\"p\":3000,\"b\":4000}},{\"s\":10000,\"o\":10000,\"c\":{\"sp\":1000,\"lp\":2000,\"p\":3000,\"b\":4000}},{\"s\":10000,\"o\":10000,\"c\":{\"sp\":1000,\"lp\":2000,\"p\":3000,\"b\":4000}}],\"pricing\":{\"s\":{\"100\":1000,\"200\":2000,\"300\":3000,\"400\":3000,\"500\":3000},\"o\":{\"100\":1000,\"200\":2000,\"300\":3000,\"400\":3000,\"500\":3000}},\"cpm\":{\"s\":{\"p\":1000,\"b\":2000},\"o\":{\"p\":1000,\"b\":2000}}}"
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
superagentMock.post(`${this.mockedBaseUrl}/auditor/campaigns`, () => {
|
|
90
|
+
return {
|
|
91
|
+
body: receivedData
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const result = await this.auditorCampaignManagementAPIClient.storeCampaignAuditorData(AuditorOperation.UPDATE, sendData.entityID, sendData.username, sendData.isUserAction, sendData.data);
|
|
96
|
+
|
|
97
|
+
assert.equal(result.id, id);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { suite, test } from "@testdeck/jest";
|
|
2
|
+
import { assert } from "chai";
|
|
3
|
+
import { AuditorEntityType } from "../../../../src/domain/auditor/enums/auditor-entity-type.enum";
|
|
4
|
+
|
|
5
|
+
@suite
|
|
6
|
+
class AuditorEntityTypeEnumTest {
|
|
7
|
+
@test()
|
|
8
|
+
public hasEnumValues_ExpectedValues_Successful() {
|
|
9
|
+
const auditorEntityKeys = this.getAllEntityKeys();
|
|
10
|
+
|
|
11
|
+
assert.isTrue(auditorEntityKeys.length === 1);
|
|
12
|
+
|
|
13
|
+
assert.isTrue(AuditorEntityType.CAMPAIGN === "campaign");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
private getAllEntityKeys(): string[] {
|
|
18
|
+
return [
|
|
19
|
+
"CAMPAIGN"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { suite, test } from "@testdeck/jest";
|
|
2
|
+
import { assert } from "chai";
|
|
3
|
+
import { AuditorOperation } from "../../../../src/domain/auditor/enums/auditor-operation.enum";
|
|
4
|
+
|
|
5
|
+
@suite
|
|
6
|
+
class AuditorOperationEnumTest {
|
|
7
|
+
@test()
|
|
8
|
+
public hasEnumValues_ExpectedValues_Successful() {
|
|
9
|
+
const auditorEntityKeys = this.getAllEntityKeys();
|
|
10
|
+
|
|
11
|
+
assert.isTrue(auditorEntityKeys.length === 7);
|
|
12
|
+
|
|
13
|
+
assert.isTrue(AuditorOperation.CLEANUP === "cleanup");
|
|
14
|
+
assert.isTrue(AuditorOperation.UPDATE === "update");
|
|
15
|
+
assert.isTrue(AuditorOperation.CREATE === "create");
|
|
16
|
+
assert.isTrue(AuditorOperation.LINK === "link");
|
|
17
|
+
assert.isTrue(AuditorOperation.UNLINK === "unlink");
|
|
18
|
+
assert.isTrue(AuditorOperation.DELETE === "delete");
|
|
19
|
+
assert.isTrue(AuditorOperation.ENDOR === "endor");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
private getAllEntityKeys(): string[] {
|
|
24
|
+
return [
|
|
25
|
+
"CLEANUP",
|
|
26
|
+
"UPDATE",
|
|
27
|
+
"CREATE",
|
|
28
|
+
"LINK",
|
|
29
|
+
"UNLINK",
|
|
30
|
+
"DELETE",
|
|
31
|
+
"ENDOR"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { UTCDateTime } from "@studyportals/mb-platform-date-time";
|
|
2
|
+
import { suite, test } from "@testdeck/jest";
|
|
3
|
+
import { assert } from "chai";
|
|
4
|
+
import { AuditorEntityType } from "../../../src/domain/auditor/enums/auditor-entity-type.enum";
|
|
5
|
+
import { AuditorOperation } from "../../../src/domain/auditor/enums/auditor-operation.enum";
|
|
6
|
+
import { GetAuditorDto } from "../../../src/domain/auditor/get-auditor.dto";
|
|
7
|
+
|
|
8
|
+
@suite
|
|
9
|
+
class GetAuditorEntityTest {
|
|
10
|
+
@test()
|
|
11
|
+
public hasEnumValues_ExpectedValues_Successful() {
|
|
12
|
+
const id = 1;
|
|
13
|
+
const auditTime = UTCDateTime.now().toString();
|
|
14
|
+
const operation = AuditorOperation.CREATE;
|
|
15
|
+
const entityID = 2;
|
|
16
|
+
const entityType = AuditorEntityType.CAMPAIGN;
|
|
17
|
+
const username = "SomeUser";
|
|
18
|
+
const isUserAction = true;
|
|
19
|
+
const data = {
|
|
20
|
+
"SomeDataKey": "SomeDataValue"
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const getAuditorEntity = new GetAuditorDto(id, auditTime, operation, entityID, entityType, username, isUserAction, data);
|
|
24
|
+
|
|
25
|
+
assert.equal(getAuditorEntity.id, id);
|
|
26
|
+
assert.equal(getAuditorEntity.auditTime, auditTime);
|
|
27
|
+
assert.equal(getAuditorEntity.operation, operation);
|
|
28
|
+
assert.equal(getAuditorEntity.entityID, entityID);
|
|
29
|
+
assert.equal(getAuditorEntity.entityType, entityType);
|
|
30
|
+
assert.equal(getAuditorEntity.username, username);
|
|
31
|
+
assert.equal(getAuditorEntity.isUserAction, isUserAction);
|
|
32
|
+
assert.equal(getAuditorEntity.data, data);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { suite, test } from "@testdeck/jest";
|
|
2
|
+
import { MockProxy, mock } from "jest-mock-extended";
|
|
3
|
+
import { assert } from "chai";
|
|
4
|
+
import { ISuperAgentRequestFactory } from "@studyportals/mb-platform-http-requests";
|
|
5
|
+
import { SuperAgentRequest } from "superagent";
|
|
6
|
+
import * as superagent from "superagent";
|
|
7
|
+
import { CampaignManagementAPIClient } from "../../../src/campaign-management-api.client";
|
|
8
|
+
import { CampaignsEntitiesConfigDto } from "../../../src/domain/campaign/CampaignsEntitiesConfig.dto";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const superagentMock = require("superagent-mocker")(superagent);
|
|
12
|
+
|
|
13
|
+
@suite
|
|
14
|
+
class CampaignManagementAPIClientTest {
|
|
15
|
+
private campaignManagementAPIClient: CampaignManagementAPIClient;
|
|
16
|
+
private mockedRequest: MockProxy<SuperAgentRequest> = mock<SuperAgentRequest>();
|
|
17
|
+
private mockedSuperAgentRequestFactory: MockProxy<ISuperAgentRequestFactory> = mock<ISuperAgentRequestFactory>();
|
|
18
|
+
private mockedBaseUrl = "SomeBaseUrl";
|
|
19
|
+
|
|
20
|
+
public before() {
|
|
21
|
+
this.mockedSuperAgentRequestFactory.post.mockReturnValue(this.mockedRequest);
|
|
22
|
+
|
|
23
|
+
this.campaignManagementAPIClient = new CampaignManagementAPIClient(this.mockedBaseUrl);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@test()
|
|
27
|
+
public async addCampaignsEntitiesConfigs__CorrectlyCalled() {
|
|
28
|
+
const postData: CampaignsEntitiesConfigDto = {
|
|
29
|
+
campaign_id: 1,
|
|
30
|
+
sp_id: 1,
|
|
31
|
+
product_id: 12,
|
|
32
|
+
product2_id: null,
|
|
33
|
+
type: "study"
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
superagentMock.post(`${this.mockedBaseUrl}/campaigns/add-campaigns-entities-configs`, () => {});
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const result = await this.campaignManagementAPIClient.addCampaignsEntitiesConfigs(1, [postData]);
|
|
40
|
+
} catch {
|
|
41
|
+
assert.fail();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
assert.ok(true);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@test()
|
|
48
|
+
public async removeCampaignsEntitiesConfigsByID__CorrectlyCalled() {
|
|
49
|
+
const campaignID = 1;
|
|
50
|
+
const entityIDs = [ 1 ];
|
|
51
|
+
|
|
52
|
+
superagentMock.post(`${this.mockedBaseUrl}/campaigns/remove-campaigns-entities-configs`, () => {});
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
const result = await this.campaignManagementAPIClient.removeCampaignsEntitiesConfigsByID(campaignID, entityIDs);
|
|
56
|
+
} catch {
|
|
57
|
+
assert.fail();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
assert.ok(true);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@test()
|
|
64
|
+
public async clearCampaignsEntitiesConfigsByCampaignID__CorrectlyCalled() {
|
|
65
|
+
const postData = 1;
|
|
66
|
+
|
|
67
|
+
superagentMock.post(`${this.mockedBaseUrl}/campaigns/clear-campaigns-entities-configs`, () => {});
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
const result = await this.campaignManagementAPIClient.clearCampaignsEntitiesConfigsByCampaignID(postData);
|
|
71
|
+
} catch {
|
|
72
|
+
assert.fail();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
assert.ok(true);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@test()
|
|
79
|
+
public async setEntitiesBasic__CorrectlyCalled() {
|
|
80
|
+
const campaignID = 1;
|
|
81
|
+
const organisationIDs = [1];
|
|
82
|
+
const studyIDs = [5];
|
|
83
|
+
|
|
84
|
+
superagentMock.post(`${this.mockedBaseUrl}/campaigns/set-entities-basic`, () => {});
|
|
85
|
+
|
|
86
|
+
try {
|
|
87
|
+
const result = await this.campaignManagementAPIClient.setEntitiesBasic(campaignID, organisationIDs, studyIDs);
|
|
88
|
+
} catch {
|
|
89
|
+
assert.fail();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
assert.ok(true);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@test()
|
|
96
|
+
public async setEntitiesPremium__CorrectlyCalled() {
|
|
97
|
+
const campaignID = 1;
|
|
98
|
+
const organisationIDs = [1];
|
|
99
|
+
const studyIDs = [5];
|
|
100
|
+
|
|
101
|
+
superagentMock.post(`${this.mockedBaseUrl}/campaigns/set-entities-premium`, () => {});
|
|
102
|
+
|
|
103
|
+
try {
|
|
104
|
+
const result = await this.campaignManagementAPIClient.setEntitiesPremium(campaignID, organisationIDs, studyIDs);
|
|
105
|
+
} catch {
|
|
106
|
+
assert.fail();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
assert.ok(true);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { suite, test } from "@testdeck/jest";
|
|
2
|
+
import { MockProxy, mock } from "jest-mock-extended";
|
|
3
|
+
import { assert } from "chai";
|
|
4
|
+
import { ISuperAgentRequestFactory, SignedRequestSender } from "@studyportals/mb-platform-http-requests";
|
|
5
|
+
import { SuperAgentRequest } from "superagent";
|
|
6
|
+
import * as superagent from "superagent";
|
|
7
|
+
import { CampaignsEntitiesConfigDto } from "../../../src/domain/campaign/CampaignsEntitiesConfig.dto";
|
|
8
|
+
import { PrivateCampaignManagementAPIClient } from "../../../src/private-campaign-management-api.client";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const superagentMock = require("superagent-mocker")(superagent);
|
|
12
|
+
|
|
13
|
+
@suite
|
|
14
|
+
class PrivateCampaignManagementAPIClientTest {
|
|
15
|
+
private privateCampaignManagementAPIClient: PrivateCampaignManagementAPIClient;
|
|
16
|
+
private mockedRequest: MockProxy<SuperAgentRequest> = mock<SuperAgentRequest>();
|
|
17
|
+
private mockedSuperAgentRequestFactory: MockProxy<ISuperAgentRequestFactory> = mock<ISuperAgentRequestFactory>();
|
|
18
|
+
private mockedResponse: MockProxy<superagent.Response> = mock<superagent.Response>();
|
|
19
|
+
private mockedSignedRequestSender: MockProxy<SignedRequestSender> = mock<SignedRequestSender>();
|
|
20
|
+
private mockedBaseUrl = "SomeBaseUrl";
|
|
21
|
+
|
|
22
|
+
public before() {
|
|
23
|
+
this.mockedSuperAgentRequestFactory.post.mockReturnValue(this.mockedRequest);
|
|
24
|
+
this.mockedSignedRequestSender.send.mockReturnValue(Promise.resolve(this.mockedResponse));
|
|
25
|
+
|
|
26
|
+
this.privateCampaignManagementAPIClient = new PrivateCampaignManagementAPIClient(this.mockedSuperAgentRequestFactory, this.mockedSignedRequestSender, this.mockedBaseUrl);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@test()
|
|
30
|
+
public async addCampaignsEntitiesConfigs__CorrectlyCalled() {
|
|
31
|
+
const postData: CampaignsEntitiesConfigDto = {
|
|
32
|
+
campaign_id: 1,
|
|
33
|
+
sp_id: 1,
|
|
34
|
+
product_id: 12,
|
|
35
|
+
product2_id: null,
|
|
36
|
+
type: "study"
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
superagentMock.post(`${this.mockedBaseUrl}/private/campaigns/add-campaigns-entities-configs`, () => {});
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
const result = await this.privateCampaignManagementAPIClient.addCampaignsEntitiesConfigs(1, [postData]);
|
|
43
|
+
} catch {
|
|
44
|
+
assert.fail();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
assert.ok(true);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@test()
|
|
51
|
+
public async removeCampaignsEntitiesConfigsByID__CorrectlyCalled() {
|
|
52
|
+
const campaignID = 1;
|
|
53
|
+
const entityIDs = [ 1 ];
|
|
54
|
+
|
|
55
|
+
superagentMock.post(`${this.mockedBaseUrl}/private/campaigns/remove-campaigns-entities-configs`, () => {});
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
const result = await this.privateCampaignManagementAPIClient.removeCampaignsEntitiesConfigsByID(campaignID, entityIDs);
|
|
59
|
+
} catch {
|
|
60
|
+
assert.fail();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
assert.ok(true);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@test()
|
|
67
|
+
public async clearCampaignsEntitiesConfigsByCampaignID__CorrectlyCalled() {
|
|
68
|
+
const postData = 1;
|
|
69
|
+
|
|
70
|
+
superagentMock.post(`${this.mockedBaseUrl}/private/campaigns/clear-campaigns-entities-configs`, () => {});
|
|
71
|
+
|
|
72
|
+
try {
|
|
73
|
+
const result = await this.privateCampaignManagementAPIClient.clearCampaignsEntitiesConfigsByCampaignID(postData);
|
|
74
|
+
} catch {
|
|
75
|
+
assert.fail();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
assert.ok(true);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@test()
|
|
82
|
+
public async setEntitiesBasic__CorrectlyCalled() {
|
|
83
|
+
const campaignID = 1;
|
|
84
|
+
const organisationIDs = [1];
|
|
85
|
+
const studyIDs = [5];
|
|
86
|
+
|
|
87
|
+
superagentMock.post(`${this.mockedBaseUrl}/private/campaigns/set-entities-basic`, () => {});
|
|
88
|
+
|
|
89
|
+
try {
|
|
90
|
+
const result = await this.privateCampaignManagementAPIClient.setEntitiesBasic(campaignID, organisationIDs, studyIDs);
|
|
91
|
+
} catch {
|
|
92
|
+
assert.fail();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
assert.ok(true);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@test()
|
|
99
|
+
public async setEntitiesPremium__CorrectlyCalled() {
|
|
100
|
+
const campaignID = 1;
|
|
101
|
+
const organisationIDs = [1];
|
|
102
|
+
const studyIDs = [5];
|
|
103
|
+
|
|
104
|
+
superagentMock.post(`${this.mockedBaseUrl}/private/campaigns/set-entities-premium`, () => {});
|
|
105
|
+
|
|
106
|
+
try {
|
|
107
|
+
const result = await this.privateCampaignManagementAPIClient.setEntitiesPremium(campaignID, organisationIDs, studyIDs);
|
|
108
|
+
} catch {
|
|
109
|
+
assert.fail();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
assert.ok(true);
|
|
113
|
+
}
|
|
114
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
|
|
4
|
+
"outDir": "bin",
|
|
5
|
+
"rootDir": ".",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
|
|
8
|
+
"alwaysStrict": true,
|
|
9
|
+
"strictNullChecks": true,
|
|
10
|
+
|
|
11
|
+
"allowJs": false,
|
|
12
|
+
"allowUnreachableCode": false,
|
|
13
|
+
"allowUnusedLabels": false,
|
|
14
|
+
|
|
15
|
+
"noUnusedLocals": false,
|
|
16
|
+
"noUnusedParameters": false,
|
|
17
|
+
|
|
18
|
+
"noFallthroughCasesInSwitch": true,
|
|
19
|
+
"noImplicitAny": true,
|
|
20
|
+
"noImplicitReturns": true,
|
|
21
|
+
"noImplicitThis": true,
|
|
22
|
+
|
|
23
|
+
"sourceMap": true,
|
|
24
|
+
"declaration": true,
|
|
25
|
+
|
|
26
|
+
"target": "es2017",
|
|
27
|
+
"lib": ["es2017", "dom"],
|
|
28
|
+
"module": "commonjs",
|
|
29
|
+
|
|
30
|
+
"experimentalDecorators": true,
|
|
31
|
+
"emitDecoratorMetadata": true,
|
|
32
|
+
|
|
33
|
+
"types": [ ]
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
"typeRoots": [ "node_modules/@types/" ],
|
|
37
|
+
|
|
38
|
+
"exclude": [ "node_modules", "bin" ]
|
|
39
|
+
}
|
package/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Pricing = exports.CampaignsEntitiesConfigDto = exports.GetAuditorDto = exports.AuditorOperation = exports.AuditorEntityType = exports.CampaignManagementAPIClient = exports.AuditorCampaignManagementAPIClient = void 0;
|
|
4
|
-
const auditor_campaign_management_api_client_1 = require("./src/auditor-campaign-management-api.client");
|
|
5
|
-
Object.defineProperty(exports, "AuditorCampaignManagementAPIClient", { enumerable: true, get: function () { return auditor_campaign_management_api_client_1.AuditorCampaignManagementAPIClient; } });
|
|
6
|
-
const campaign_management_api_client_1 = require("./src/campaign-management-api.client");
|
|
7
|
-
Object.defineProperty(exports, "CampaignManagementAPIClient", { enumerable: true, get: function () { return campaign_management_api_client_1.CampaignManagementAPIClient; } });
|
|
8
|
-
const auditor_entity_type_enum_1 = require("./src/domain/auditor/enums/auditor-entity-type.enum");
|
|
9
|
-
Object.defineProperty(exports, "AuditorEntityType", { enumerable: true, get: function () { return auditor_entity_type_enum_1.AuditorEntityType; } });
|
|
10
|
-
const auditor_operation_enum_1 = require("./src/domain/auditor/enums/auditor-operation.enum");
|
|
11
|
-
Object.defineProperty(exports, "AuditorOperation", { enumerable: true, get: function () { return auditor_operation_enum_1.AuditorOperation; } });
|
|
12
|
-
const get_auditor_dto_1 = require("./src/domain/auditor/get-auditor.dto");
|
|
13
|
-
Object.defineProperty(exports, "GetAuditorDto", { enumerable: true, get: function () { return get_auditor_dto_1.GetAuditorDto; } });
|
|
14
|
-
const CampaignsEntitiesConfig_dto_1 = require("./src/domain/campaign/CampaignsEntitiesConfig.dto");
|
|
15
|
-
Object.defineProperty(exports, "CampaignsEntitiesConfigDto", { enumerable: true, get: function () { return CampaignsEntitiesConfig_dto_1.CampaignsEntitiesConfigDto; } });
|
|
16
|
-
const geotargeting_entities_1 = require("./src/domain/auditor/campaigns/geotargeting.entities");
|
|
17
|
-
Object.defineProperty(exports, "Pricing", { enumerable: true, get: function () { return geotargeting_entities_1.Pricing; } });
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
package/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,yGAAkG;AAU9F,mHAVK,2EAAkC,OAUL;AATtC,yFAAmF;AAU/E,4GAVK,4DAA2B,OAUL;AAT/B,kGAAwF;AAYpF,kGAZK,4CAAiB,OAYL;AAXrB,8FAAqF;AAYjF,iGAZK,yCAAgB,OAYL;AAXpB,0EAAqE;AAcjE,8FAdK,+BAAa,OAcL;AAbjB,mGAA+F;AAgB3F,2GAhBK,wDAA0B,OAgBL;AAf9B,gGAAgH;AAkB5G,wFAlBgB,+BAAO,OAkBhB"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import "reflect-metadata";
|
|
2
|
-
import { GetAuditorDto } from "./domain/auditor/get-auditor.dto";
|
|
3
|
-
import { AuditorOperation } from "./domain/auditor/enums/auditor-operation.enum";
|
|
4
|
-
export declare class AuditorCampaignManagementAPIClient {
|
|
5
|
-
private readonly baseUrl;
|
|
6
|
-
constructor(baseUrl: string);
|
|
7
|
-
getCampaignAuditorData(campaignID: number, jwt?: string): Promise<GetAuditorDto[]>;
|
|
8
|
-
storeCampaignAuditorData(operation: AuditorOperation, campaignID: number, username: string, isUserAction: boolean, data: any, jwt?: string): Promise<GetAuditorDto>;
|
|
9
|
-
private getRequest;
|
|
10
|
-
private postRequest;
|
|
11
|
-
private buildBaseUrl;
|
|
12
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.AuditorCampaignManagementAPIClient = void 0;
|
|
13
|
-
require("reflect-metadata");
|
|
14
|
-
const inversify_1 = require("inversify");
|
|
15
|
-
const superagent = require("superagent");
|
|
16
|
-
let AuditorCampaignManagementAPIClient = class AuditorCampaignManagementAPIClient {
|
|
17
|
-
constructor(baseUrl) {
|
|
18
|
-
this.baseUrl = baseUrl;
|
|
19
|
-
}
|
|
20
|
-
async getCampaignAuditorData(campaignID, jwt = "") {
|
|
21
|
-
const result = await this.getRequest(`auditor/campaigns/${campaignID}`, jwt);
|
|
22
|
-
const getAuditorDtos = result.body;
|
|
23
|
-
return getAuditorDtos;
|
|
24
|
-
}
|
|
25
|
-
async storeCampaignAuditorData(operation, campaignID, username, isUserAction, data, jwt = "") {
|
|
26
|
-
const sendData = {
|
|
27
|
-
"operation": operation,
|
|
28
|
-
"entityID": campaignID,
|
|
29
|
-
"username": username,
|
|
30
|
-
"isUserAction": isUserAction,
|
|
31
|
-
"data": data
|
|
32
|
-
};
|
|
33
|
-
const result = await this.postRequest(`auditor/campaigns`, sendData, jwt);
|
|
34
|
-
return result.body;
|
|
35
|
-
}
|
|
36
|
-
async getRequest(relative = "", jwt = "") {
|
|
37
|
-
return await superagent.get(this.buildBaseUrl(relative))
|
|
38
|
-
.set("Content-Type", "application/json")
|
|
39
|
-
.set("Authorization", jwt);
|
|
40
|
-
}
|
|
41
|
-
async postRequest(relative = "", data, jwt = "") {
|
|
42
|
-
return await superagent.post(this.buildBaseUrl(relative))
|
|
43
|
-
.set("Content-Type", "application/json")
|
|
44
|
-
.set("Authorization", jwt)
|
|
45
|
-
.send(data);
|
|
46
|
-
}
|
|
47
|
-
buildBaseUrl(relative) {
|
|
48
|
-
return `${this.baseUrl}/${relative}`;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
AuditorCampaignManagementAPIClient = __decorate([
|
|
52
|
-
(0, inversify_1.injectable)(),
|
|
53
|
-
__metadata("design:paramtypes", [String])
|
|
54
|
-
], AuditorCampaignManagementAPIClient);
|
|
55
|
-
exports.AuditorCampaignManagementAPIClient = AuditorCampaignManagementAPIClient;
|
|
56
|
-
//# sourceMappingURL=auditor-campaign-management-api.client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auditor-campaign-management-api.client.js","sourceRoot":"","sources":["../../src/auditor-campaign-management-api.client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4BAA0B;AAK1B,yCAAuC;AAEvC,yCAAyC;AAGlC,IAAM,kCAAkC,GAAxC,MAAM,kCAAkC;IAC3C,YACqB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAChC,CAAC;IAEE,KAAK,CAAC,sBAAsB,CAAC,UAAkB,EAAE,GAAG,GAAG,EAAE;QAC5D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,qBAAqB,UAAU,EAAE,EAAE,GAAG,CAAC,CAAC;QAC7E,MAAM,cAAc,GAAG,MAAM,CAAC,IAAuB,CAAC;QAEtD,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEM,KAAK,CAAC,wBAAwB,CAAC,SAA2B,EAAE,UAAkB,EAAE,QAAgB,EAAE,YAAqB,EAAE,IAAS,EAAE,GAAG,GAAG,EAAE;QAC/I,MAAM,QAAQ,GAAG;YACb,WAAW,EAAE,SAAS;YACtB,UAAU,EAAE,UAAU;YACtB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,YAAY;YAC5B,MAAM,EAAE,IAAI;SACf,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,mBAAmB,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;QAE1E,OAAO,MAAM,CAAC,IAAqB,CAAC;IACxC,CAAC;IAGO,KAAK,CAAC,UAAU,CAAC,WAAmB,EAAE,EAAE,GAAG,GAAG,EAAE;QACpD,OAAO,MAAM,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;aACnD,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC;aACvC,GAAG,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;IACnC,CAAC;IAEO,KAAK,CAAC,WAAW,CAAC,WAAmB,EAAE,EAAE,IAAS,EAAE,GAAG,GAAG,EAAE;QAChE,OAAO,MAAM,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;aACpD,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC;aACvC,GAAG,CAAC,eAAe,EAAE,GAAG,CAAC;aACzB,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAEO,YAAY,CAAC,QAAgB;QACjC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,QAAQ,EAAE,CAAC;IACzC,CAAC;CACJ,CAAA;AA3CY,kCAAkC;IAD9C,IAAA,sBAAU,GAAE;;GACA,kCAAkC,CA2C9C;AA3CY,gFAAkC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import "reflect-metadata";
|
|
2
|
-
import { CampaignsEntitiesConfigDto } from "./domain/campaign/CampaignsEntitiesConfig.dto";
|
|
3
|
-
export declare class CampaignManagementAPIClient {
|
|
4
|
-
private readonly baseUrl;
|
|
5
|
-
constructor(baseUrl: string);
|
|
6
|
-
addCampaignsEntitiesConfigs(campaignsEntitiesConfigs: CampaignsEntitiesConfigDto[]): Promise<void>;
|
|
7
|
-
removeCampaignsEntitiesConfigsByID(campaignID: number, campaignsEntitiesConfigsIDs: number[]): Promise<void>;
|
|
8
|
-
clearCampaignsEntitiesConfigsByCampaignID(campaignID: number): Promise<void>;
|
|
9
|
-
setEntitiesBasic(organisationIDs: number[], studyIDs: number[]): Promise<void>;
|
|
10
|
-
setEntitiesPremium(organisationIDs: number[], studyIDs: number[]): Promise<void>;
|
|
11
|
-
private postRequest;
|
|
12
|
-
private buildBaseUrl;
|
|
13
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CampaignManagementAPIClient = void 0;
|
|
13
|
-
require("reflect-metadata");
|
|
14
|
-
const inversify_1 = require("inversify");
|
|
15
|
-
const superagent = require("superagent");
|
|
16
|
-
let CampaignManagementAPIClient = class CampaignManagementAPIClient {
|
|
17
|
-
constructor(baseUrl) {
|
|
18
|
-
this.baseUrl = baseUrl;
|
|
19
|
-
}
|
|
20
|
-
async addCampaignsEntitiesConfigs(campaignsEntitiesConfigs) {
|
|
21
|
-
const path = `campaigns/add-campaigns-entities-configs`;
|
|
22
|
-
const data = { campaignsEntitiesConfigs: campaignsEntitiesConfigs };
|
|
23
|
-
const result = await this.postRequest(path, data);
|
|
24
|
-
}
|
|
25
|
-
async removeCampaignsEntitiesConfigsByID(campaignID, campaignsEntitiesConfigsIDs) {
|
|
26
|
-
const path = `campaigns/remove-campaigns-entities-configs`;
|
|
27
|
-
const data = { campaignsEntitiesConfigsIDs: campaignsEntitiesConfigsIDs, campaignID: campaignID };
|
|
28
|
-
const result = await this.postRequest(path, data);
|
|
29
|
-
}
|
|
30
|
-
async clearCampaignsEntitiesConfigsByCampaignID(campaignID) {
|
|
31
|
-
const path = `campaigns/clear-campaigns-entities-configs`;
|
|
32
|
-
const data = { campaignID: campaignID };
|
|
33
|
-
const result = await this.postRequest(path, data);
|
|
34
|
-
}
|
|
35
|
-
async setEntitiesBasic(organisationIDs, studyIDs) {
|
|
36
|
-
const path = `campaigns/set-entities-basic`;
|
|
37
|
-
const data = { organisationIDs: organisationIDs, studyIDs: studyIDs };
|
|
38
|
-
const result = await this.postRequest(path, data);
|
|
39
|
-
}
|
|
40
|
-
async setEntitiesPremium(organisationIDs, studyIDs) {
|
|
41
|
-
const path = `campaigns/set-entities-premium`;
|
|
42
|
-
const data = { organisationIDs: organisationIDs, studyIDs: studyIDs };
|
|
43
|
-
const result = await this.postRequest(path, data);
|
|
44
|
-
}
|
|
45
|
-
async postRequest(relative = "", data) {
|
|
46
|
-
return await superagent.post(this.buildBaseUrl(relative)).set("Content-Type", "application/json").send(data);
|
|
47
|
-
}
|
|
48
|
-
buildBaseUrl(relative) {
|
|
49
|
-
return `${this.baseUrl}/${relative}`;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
CampaignManagementAPIClient = __decorate([
|
|
53
|
-
(0, inversify_1.injectable)(),
|
|
54
|
-
__metadata("design:paramtypes", [String])
|
|
55
|
-
], CampaignManagementAPIClient);
|
|
56
|
-
exports.CampaignManagementAPIClient = CampaignManagementAPIClient;
|
|
57
|
-
//# sourceMappingURL=campaign-management-api.client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"campaign-management-api.client.js","sourceRoot":"","sources":["../../src/campaign-management-api.client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4BAA0B;AAG1B,yCAAuC;AAGvC,yCAAyC;AAGlC,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IACvC,YACkB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAC7B,CAAC;IAEE,KAAK,CAAC,2BAA2B,CAAC,wBAAsD;QAC9F,MAAM,IAAI,GAAG,0CAA0C,CAAC;QACxD,MAAM,IAAI,GAAG,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,CAAC;QAEpE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;IAEM,KAAK,CAAC,kCAAkC,CAAC,UAAkB,EAAE,2BAAqC;QACxG,MAAM,IAAI,GAAG,6CAA6C,CAAC;QAC3D,MAAM,IAAI,GAAG,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;QAElG,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;IAEM,KAAK,CAAC,yCAAyC,CAAC,UAAkB;QACxE,MAAM,IAAI,GAAG,4CAA4C,CAAC;QAC1D,MAAM,IAAI,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;QAExC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,eAAyB,EAAE,QAAkB;QAC1E,MAAM,IAAI,GAAG,8BAA8B,CAAC;QAC5C,MAAM,IAAI,GAAG,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;QAEtE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAC,eAAyB,EAAE,QAAkB;QAC5E,MAAM,IAAI,GAAG,gCAAgC,CAAC;QAC9C,MAAM,IAAI,GAAG,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;QAEtE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;IAEO,KAAK,CAAC,WAAW,CAAC,WAAmB,EAAE,EAAE,IAAS;QACnD,OAAO,MAAM,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpH,CAAC;IAEO,YAAY,CAAC,QAAgB;QACpC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,QAAQ,EAAE,CAAC;IACtC,CAAC;CACD,CAAA;AA/CY,2BAA2B;IADvC,IAAA,sBAAU,GAAE;;GACA,2BAA2B,CA+CvC;AA/CY,kEAA2B"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
interface NumberMap {
|
|
2
|
-
[key: string]: number;
|
|
3
|
-
}
|
|
4
|
-
interface ICampaignAuditorData {
|
|
5
|
-
geo: any[];
|
|
6
|
-
pricing: Pricing;
|
|
7
|
-
geo_remainders: NumberMap;
|
|
8
|
-
}
|
|
9
|
-
declare class Pricing {
|
|
10
|
-
s: NumberMap;
|
|
11
|
-
o: NumberMap;
|
|
12
|
-
constructor(s?: NumberMap, o?: NumberMap);
|
|
13
|
-
}
|
|
14
|
-
export { ICampaignAuditorData, NumberMap, Pricing };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Pricing = void 0;
|
|
4
|
-
class Pricing {
|
|
5
|
-
constructor(s = {}, o = {}) {
|
|
6
|
-
this.s = s;
|
|
7
|
-
this.o = o;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.Pricing = Pricing;
|
|
11
|
-
//# sourceMappingURL=geotargeting.entities.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"geotargeting.entities.js","sourceRoot":"","sources":["../../../../../src/domain/auditor/campaigns/geotargeting.entities.ts"],"names":[],"mappings":";;;AAQA,MAAM,OAAO;IACT,YACW,IAAe,EAAE,EACjB,IAAe,EAAE;QADjB,MAAC,GAAD,CAAC,CAAgB;QACjB,MAAC,GAAD,CAAC,CAAgB;IACzB,CAAC;CACP;AAKG,0BAAO"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuditorEntityType = void 0;
|
|
4
|
-
var AuditorEntityType;
|
|
5
|
-
(function (AuditorEntityType) {
|
|
6
|
-
AuditorEntityType["CAMPAIGN"] = "campaign";
|
|
7
|
-
})(AuditorEntityType = exports.AuditorEntityType || (exports.AuditorEntityType = {}));
|
|
8
|
-
//# sourceMappingURL=auditor-entity-type.enum.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auditor-entity-type.enum.js","sourceRoot":"","sources":["../../../../../src/domain/auditor/enums/auditor-entity-type.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAEX;AAFD,WAAY,iBAAiB;IACzB,0CAAqB,CAAA;AACzB,CAAC,EAFW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAE5B"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuditorOperation = void 0;
|
|
4
|
-
var AuditorOperation;
|
|
5
|
-
(function (AuditorOperation) {
|
|
6
|
-
AuditorOperation["CLEANUP"] = "cleanup";
|
|
7
|
-
AuditorOperation["UPDATE"] = "update";
|
|
8
|
-
AuditorOperation["CREATE"] = "create";
|
|
9
|
-
AuditorOperation["LINK"] = "link";
|
|
10
|
-
AuditorOperation["UNLINK"] = "unlink";
|
|
11
|
-
AuditorOperation["DELETE"] = "delete";
|
|
12
|
-
AuditorOperation["ENDOR"] = "endor";
|
|
13
|
-
})(AuditorOperation = exports.AuditorOperation || (exports.AuditorOperation = {}));
|
|
14
|
-
//# sourceMappingURL=auditor-operation.enum.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auditor-operation.enum.js","sourceRoot":"","sources":["../../../../../src/domain/auditor/enums/auditor-operation.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,gBAQX;AARD,WAAY,gBAAgB;IACxB,uCAAmB,CAAA;IACnB,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;IACjB,iCAAa,CAAA;IACb,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;IACjB,mCAAe,CAAA;AACnB,CAAC,EARW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAQ3B"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AuditorEntityType } from "./enums/auditor-entity-type.enum";
|
|
2
|
-
import { AuditorOperation } from "./enums/auditor-operation.enum";
|
|
3
|
-
export declare class GetAuditorDto {
|
|
4
|
-
readonly id: number;
|
|
5
|
-
readonly auditTime: string;
|
|
6
|
-
readonly operation: AuditorOperation;
|
|
7
|
-
readonly entityID: number;
|
|
8
|
-
readonly entityType: AuditorEntityType;
|
|
9
|
-
readonly username: string;
|
|
10
|
-
readonly isUserAction: boolean;
|
|
11
|
-
readonly data: any;
|
|
12
|
-
constructor(id: number, auditTime: string, operation: AuditorOperation, entityID: number, entityType: AuditorEntityType, username: string, isUserAction: boolean, data: any);
|
|
13
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetAuditorDto = void 0;
|
|
4
|
-
class GetAuditorDto {
|
|
5
|
-
constructor(id, auditTime, operation, entityID, entityType, username, isUserAction, data) {
|
|
6
|
-
this.id = id;
|
|
7
|
-
this.auditTime = auditTime;
|
|
8
|
-
this.operation = operation;
|
|
9
|
-
this.entityID = entityID;
|
|
10
|
-
this.entityType = entityType;
|
|
11
|
-
this.username = username;
|
|
12
|
-
this.isUserAction = isUserAction;
|
|
13
|
-
this.data = data;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.GetAuditorDto = GetAuditorDto;
|
|
17
|
-
//# sourceMappingURL=get-auditor.dto.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-auditor.dto.js","sourceRoot":"","sources":["../../../../src/domain/auditor/get-auditor.dto.ts"],"names":[],"mappings":";;;AAGA,MAAa,aAAa;IAUtB,YACI,EAAU,EACV,SAAiB,EACjB,SAA2B,EAC3B,QAAgB,EAChB,UAA6B,EAC7B,QAAgB,EAChB,YAAqB,EACrB,IAAS;QAET,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;CACJ;AA7BD,sCA6BC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CampaignsEntitiesConfigDto = void 0;
|
|
4
|
-
class CampaignsEntitiesConfigDto {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.product2_id = null;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
exports.CampaignsEntitiesConfigDto = CampaignsEntitiesConfigDto;
|
|
10
|
-
//# sourceMappingURL=CampaignsEntitiesConfig.dto.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CampaignsEntitiesConfig.dto.js","sourceRoot":"","sources":["../../../../src/domain/campaign/CampaignsEntitiesConfig.dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,0BAA0B;IAAvC;QAIW,gBAAW,GAAkB,IAAI,CAAC;IAE7C,CAAC;CAAA;AAND,gEAMC"}
|