@d19n/youfibre-odin-sdk 1.0.124-beta.2 → 1.0.124-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-sdk-v2/PushNotificationApi.d.ts +38 -0
- package/dist/api-sdk-v2/PushNotificationApi.js +127 -0
- package/dist/api-sdk-v2/UserApi.d.ts +1 -0
- package/dist/api-sdk-v2/UserApi.js +1 -0
- package/dist/db-sdk-v2/PushNotificationDb.d.ts +28 -0
- package/dist/db-sdk-v2/PushNotificationDb.js +110 -0
- package/dist/db-sdk-v2/UserDb.d.ts +1 -0
- package/dist/db-sdk-v2/UserDb.js +1 -0
- package/dist/entities-v2/PushNotification.d.ts +27 -0
- package/dist/entities-v2/PushNotification.js +22 -0
- package/dist/entities-v2/User.d.ts +4 -0
- package/dist/entities-v2/User.js +3 -1
- package/dist/types-v1/Types.d.ts +1 -0
- package/dist/types-v1/Types.js +1 -0
- package/package.json +1 -1
- package/src/api-sdk-v2/PushNotificationApi.ts +140 -0
- package/src/api-sdk-v2/UserApi.ts +7 -0
- package/src/db-sdk-v2/PushNotificationDb.ts +127 -0
- package/src/db-sdk-v2/UserDb.ts +8 -0
- package/src/entities-v2/PushNotification.ts +51 -0
- package/src/entities-v2/User.ts +4 -0
- package/src/types-v1/Types.ts +1 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { OauthParams } from '@d19n/odin-sdk-generator/dist/api.interfaces';
|
|
2
|
+
import { ApiProvider } from '@d19n/odin-sdk-generator/dist/api.provider';
|
|
3
|
+
import { OdinSearchV2 } from '@d19n/odin-types/dist/interfaces/v2.db.interfaces';
|
|
4
|
+
import { OdinRecordCreateDto, OdinRecordUpdateDto } from '@d19n/odin-types/dist/dtos/odin.dtos';
|
|
5
|
+
import { ApiRecordLinkManager } from '@d19n/odin-sdk-generator/dist/api.record.link.manager';
|
|
6
|
+
import { PushNotificationProperties } from '../entities-v2/PushNotification';
|
|
7
|
+
export declare class PushNotificationApi extends ApiProvider {
|
|
8
|
+
protected readonly authToken?: string;
|
|
9
|
+
private readonly moduleName;
|
|
10
|
+
private readonly entityName;
|
|
11
|
+
private sourceRecord;
|
|
12
|
+
readonly user: ApiRecordLinkManager;
|
|
13
|
+
constructor(authParams?: OauthParams, authToken?: string);
|
|
14
|
+
setRecord(sourceRecord: any): void;
|
|
15
|
+
schema(): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinSchema>;
|
|
16
|
+
search(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-sdk-generator/dist/api.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<PushNotificationProperties>>>;
|
|
17
|
+
searchAndPaginate(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-sdk-generator/dist/api.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<PushNotificationProperties>>>;
|
|
18
|
+
reIndex(body: {
|
|
19
|
+
id: string;
|
|
20
|
+
schemaId: string;
|
|
21
|
+
}[]): Promise<any>;
|
|
22
|
+
get(pushNotificationId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<PushNotificationProperties>>;
|
|
23
|
+
getMany(pushNotificationIds: string[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<PushNotificationProperties>[]>;
|
|
24
|
+
upsert(upsertDto: OdinRecordCreateDto): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes>;
|
|
25
|
+
upsertMany(upsertDtos: OdinRecordCreateDto[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes[]>;
|
|
26
|
+
update(updateDto: OdinRecordUpdateDto): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes>;
|
|
27
|
+
updateMany(updateDtos: OdinRecordUpdateDto[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes[]>;
|
|
28
|
+
delete(pushNotificationId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinDeleteResponse>;
|
|
29
|
+
deleteMany(pushNotificationIds: string[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinDeleteResponse[]>;
|
|
30
|
+
restore(pushNotificationIds: string[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinRestoreResponse[]>;
|
|
31
|
+
applyAction(dto: any): Promise<any[]>;
|
|
32
|
+
getVersions(): Promise<{
|
|
33
|
+
[key: string]: Record<string, any>;
|
|
34
|
+
}>;
|
|
35
|
+
getRevisionTimeline(): Promise<{
|
|
36
|
+
[key: string]: Record<string, any>[];
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PushNotificationApi = void 0;
|
|
13
|
+
const api_provider_1 = require("@d19n/odin-sdk-generator/dist/api.provider");
|
|
14
|
+
const api_record_link_manager_1 = require("@d19n/odin-sdk-generator/dist/api.record.link.manager");
|
|
15
|
+
class PushNotificationApi extends api_provider_1.ApiProvider {
|
|
16
|
+
constructor(authParams, authToken) {
|
|
17
|
+
super(authParams, authToken);
|
|
18
|
+
this.authToken = authToken;
|
|
19
|
+
this.moduleName = 'NotificationModule';
|
|
20
|
+
this.entityName = 'PushNotification';
|
|
21
|
+
this.user = new api_record_link_manager_1.ApiRecordLinkManager(authParams, 'NotificationModule:PushNotification', 'IdentityModule:User', 'User__PushNotification');
|
|
22
|
+
}
|
|
23
|
+
setRecord(sourceRecord) {
|
|
24
|
+
this.sourceRecord = sourceRecord;
|
|
25
|
+
}
|
|
26
|
+
schema() {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
return yield this.getSchema(this.moduleName, this.entityName);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
// Use this function when you want to search and handle all pagination on your own
|
|
32
|
+
search(params) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
return yield this._searchRecords(this.moduleName, this.entityName, params);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
// Use this function when you want paginating through the results to be handled
|
|
38
|
+
searchAndPaginate(params) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
return yield this._searchAllRecordsAndPaginate(this.moduleName, this.entityName, params);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// Use this function to re-index records in elastic search
|
|
44
|
+
reIndex(body) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
return yield this._reIndexRecords(body);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
// Use this function when you want to return a single record
|
|
50
|
+
get(pushNotificationId) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const res = yield this._getByPrimaryKey(this.moduleName, this.entityName, pushNotificationId);
|
|
53
|
+
this.setRecord(res);
|
|
54
|
+
return res;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
// Use this function when you want to return many records by primaryKeys
|
|
58
|
+
getMany(pushNotificationIds) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
return yield this._getManyByPrimaryKey(this.moduleName, this.entityName, pushNotificationIds);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
// Use this function when you want to upsert one record
|
|
64
|
+
upsert(upsertDto) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const res = yield this._upsert(this.moduleName, this.entityName, [upsertDto]);
|
|
67
|
+
return res[0];
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
// Use this function when you want to upsert many records
|
|
71
|
+
upsertMany(upsertDtos) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
return yield this._upsert(this.moduleName, this.entityName, upsertDtos);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
// Use this function when you want to update one record
|
|
77
|
+
update(updateDto) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const res = yield this._update(this.moduleName, this.entityName, [updateDto]);
|
|
80
|
+
return res[0];
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
// Use this function when you want to update many records
|
|
84
|
+
updateMany(updateDtos) {
|
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
return yield this._update(this.moduleName, this.entityName, updateDtos);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
// Use this function when you want to delete one record
|
|
90
|
+
delete(pushNotificationId) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
const res = yield this._delete(this.moduleName, this.entityName, [pushNotificationId]);
|
|
93
|
+
return res[0];
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
// Use this function when you want to delete many records
|
|
97
|
+
deleteMany(pushNotificationIds) {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
return yield this._delete(this.moduleName, this.entityName, pushNotificationIds);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
// Use this function when you want to restore one or many records
|
|
103
|
+
restore(pushNotificationIds) {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
return yield this._restore(this.moduleName, this.entityName, pushNotificationIds);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
// Use this function when you want to apply actions
|
|
109
|
+
applyAction(dto) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
return yield this._applyAction(this.moduleName, this.entityName, dto);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
// Use this function when you want to return the versions for a single record
|
|
115
|
+
getVersions() {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
return yield this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
// Use this function when you want to return the change history for a single record
|
|
121
|
+
getRevisionTimeline() {
|
|
122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
return yield this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.PushNotificationApi = PushNotificationApi;
|
|
@@ -31,6 +31,7 @@ export declare class UserApi extends ApiProvider {
|
|
|
31
31
|
readonly email: ApiRecordLinkManager;
|
|
32
32
|
readonly contractbuyout: ApiRecordLinkManager;
|
|
33
33
|
readonly customerdeviceconfiguration: ApiRecordLinkManager;
|
|
34
|
+
readonly pushnotification: ApiRecordLinkManager;
|
|
34
35
|
constructor(authParams?: OauthParams, authToken?: string);
|
|
35
36
|
setRecord(sourceRecord: any): void;
|
|
36
37
|
schema(): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinSchema>;
|
|
@@ -40,6 +40,7 @@ class UserApi extends api_provider_1.ApiProvider {
|
|
|
40
40
|
this.email = new api_record_link_manager_1.ApiRecordLinkManager(authParams, 'IdentityModule:User', 'NotificationModule:Email', 'Email_User');
|
|
41
41
|
this.contractbuyout = new api_record_link_manager_1.ApiRecordLinkManager(authParams, 'IdentityModule:User', 'OrderModule:ContractBuyOut', 'ContractBuyOut__User');
|
|
42
42
|
this.customerdeviceconfiguration = new api_record_link_manager_1.ApiRecordLinkManager(authParams, 'IdentityModule:User', 'NotificationModule:CustomerDeviceConfiguration', 'User__CustomerDeviceConfiguration');
|
|
43
|
+
this.pushnotification = new api_record_link_manager_1.ApiRecordLinkManager(authParams, 'IdentityModule:User', 'NotificationModule:PushNotification', 'User__PushNotification');
|
|
43
44
|
}
|
|
44
45
|
setRecord(sourceRecord) {
|
|
45
46
|
this.sourceRecord = sourceRecord;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DbProvider } from '@d19n/odin-sdk-generator/dist/db.provider';
|
|
2
|
+
import { OdinSearchV2 } from '@d19n/odin-types/dist/interfaces/v2.db.interfaces';
|
|
3
|
+
import { OdinRecordCreateDto, OdinRecordUpdateDto } from '@d19n/odin-types/dist/dtos/odin.dtos';
|
|
4
|
+
import { DbRecordLinkManager } from '@d19n/odin-sdk-generator/dist/db.record.link.manager';
|
|
5
|
+
import { PushNotificationProperties } from '../entities-v2/PushNotification';
|
|
6
|
+
export declare class PushNotificationDb extends DbProvider {
|
|
7
|
+
protected readonly principal: any;
|
|
8
|
+
protected readonly dbService: any;
|
|
9
|
+
private readonly moduleName;
|
|
10
|
+
private readonly entityName;
|
|
11
|
+
private sourceRecord;
|
|
12
|
+
readonly user: DbRecordLinkManager;
|
|
13
|
+
constructor(principal: any, dbService: any);
|
|
14
|
+
setRecord(sourceRecord: any): void;
|
|
15
|
+
searchRecords(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-types/dist/interfaces/v2.db.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<PushNotificationProperties>>>;
|
|
16
|
+
searchAllRecordsAndPaginate(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-types/dist/interfaces/v2.db.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<PushNotificationProperties>>>;
|
|
17
|
+
getByPrimaryKey(pushNotificationId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<PushNotificationProperties>>;
|
|
18
|
+
getManyByPrimaryKey(pushNotificationIds: string[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<PushNotificationProperties>[]>;
|
|
19
|
+
upsert(upsertDto: OdinRecordCreateDto): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes>;
|
|
20
|
+
upsertMany(upsertDtos: OdinRecordCreateDto[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes[]>;
|
|
21
|
+
update(updateDto: OdinRecordUpdateDto): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes>;
|
|
22
|
+
updateMany(updateDtos: OdinRecordUpdateDto[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes[]>;
|
|
23
|
+
delete(pushNotificationIds: string[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").DbRecordDeleted[]>;
|
|
24
|
+
restore(pushNotificationIds: string[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").DbRecordRestored[]>;
|
|
25
|
+
applyAction(actionName: string, dto: any): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes[]>;
|
|
26
|
+
getVersions(): Promise<any>;
|
|
27
|
+
getRevisionTimeline(): Promise<any>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PushNotificationDb = void 0;
|
|
13
|
+
const db_provider_1 = require("@d19n/odin-sdk-generator/dist/db.provider");
|
|
14
|
+
const db_record_link_manager_1 = require("@d19n/odin-sdk-generator/dist/db.record.link.manager");
|
|
15
|
+
class PushNotificationDb extends db_provider_1.DbProvider {
|
|
16
|
+
constructor(principal, dbService) {
|
|
17
|
+
super(principal, dbService);
|
|
18
|
+
this.moduleName = 'NotificationModule';
|
|
19
|
+
this.entityName = 'PushNotification';
|
|
20
|
+
this.principal = principal;
|
|
21
|
+
this.dbService = dbService;
|
|
22
|
+
this.user = new db_record_link_manager_1.DbRecordLinkManager(this.principal, this.dbService, 'NotificationModule:PushNotification', 'IdentityModule:User', 'User__PushNotification');
|
|
23
|
+
}
|
|
24
|
+
setRecord(sourceRecord) {
|
|
25
|
+
this.sourceRecord = sourceRecord;
|
|
26
|
+
}
|
|
27
|
+
// Use this function when you want to search and handle all pagination on your own
|
|
28
|
+
searchRecords(params) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return yield this._searchRecords(this.moduleName, this.entityName, params);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
// Use this function when you want paginating through the results to be handled
|
|
34
|
+
searchAllRecordsAndPaginate(params) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
return yield this._searchAllRecordsAndPaginate(this.moduleName, this.entityName, params);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
// Use this function when you want to return a single record
|
|
40
|
+
getByPrimaryKey(pushNotificationId) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const res = yield this._getByPrimaryKey(this.moduleName, this.entityName, pushNotificationId);
|
|
43
|
+
this.setRecord(res);
|
|
44
|
+
return res;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
// Use this function when you want to return many records by primaryKeys
|
|
48
|
+
getManyByPrimaryKey(pushNotificationIds) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
return yield this._getManyByPrimaryKey(this.moduleName, this.entityName, pushNotificationIds);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
// Use this function when you want to upsert one record
|
|
54
|
+
upsert(upsertDto) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const res = yield this._upsert(this.moduleName, this.entityName, [upsertDto]);
|
|
57
|
+
return res[0];
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
// Use this function when you want to upsert many records
|
|
61
|
+
upsertMany(upsertDtos) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
return yield this._upsert(this.moduleName, this.entityName, upsertDtos);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
// Use this function when you want to update one record
|
|
67
|
+
update(updateDto) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const res = yield this._update(this.moduleName, this.entityName, [updateDto]);
|
|
70
|
+
return res[0];
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
// Use this function when you want to update many records
|
|
74
|
+
updateMany(updateDtos) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
return yield this._update(this.moduleName, this.entityName, updateDtos);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
// Use this function when you want to delete one or many records
|
|
80
|
+
delete(pushNotificationIds) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
return yield this._delete(this.moduleName, this.entityName, pushNotificationIds);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
// Use this function when you want to restore one or many records
|
|
86
|
+
restore(pushNotificationIds) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
return yield this._restore(this.moduleName, this.entityName, pushNotificationIds);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
// Use this function when you want to apply actions
|
|
92
|
+
applyAction(actionName, dto) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
return yield this._applyAction(this.moduleName, this.entityName, dto);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
// Use this function when you want to return the versions for a single record
|
|
98
|
+
getVersions() {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
return yield this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
// Use this function when you want to return the change history for a single record
|
|
104
|
+
getRevisionTimeline() {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
return yield this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.PushNotificationDb = PushNotificationDb;
|
|
@@ -31,6 +31,7 @@ export declare class UserDb extends DbProvider {
|
|
|
31
31
|
readonly email: DbRecordLinkManager;
|
|
32
32
|
readonly contractbuyout: DbRecordLinkManager;
|
|
33
33
|
readonly customerdeviceconfiguration: DbRecordLinkManager;
|
|
34
|
+
readonly pushnotification: DbRecordLinkManager;
|
|
34
35
|
constructor(principal: any, dbService: any);
|
|
35
36
|
setRecord(sourceRecord: any): void;
|
|
36
37
|
searchRecords(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-types/dist/interfaces/v2.db.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<UserProperties>>>;
|
package/dist/db-sdk-v2/UserDb.js
CHANGED
|
@@ -41,6 +41,7 @@ class UserDb extends db_provider_1.DbProvider {
|
|
|
41
41
|
this.email = new db_record_link_manager_1.DbRecordLinkManager(this.principal, this.dbService, 'IdentityModule:User', 'NotificationModule:Email', 'Email_User');
|
|
42
42
|
this.contractbuyout = new db_record_link_manager_1.DbRecordLinkManager(this.principal, this.dbService, 'IdentityModule:User', 'OrderModule:ContractBuyOut', 'ContractBuyOut__User');
|
|
43
43
|
this.customerdeviceconfiguration = new db_record_link_manager_1.DbRecordLinkManager(this.principal, this.dbService, 'IdentityModule:User', 'NotificationModule:CustomerDeviceConfiguration', 'User__CustomerDeviceConfiguration');
|
|
44
|
+
this.pushnotification = new db_record_link_manager_1.DbRecordLinkManager(this.principal, this.dbService, 'IdentityModule:User', 'NotificationModule:PushNotification', 'User__PushNotification');
|
|
44
45
|
}
|
|
45
46
|
setRecord(sourceRecord) {
|
|
46
47
|
this.sourceRecord = sourceRecord;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { OdinRecord, OdinLink, LinkedOdinRecord } from '@d19n/odin-types/dist/types/odin.types';
|
|
2
|
+
import { UserProperties } from './User';
|
|
3
|
+
export declare enum PushNotificationEntityTypes {
|
|
4
|
+
DEFAULT = "DEFAULT"
|
|
5
|
+
}
|
|
6
|
+
export declare enum PushNotificationPropertyKeys {
|
|
7
|
+
DeviceToken = "DeviceToken",
|
|
8
|
+
Message = "Message",
|
|
9
|
+
Title = "Title",
|
|
10
|
+
UserId = "UserId"
|
|
11
|
+
}
|
|
12
|
+
export interface PushNotificationProperties {
|
|
13
|
+
DeviceToken?: string;
|
|
14
|
+
Message?: string;
|
|
15
|
+
Title?: string;
|
|
16
|
+
UserId?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class PushNotification extends OdinRecord<PushNotificationProperties> {
|
|
19
|
+
entity: 'NotificationModule:PushNotification';
|
|
20
|
+
type: PushNotificationEntityTypes;
|
|
21
|
+
schemaId: '1ab6c541-3554-43c0-92ff-6533eb11f3de';
|
|
22
|
+
properties: PushNotificationProperties;
|
|
23
|
+
User: OdinLink<LinkedOdinRecord<UserProperties>>;
|
|
24
|
+
}
|
|
25
|
+
export declare const ROUTING_KEY_PUSH_NOTIFICATION_CREATED = "NotificationModule.PushNotification.SubDbRecordCreated";
|
|
26
|
+
export declare const ROUTING_KEY_PUSH_NOTIFICATION_UPDATED = "NotificationModule.PushNotification.SubDbRecordUpdated";
|
|
27
|
+
export declare const ROUTING_KEY_PUSH_NOTIFICATION_DELETED = "NotificationModule.PushNotification.SubDbRecordDeleted";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ROUTING_KEY_PUSH_NOTIFICATION_DELETED = exports.ROUTING_KEY_PUSH_NOTIFICATION_UPDATED = exports.ROUTING_KEY_PUSH_NOTIFICATION_CREATED = exports.PushNotification = exports.PushNotificationPropertyKeys = exports.PushNotificationEntityTypes = void 0;
|
|
4
|
+
const odin_types_1 = require("@d19n/odin-types/dist/types/odin.types");
|
|
5
|
+
var PushNotificationEntityTypes;
|
|
6
|
+
(function (PushNotificationEntityTypes) {
|
|
7
|
+
PushNotificationEntityTypes["DEFAULT"] = "DEFAULT";
|
|
8
|
+
})(PushNotificationEntityTypes = exports.PushNotificationEntityTypes || (exports.PushNotificationEntityTypes = {}));
|
|
9
|
+
var PushNotificationPropertyKeys;
|
|
10
|
+
(function (PushNotificationPropertyKeys) {
|
|
11
|
+
PushNotificationPropertyKeys["DeviceToken"] = "DeviceToken";
|
|
12
|
+
PushNotificationPropertyKeys["Message"] = "Message";
|
|
13
|
+
PushNotificationPropertyKeys["Title"] = "Title";
|
|
14
|
+
PushNotificationPropertyKeys["UserId"] = "UserId";
|
|
15
|
+
})(PushNotificationPropertyKeys = exports.PushNotificationPropertyKeys || (exports.PushNotificationPropertyKeys = {}));
|
|
16
|
+
class PushNotification extends odin_types_1.OdinRecord {
|
|
17
|
+
}
|
|
18
|
+
exports.PushNotification = PushNotification;
|
|
19
|
+
// Rabbitmq event routing keys
|
|
20
|
+
exports.ROUTING_KEY_PUSH_NOTIFICATION_CREATED = 'NotificationModule.PushNotification.SubDbRecordCreated';
|
|
21
|
+
exports.ROUTING_KEY_PUSH_NOTIFICATION_UPDATED = 'NotificationModule.PushNotification.SubDbRecordUpdated';
|
|
22
|
+
exports.ROUTING_KEY_PUSH_NOTIFICATION_DELETED = 'NotificationModule.PushNotification.SubDbRecordDeleted';
|
|
@@ -16,6 +16,7 @@ import { YfVanAuditProperties } from './YfVanAudit';
|
|
|
16
16
|
import { EmailProperties } from './Email';
|
|
17
17
|
import { ContractBuyOutProperties } from './ContractBuyOut';
|
|
18
18
|
import { CustomerDeviceConfigurationProperties } from './CustomerDeviceConfiguration';
|
|
19
|
+
import { PushNotificationProperties } from './PushNotification';
|
|
19
20
|
export declare enum UserEntityTypes {
|
|
20
21
|
DEFAULT = "DEFAULT"
|
|
21
22
|
}
|
|
@@ -83,6 +84,7 @@ export declare class User extends OdinRecord<UserProperties> {
|
|
|
83
84
|
Email: OdinLink<LinkedOdinRecord<EmailProperties>>;
|
|
84
85
|
ContractBuyOut: OdinLink<LinkedOdinRecord<ContractBuyOutProperties>>;
|
|
85
86
|
CustomerDeviceConfiguration: OdinLink<LinkedOdinRecord<CustomerDeviceConfigurationProperties>>;
|
|
87
|
+
PushNotification: OdinLink<LinkedOdinRecord<PushNotificationProperties>>;
|
|
86
88
|
}
|
|
87
89
|
export declare const ROUTING_KEY_USER_CREATED = "IdentityModule.User.SubDbRecordCreated";
|
|
88
90
|
export declare const ROUTING_KEY_USER_UPDATED = "IdentityModule.User.SubDbRecordUpdated";
|
|
@@ -93,3 +95,5 @@ export declare const ROUTING_KEY_LINK_USER_TIME_OFF_CREATED = "IdentityModule.Us
|
|
|
93
95
|
export declare const ROUTING_KEY_LINK_USER_TIME_OFF_DELETED = "IdentityModule.User.TimeOff.SubDbRecordAssociationDeleted";
|
|
94
96
|
export declare const ROUTING_KEY_LINK_USER_CUSTOMER_DEVICE_CONFIGURATION_CREATED = "IdentityModule.User.CustomerDeviceConfiguration.SubDbRecordAssociationCreated";
|
|
95
97
|
export declare const ROUTING_KEY_LINK_USER_CUSTOMER_DEVICE_CONFIGURATION_DELETED = "IdentityModule.User.CustomerDeviceConfiguration.SubDbRecordAssociationDeleted";
|
|
98
|
+
export declare const ROUTING_KEY_LINK_USER_PUSH_NOTIFICATION_CREATED = "IdentityModule.User.PushNotification.SubDbRecordAssociationCreated";
|
|
99
|
+
export declare const ROUTING_KEY_LINK_USER_PUSH_NOTIFICATION_DELETED = "IdentityModule.User.PushNotification.SubDbRecordAssociationDeleted";
|
package/dist/entities-v2/User.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ROUTING_KEY_LINK_USER_CUSTOMER_DEVICE_CONFIGURATION_DELETED = exports.ROUTING_KEY_LINK_USER_CUSTOMER_DEVICE_CONFIGURATION_CREATED = exports.ROUTING_KEY_LINK_USER_TIME_OFF_DELETED = exports.ROUTING_KEY_LINK_USER_TIME_OFF_CREATED = exports.ROUTING_KEY_LINK_USER_TIME_SLOT_DELETED = exports.ROUTING_KEY_LINK_USER_TIME_SLOT_CREATED = exports.ROUTING_KEY_USER_DELETED = exports.ROUTING_KEY_USER_UPDATED = exports.ROUTING_KEY_USER_CREATED = exports.User = exports.UserPropertyKeys = exports.UserAccredited = exports.UserEntityTypes = void 0;
|
|
3
|
+
exports.ROUTING_KEY_LINK_USER_PUSH_NOTIFICATION_DELETED = exports.ROUTING_KEY_LINK_USER_PUSH_NOTIFICATION_CREATED = exports.ROUTING_KEY_LINK_USER_CUSTOMER_DEVICE_CONFIGURATION_DELETED = exports.ROUTING_KEY_LINK_USER_CUSTOMER_DEVICE_CONFIGURATION_CREATED = exports.ROUTING_KEY_LINK_USER_TIME_OFF_DELETED = exports.ROUTING_KEY_LINK_USER_TIME_OFF_CREATED = exports.ROUTING_KEY_LINK_USER_TIME_SLOT_DELETED = exports.ROUTING_KEY_LINK_USER_TIME_SLOT_CREATED = exports.ROUTING_KEY_USER_DELETED = exports.ROUTING_KEY_USER_UPDATED = exports.ROUTING_KEY_USER_CREATED = exports.User = exports.UserPropertyKeys = exports.UserAccredited = exports.UserEntityTypes = void 0;
|
|
4
4
|
const odin_types_1 = require("@d19n/odin-types/dist/types/odin.types");
|
|
5
5
|
var UserEntityTypes;
|
|
6
6
|
(function (UserEntityTypes) {
|
|
@@ -44,3 +44,5 @@ exports.ROUTING_KEY_LINK_USER_TIME_OFF_CREATED = 'IdentityModule.User.TimeOff.Su
|
|
|
44
44
|
exports.ROUTING_KEY_LINK_USER_TIME_OFF_DELETED = 'IdentityModule.User.TimeOff.SubDbRecordAssociationDeleted';
|
|
45
45
|
exports.ROUTING_KEY_LINK_USER_CUSTOMER_DEVICE_CONFIGURATION_CREATED = 'IdentityModule.User.CustomerDeviceConfiguration.SubDbRecordAssociationCreated';
|
|
46
46
|
exports.ROUTING_KEY_LINK_USER_CUSTOMER_DEVICE_CONFIGURATION_DELETED = 'IdentityModule.User.CustomerDeviceConfiguration.SubDbRecordAssociationDeleted';
|
|
47
|
+
exports.ROUTING_KEY_LINK_USER_PUSH_NOTIFICATION_CREATED = 'IdentityModule.User.PushNotification.SubDbRecordAssociationCreated';
|
|
48
|
+
exports.ROUTING_KEY_LINK_USER_PUSH_NOTIFICATION_DELETED = 'IdentityModule.User.PushNotification.SubDbRecordAssociationDeleted';
|
package/dist/types-v1/Types.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare enum OdinEntities {
|
|
|
7
7
|
CUSTOMER_DEVICE_CONFIGURATION = "NotificationModule:CustomerDeviceConfiguration",
|
|
8
8
|
LEAD = "CrmModule:Lead",
|
|
9
9
|
NETWORK_DEVICE = "ServiceModule:NetworkDevice",
|
|
10
|
+
PUSH_NOTIFICATION = "NotificationModule:PushNotification",
|
|
10
11
|
SERVICE = "ServiceModule:Service",
|
|
11
12
|
RETURN_ORDER = "OrderModule:ReturnOrder",
|
|
12
13
|
TELESALES_DASHBOARD = "CrmModule:TelesalesDashboard",
|
package/dist/types-v1/Types.js
CHANGED
|
@@ -11,6 +11,7 @@ var OdinEntities;
|
|
|
11
11
|
OdinEntities["CUSTOMER_DEVICE_CONFIGURATION"] = "NotificationModule:CustomerDeviceConfiguration";
|
|
12
12
|
OdinEntities["LEAD"] = "CrmModule:Lead";
|
|
13
13
|
OdinEntities["NETWORK_DEVICE"] = "ServiceModule:NetworkDevice";
|
|
14
|
+
OdinEntities["PUSH_NOTIFICATION"] = "NotificationModule:PushNotification";
|
|
14
15
|
OdinEntities["SERVICE"] = "ServiceModule:Service";
|
|
15
16
|
OdinEntities["RETURN_ORDER"] = "OrderModule:ReturnOrder";
|
|
16
17
|
OdinEntities["TELESALES_DASHBOARD"] = "CrmModule:TelesalesDashboard";
|
package/package.json
CHANGED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
|
|
2
|
+
import { OauthParams } from '@d19n/odin-sdk-generator/dist/api.interfaces';
|
|
3
|
+
import { ApiProvider } from '@d19n/odin-sdk-generator/dist/api.provider';
|
|
4
|
+
import { OdinSearchV2 } from '@d19n/odin-types/dist/interfaces/v2.db.interfaces';
|
|
5
|
+
import { BatchDeleteParam, BatchRestoreParam, OdinRecordCreateDto, OdinRecordUpdateDto } from '@d19n/odin-types/dist/dtos/odin.dtos';
|
|
6
|
+
import { ApiRecordLinkManager } from '@d19n/odin-sdk-generator/dist/api.record.link.manager';
|
|
7
|
+
import { PushNotificationProperties } from '../entities-v2/PushNotification';
|
|
8
|
+
|
|
9
|
+
export class PushNotificationApi extends ApiProvider {
|
|
10
|
+
|
|
11
|
+
private readonly moduleName: string = 'NotificationModule';
|
|
12
|
+
private readonly entityName: string = 'PushNotification';
|
|
13
|
+
|
|
14
|
+
private sourceRecord: any;
|
|
15
|
+
|
|
16
|
+
public readonly user: ApiRecordLinkManager;
|
|
17
|
+
constructor(authParams?: OauthParams, protected readonly authToken?: string) {
|
|
18
|
+
super(authParams, authToken);
|
|
19
|
+
|
|
20
|
+
this.user = new ApiRecordLinkManager(
|
|
21
|
+
authParams,
|
|
22
|
+
'NotificationModule:PushNotification',
|
|
23
|
+
'IdentityModule:User',
|
|
24
|
+
'User__PushNotification'
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
public setRecord(sourceRecord: any) {
|
|
30
|
+
this.sourceRecord = sourceRecord
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public async schema() {
|
|
34
|
+
return await this.getSchema(this.moduleName, this.entityName);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Use this function when you want to search and handle all pagination on your own
|
|
38
|
+
public async search(params: Partial<OdinSearchV2>) {
|
|
39
|
+
return await this._searchRecords<PushNotificationProperties>(this.moduleName, this.entityName, params);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Use this function when you want paginating through the results to be handled
|
|
43
|
+
public async searchAndPaginate(params: Partial<OdinSearchV2>) {
|
|
44
|
+
return await this._searchAllRecordsAndPaginate<PushNotificationProperties>(this.moduleName, this.entityName, params);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Use this function to re-index records in elastic search
|
|
48
|
+
public async reIndex(body: { id: string, schemaId: string }[]) {
|
|
49
|
+
return await this._reIndexRecords(body);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Use this function when you want to return a single record
|
|
53
|
+
public async get(pushNotificationId: string) {
|
|
54
|
+
const res = await this._getByPrimaryKey<PushNotificationProperties>(
|
|
55
|
+
this.moduleName,
|
|
56
|
+
this.entityName,
|
|
57
|
+
pushNotificationId
|
|
58
|
+
);
|
|
59
|
+
this.setRecord(res);
|
|
60
|
+
|
|
61
|
+
return res;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Use this function when you want to return many records by primaryKeys
|
|
65
|
+
public async getMany(pushNotificationIds: string[]) {
|
|
66
|
+
return await this._getManyByPrimaryKey<PushNotificationProperties>(
|
|
67
|
+
this.moduleName,
|
|
68
|
+
this.entityName,
|
|
69
|
+
pushNotificationIds
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Use this function when you want to upsert one record
|
|
74
|
+
public async upsert(upsertDto: OdinRecordCreateDto) {
|
|
75
|
+
const res = await this._upsert(this.moduleName, this.entityName, [upsertDto]);
|
|
76
|
+
return res[0];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Use this function when you want to upsert many records
|
|
80
|
+
public async upsertMany(upsertDtos: OdinRecordCreateDto[]) {
|
|
81
|
+
return await this._upsert(this.moduleName, this.entityName, upsertDtos);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Use this function when you want to update one record
|
|
85
|
+
public async update(updateDto: OdinRecordUpdateDto) {
|
|
86
|
+
const res = await this._update(this.moduleName, this.entityName, [updateDto]);
|
|
87
|
+
return res[0];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Use this function when you want to update many records
|
|
91
|
+
public async updateMany(updateDtos: OdinRecordUpdateDto[]) {
|
|
92
|
+
return await this._update(this.moduleName, this.entityName, updateDtos);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Use this function when you want to delete one record
|
|
96
|
+
public async delete(pushNotificationId: string) {
|
|
97
|
+
const res = await this._delete(
|
|
98
|
+
this.moduleName,
|
|
99
|
+
this.entityName,
|
|
100
|
+
[pushNotificationId]
|
|
101
|
+
);
|
|
102
|
+
return res[0];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Use this function when you want to delete many records
|
|
106
|
+
public async deleteMany(pushNotificationIds: string[]) {
|
|
107
|
+
return await this._delete(
|
|
108
|
+
this.moduleName,
|
|
109
|
+
this.entityName,
|
|
110
|
+
pushNotificationIds
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Use this function when you want to restore one or many records
|
|
115
|
+
public async restore(pushNotificationIds: string[]) {
|
|
116
|
+
return await this._restore(
|
|
117
|
+
this.moduleName,
|
|
118
|
+
this.entityName,
|
|
119
|
+
pushNotificationIds
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Use this function when you want to apply actions
|
|
124
|
+
public async applyAction(dto: any) {
|
|
125
|
+
return await this._applyAction(this.moduleName, this.entityName, dto);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Use this function when you want to return the versions for a single record
|
|
129
|
+
public async getVersions() {
|
|
130
|
+
return await this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Use this function when you want to return the change history for a single record
|
|
134
|
+
public async getRevisionTimeline() {
|
|
135
|
+
return await this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
public readonly email: ApiRecordLinkManager;
|
|
36
36
|
public readonly contractbuyout: ApiRecordLinkManager;
|
|
37
37
|
public readonly customerdeviceconfiguration: ApiRecordLinkManager;
|
|
38
|
+
public readonly pushnotification: ApiRecordLinkManager;
|
|
38
39
|
constructor(authParams?: OauthParams, protected readonly authToken?: string) {
|
|
39
40
|
super(authParams, authToken);
|
|
40
41
|
|
|
@@ -170,6 +171,12 @@
|
|
|
170
171
|
'NotificationModule:CustomerDeviceConfiguration',
|
|
171
172
|
'User__CustomerDeviceConfiguration'
|
|
172
173
|
);
|
|
174
|
+
this.pushnotification = new ApiRecordLinkManager(
|
|
175
|
+
authParams,
|
|
176
|
+
'IdentityModule:User',
|
|
177
|
+
'NotificationModule:PushNotification',
|
|
178
|
+
'User__PushNotification'
|
|
179
|
+
);
|
|
173
180
|
}
|
|
174
181
|
|
|
175
182
|
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
|
|
2
|
+
import { DbProvider } from '@d19n/odin-sdk-generator/dist/db.provider';
|
|
3
|
+
import { OdinSearchV2 } from '@d19n/odin-types/dist/interfaces/v2.db.interfaces';
|
|
4
|
+
import { BatchDeleteParam, BatchRestoreParam, OdinRecordCreateDto, OdinRecordUpdateDto } from '@d19n/odin-types/dist/dtos/odin.dtos';
|
|
5
|
+
import { DbRecordLinkManager } from '@d19n/odin-sdk-generator/dist/db.record.link.manager';
|
|
6
|
+
import { PushNotificationProperties } from '../entities-v2/PushNotification';
|
|
7
|
+
|
|
8
|
+
export class PushNotificationDb extends DbProvider {
|
|
9
|
+
protected readonly principal: any;
|
|
10
|
+
protected readonly dbService: any;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
private readonly moduleName: string = 'NotificationModule';
|
|
14
|
+
private readonly entityName: string = 'PushNotification';
|
|
15
|
+
|
|
16
|
+
private sourceRecord: any;
|
|
17
|
+
|
|
18
|
+
public readonly user: DbRecordLinkManager;
|
|
19
|
+
constructor(principal: any, dbService: any) {
|
|
20
|
+
super(principal, dbService);
|
|
21
|
+
|
|
22
|
+
this.principal = principal;
|
|
23
|
+
this.dbService = dbService;
|
|
24
|
+
|
|
25
|
+
this.user = new DbRecordLinkManager(
|
|
26
|
+
this.principal,
|
|
27
|
+
this.dbService,
|
|
28
|
+
'NotificationModule:PushNotification',
|
|
29
|
+
'IdentityModule:User',
|
|
30
|
+
'User__PushNotification'
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
public setRecord(sourceRecord: any) {
|
|
36
|
+
this.sourceRecord = sourceRecord
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Use this function when you want to search and handle all pagination on your own
|
|
40
|
+
public async searchRecords(params: Partial<OdinSearchV2>) {
|
|
41
|
+
return await this._searchRecords<PushNotificationProperties>(this.moduleName, this.entityName, params);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Use this function when you want paginating through the results to be handled
|
|
45
|
+
public async searchAllRecordsAndPaginate(params: Partial<OdinSearchV2>) {
|
|
46
|
+
return await this._searchAllRecordsAndPaginate<PushNotificationProperties>(this.moduleName, this.entityName, params);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Use this function when you want to return a single record
|
|
50
|
+
public async getByPrimaryKey(pushNotificationId: string) {
|
|
51
|
+
const res = await this._getByPrimaryKey<PushNotificationProperties>(
|
|
52
|
+
this.moduleName,
|
|
53
|
+
this.entityName,
|
|
54
|
+
pushNotificationId
|
|
55
|
+
);
|
|
56
|
+
this.setRecord(res);
|
|
57
|
+
|
|
58
|
+
return res;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Use this function when you want to return many records by primaryKeys
|
|
62
|
+
public async getManyByPrimaryKey(pushNotificationIds: string[]) {
|
|
63
|
+
return await this._getManyByPrimaryKey<PushNotificationProperties>(
|
|
64
|
+
this.moduleName,
|
|
65
|
+
this.entityName,
|
|
66
|
+
pushNotificationIds
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Use this function when you want to upsert one record
|
|
71
|
+
public async upsert(upsertDto: OdinRecordCreateDto) {
|
|
72
|
+
const res = await this._upsert(this.moduleName, this.entityName, [upsertDto]);
|
|
73
|
+
return res[0];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Use this function when you want to upsert many records
|
|
77
|
+
public async upsertMany(upsertDtos: OdinRecordCreateDto[]) {
|
|
78
|
+
return await this._upsert(this.moduleName, this.entityName, upsertDtos);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Use this function when you want to update one record
|
|
82
|
+
public async update(updateDto: OdinRecordUpdateDto) {
|
|
83
|
+
const res = await this._update(this.moduleName, this.entityName, [updateDto]);
|
|
84
|
+
return res[0];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Use this function when you want to update many records
|
|
88
|
+
public async updateMany(updateDtos: OdinRecordUpdateDto[]) {
|
|
89
|
+
return await this._update(this.moduleName, this.entityName, updateDtos);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Use this function when you want to delete one or many records
|
|
93
|
+
public async delete(pushNotificationIds: string[]) {
|
|
94
|
+
return await this._delete(
|
|
95
|
+
this.moduleName,
|
|
96
|
+
this.entityName,
|
|
97
|
+
pushNotificationIds
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Use this function when you want to restore one or many records
|
|
102
|
+
public async restore(pushNotificationIds: string[]) {
|
|
103
|
+
return await this._restore(
|
|
104
|
+
this.moduleName,
|
|
105
|
+
this.entityName,
|
|
106
|
+
pushNotificationIds
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Use this function when you want to apply actions
|
|
111
|
+
public async applyAction(actionName: string, dto: any) {
|
|
112
|
+
return await this._applyAction(this.moduleName, this.entityName, dto);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Use this function when you want to return the versions for a single record
|
|
116
|
+
public async getVersions() {
|
|
117
|
+
return await this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Use this function when you want to return the change history for a single record
|
|
121
|
+
public async getRevisionTimeline() {
|
|
122
|
+
return await this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
|
package/src/db-sdk-v2/UserDb.ts
CHANGED
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
public readonly email: DbRecordLinkManager;
|
|
38
38
|
public readonly contractbuyout: DbRecordLinkManager;
|
|
39
39
|
public readonly customerdeviceconfiguration: DbRecordLinkManager;
|
|
40
|
+
public readonly pushnotification: DbRecordLinkManager;
|
|
40
41
|
constructor(principal: any, dbService: any) {
|
|
41
42
|
super(principal, dbService);
|
|
42
43
|
|
|
@@ -197,6 +198,13 @@
|
|
|
197
198
|
'NotificationModule:CustomerDeviceConfiguration',
|
|
198
199
|
'User__CustomerDeviceConfiguration'
|
|
199
200
|
);
|
|
201
|
+
this.pushnotification = new DbRecordLinkManager(
|
|
202
|
+
this.principal,
|
|
203
|
+
this.dbService,
|
|
204
|
+
'IdentityModule:User',
|
|
205
|
+
'NotificationModule:PushNotification',
|
|
206
|
+
'User__PushNotification'
|
|
207
|
+
);
|
|
200
208
|
}
|
|
201
209
|
|
|
202
210
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
import { OdinPipelineStage, OdinGroup, OdinRecord, OdinLink, LinkedOdinRecord } from '@d19n/odin-types/dist/types/odin.types';
|
|
3
|
+
import { OdinRecordCreateDto, OdinRecordUpdateDto } from '@d19n/odin-types/dist/dtos/odin.dtos';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
import { UserProperties } from './User';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export enum PushNotificationEntityTypes {
|
|
10
|
+
DEFAULT = 'DEFAULT',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export enum PushNotificationPropertyKeys {
|
|
16
|
+
DeviceToken = 'DeviceToken',
|
|
17
|
+
Message = 'Message',
|
|
18
|
+
Title = 'Title',
|
|
19
|
+
UserId = 'UserId',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export interface PushNotificationProperties {
|
|
24
|
+
//Personal device token
|
|
25
|
+
DeviceToken?: string
|
|
26
|
+
//Body of the message
|
|
27
|
+
Message?: string
|
|
28
|
+
//Title of the notification
|
|
29
|
+
Title?: string
|
|
30
|
+
//Related User
|
|
31
|
+
UserId?: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
export class PushNotification extends OdinRecord<PushNotificationProperties> {
|
|
36
|
+
entity: 'NotificationModule:PushNotification';
|
|
37
|
+
type: PushNotificationEntityTypes;
|
|
38
|
+
schemaId: '1ab6c541-3554-43c0-92ff-6533eb11f3de';
|
|
39
|
+
properties: PushNotificationProperties;
|
|
40
|
+
User: OdinLink<LinkedOdinRecord<UserProperties>>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Rabbitmq event routing keys
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
export const ROUTING_KEY_PUSH_NOTIFICATION_CREATED = 'NotificationModule.PushNotification.SubDbRecordCreated';
|
|
47
|
+
export const ROUTING_KEY_PUSH_NOTIFICATION_UPDATED = 'NotificationModule.PushNotification.SubDbRecordUpdated';
|
|
48
|
+
export const ROUTING_KEY_PUSH_NOTIFICATION_DELETED = 'NotificationModule.PushNotification.SubDbRecordDeleted';
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
package/src/entities-v2/User.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { YfVanAuditProperties } from './YfVanAudit';
|
|
|
20
20
|
import { EmailProperties } from './Email';
|
|
21
21
|
import { ContractBuyOutProperties } from './ContractBuyOut';
|
|
22
22
|
import { CustomerDeviceConfigurationProperties } from './CustomerDeviceConfiguration';
|
|
23
|
+
import { PushNotificationProperties } from './PushNotification';
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
export enum UserEntityTypes {
|
|
@@ -113,6 +114,7 @@ export class User extends OdinRecord<UserProperties> {
|
|
|
113
114
|
Email: OdinLink<LinkedOdinRecord<EmailProperties>>;
|
|
114
115
|
ContractBuyOut: OdinLink<LinkedOdinRecord<ContractBuyOutProperties>>;
|
|
115
116
|
CustomerDeviceConfiguration: OdinLink<LinkedOdinRecord<CustomerDeviceConfigurationProperties>>;
|
|
117
|
+
PushNotification: OdinLink<LinkedOdinRecord<PushNotificationProperties>>;
|
|
116
118
|
}
|
|
117
119
|
|
|
118
120
|
// Rabbitmq event routing keys
|
|
@@ -128,5 +130,7 @@ export const ROUTING_KEY_LINK_USER_TIME_OFF_CREATED = 'IdentityModule.User.TimeO
|
|
|
128
130
|
export const ROUTING_KEY_LINK_USER_TIME_OFF_DELETED = 'IdentityModule.User.TimeOff.SubDbRecordAssociationDeleted'
|
|
129
131
|
export const ROUTING_KEY_LINK_USER_CUSTOMER_DEVICE_CONFIGURATION_CREATED = 'IdentityModule.User.CustomerDeviceConfiguration.SubDbRecordAssociationCreated'
|
|
130
132
|
export const ROUTING_KEY_LINK_USER_CUSTOMER_DEVICE_CONFIGURATION_DELETED = 'IdentityModule.User.CustomerDeviceConfiguration.SubDbRecordAssociationDeleted'
|
|
133
|
+
export const ROUTING_KEY_LINK_USER_PUSH_NOTIFICATION_CREATED = 'IdentityModule.User.PushNotification.SubDbRecordAssociationCreated'
|
|
134
|
+
export const ROUTING_KEY_LINK_USER_PUSH_NOTIFICATION_DELETED = 'IdentityModule.User.PushNotification.SubDbRecordAssociationDeleted'
|
|
131
135
|
|
|
132
136
|
|
package/src/types-v1/Types.ts
CHANGED
|
@@ -9,6 +9,7 @@ export enum OdinEntities {
|
|
|
9
9
|
CUSTOMER_DEVICE_CONFIGURATION = 'NotificationModule:CustomerDeviceConfiguration',
|
|
10
10
|
LEAD = 'CrmModule:Lead',
|
|
11
11
|
NETWORK_DEVICE = 'ServiceModule:NetworkDevice',
|
|
12
|
+
PUSH_NOTIFICATION = 'NotificationModule:PushNotification',
|
|
12
13
|
SERVICE = 'ServiceModule:Service',
|
|
13
14
|
RETURN_ORDER = 'OrderModule:ReturnOrder',
|
|
14
15
|
TELESALES_DASHBOARD = 'CrmModule:TelesalesDashboard',
|