@d19n/youfibre-odin-sdk 1.0.141 → 1.0.142

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,36 @@
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 { ExchangeProperties } from '../entities-v2/Exchange';
6
+ export declare class ExchangeApi extends ApiProvider {
7
+ protected readonly authToken?: string;
8
+ private readonly moduleName;
9
+ private readonly entityName;
10
+ private sourceRecord;
11
+ constructor(authParams?: OauthParams, authToken?: string);
12
+ setRecord(sourceRecord: any): void;
13
+ schema(): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinSchema>;
14
+ search(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-sdk-generator/dist/api.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<ExchangeProperties>>>;
15
+ searchAndPaginate(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-sdk-generator/dist/api.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<ExchangeProperties>>>;
16
+ reIndex(body: {
17
+ id: string;
18
+ schemaId: string;
19
+ }[]): Promise<any>;
20
+ get(exchangeId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<ExchangeProperties>>;
21
+ getMany(exchangeIds: string[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<ExchangeProperties>[]>;
22
+ upsert(upsertDto: OdinRecordCreateDto): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes>;
23
+ upsertMany(upsertDtos: OdinRecordCreateDto[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes[]>;
24
+ update(updateDto: OdinRecordUpdateDto): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes>;
25
+ updateMany(updateDtos: OdinRecordUpdateDto[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes[]>;
26
+ delete(exchangeId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinDeleteResponse>;
27
+ deleteMany(exchangeIds: string[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinDeleteResponse[]>;
28
+ restore(exchangeIds: string[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinRestoreResponse[]>;
29
+ applyAction(dto: any): Promise<any[]>;
30
+ getVersions(): Promise<{
31
+ [key: string]: Record<string, any>;
32
+ }>;
33
+ getRevisionTimeline(): Promise<{
34
+ [key: string]: Record<string, any>[];
35
+ }>;
36
+ }
@@ -0,0 +1,125 @@
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.ExchangeApi = void 0;
13
+ const api_provider_1 = require("@d19n/odin-sdk-generator/dist/api.provider");
14
+ class ExchangeApi extends api_provider_1.ApiProvider {
15
+ constructor(authParams, authToken) {
16
+ super(authParams, authToken);
17
+ this.authToken = authToken;
18
+ this.moduleName = 'FieldServiceModule';
19
+ this.entityName = 'Exchange';
20
+ }
21
+ setRecord(sourceRecord) {
22
+ this.sourceRecord = sourceRecord;
23
+ }
24
+ schema() {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ return yield this.getSchema(this.moduleName, this.entityName);
27
+ });
28
+ }
29
+ // Use this function when you want to search and handle all pagination on your own
30
+ search(params) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ return yield this._searchRecords(this.moduleName, this.entityName, params);
33
+ });
34
+ }
35
+ // Use this function when you want paginating through the results to be handled
36
+ searchAndPaginate(params) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ return yield this._searchAllRecordsAndPaginate(this.moduleName, this.entityName, params);
39
+ });
40
+ }
41
+ // Use this function to re-index records in elastic search
42
+ reIndex(body) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ return yield this._reIndexRecords(body);
45
+ });
46
+ }
47
+ // Use this function when you want to return a single record
48
+ get(exchangeId) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ const res = yield this._getByPrimaryKey(this.moduleName, this.entityName, exchangeId);
51
+ this.setRecord(res);
52
+ return res;
53
+ });
54
+ }
55
+ // Use this function when you want to return many records by primaryKeys
56
+ getMany(exchangeIds) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ return yield this._getManyByPrimaryKey(this.moduleName, this.entityName, exchangeIds);
59
+ });
60
+ }
61
+ // Use this function when you want to upsert one record
62
+ upsert(upsertDto) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ const res = yield this._upsert(this.moduleName, this.entityName, [upsertDto]);
65
+ return res[0];
66
+ });
67
+ }
68
+ // Use this function when you want to upsert many records
69
+ upsertMany(upsertDtos) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ return yield this._upsert(this.moduleName, this.entityName, upsertDtos);
72
+ });
73
+ }
74
+ // Use this function when you want to update one record
75
+ update(updateDto) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ const res = yield this._update(this.moduleName, this.entityName, [updateDto]);
78
+ return res[0];
79
+ });
80
+ }
81
+ // Use this function when you want to update many records
82
+ updateMany(updateDtos) {
83
+ return __awaiter(this, void 0, void 0, function* () {
84
+ return yield this._update(this.moduleName, this.entityName, updateDtos);
85
+ });
86
+ }
87
+ // Use this function when you want to delete one record
88
+ delete(exchangeId) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ const res = yield this._delete(this.moduleName, this.entityName, [exchangeId]);
91
+ return res[0];
92
+ });
93
+ }
94
+ // Use this function when you want to delete many records
95
+ deleteMany(exchangeIds) {
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ return yield this._delete(this.moduleName, this.entityName, exchangeIds);
98
+ });
99
+ }
100
+ // Use this function when you want to restore one or many records
101
+ restore(exchangeIds) {
102
+ return __awaiter(this, void 0, void 0, function* () {
103
+ return yield this._restore(this.moduleName, this.entityName, exchangeIds);
104
+ });
105
+ }
106
+ // Use this function when you want to apply actions
107
+ applyAction(dto) {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ return yield this._applyAction(this.moduleName, this.entityName, dto);
110
+ });
111
+ }
112
+ // Use this function when you want to return the versions for a single record
113
+ getVersions() {
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ return yield this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id);
116
+ });
117
+ }
118
+ // Use this function when you want to return the change history for a single record
119
+ getRevisionTimeline() {
120
+ return __awaiter(this, void 0, void 0, function* () {
121
+ return yield this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id);
122
+ });
123
+ }
124
+ }
125
+ exports.ExchangeApi = ExchangeApi;
@@ -0,0 +1,26 @@
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 { ExchangeProperties } from '../entities-v2/Exchange';
5
+ export declare class ExchangeDb extends DbProvider {
6
+ protected readonly principal: any;
7
+ protected readonly dbService: any;
8
+ private readonly moduleName;
9
+ private readonly entityName;
10
+ private sourceRecord;
11
+ constructor(principal: any, dbService: any);
12
+ setRecord(sourceRecord: any): void;
13
+ searchRecords(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-types/dist/interfaces/v2.db.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<ExchangeProperties>>>;
14
+ searchAllRecordsAndPaginate(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-types/dist/interfaces/v2.db.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<ExchangeProperties>>>;
15
+ getByPrimaryKey(exchangeId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<ExchangeProperties>>;
16
+ getManyByPrimaryKey(exchangeIds: string[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<ExchangeProperties>[]>;
17
+ upsert(upsertDto: OdinRecordCreateDto): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes>;
18
+ upsertMany(upsertDtos: OdinRecordCreateDto[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes[]>;
19
+ update(updateDto: OdinRecordUpdateDto): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes>;
20
+ updateMany(updateDtos: OdinRecordUpdateDto[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes[]>;
21
+ delete(exchangeIds: string[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").DbRecordDeleted[]>;
22
+ restore(exchangeIds: string[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").DbRecordRestored[]>;
23
+ applyAction(actionName: string, dto: any): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes[]>;
24
+ getVersions(): Promise<any>;
25
+ getRevisionTimeline(): Promise<any>;
26
+ }
@@ -0,0 +1,108 @@
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.ExchangeDb = void 0;
13
+ const db_provider_1 = require("@d19n/odin-sdk-generator/dist/db.provider");
14
+ class ExchangeDb extends db_provider_1.DbProvider {
15
+ constructor(principal, dbService) {
16
+ super(principal, dbService);
17
+ this.moduleName = 'FieldServiceModule';
18
+ this.entityName = 'Exchange';
19
+ this.principal = principal;
20
+ this.dbService = dbService;
21
+ }
22
+ setRecord(sourceRecord) {
23
+ this.sourceRecord = sourceRecord;
24
+ }
25
+ // Use this function when you want to search and handle all pagination on your own
26
+ searchRecords(params) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ return yield this._searchRecords(this.moduleName, this.entityName, params);
29
+ });
30
+ }
31
+ // Use this function when you want paginating through the results to be handled
32
+ searchAllRecordsAndPaginate(params) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ return yield this._searchAllRecordsAndPaginate(this.moduleName, this.entityName, params);
35
+ });
36
+ }
37
+ // Use this function when you want to return a single record
38
+ getByPrimaryKey(exchangeId) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ const res = yield this._getByPrimaryKey(this.moduleName, this.entityName, exchangeId);
41
+ this.setRecord(res);
42
+ return res;
43
+ });
44
+ }
45
+ // Use this function when you want to return many records by primaryKeys
46
+ getManyByPrimaryKey(exchangeIds) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ return yield this._getManyByPrimaryKey(this.moduleName, this.entityName, exchangeIds);
49
+ });
50
+ }
51
+ // Use this function when you want to upsert one record
52
+ upsert(upsertDto) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ const res = yield this._upsert(this.moduleName, this.entityName, [upsertDto]);
55
+ return res[0];
56
+ });
57
+ }
58
+ // Use this function when you want to upsert many records
59
+ upsertMany(upsertDtos) {
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ return yield this._upsert(this.moduleName, this.entityName, upsertDtos);
62
+ });
63
+ }
64
+ // Use this function when you want to update one record
65
+ update(updateDto) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ const res = yield this._update(this.moduleName, this.entityName, [updateDto]);
68
+ return res[0];
69
+ });
70
+ }
71
+ // Use this function when you want to update many records
72
+ updateMany(updateDtos) {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ return yield this._update(this.moduleName, this.entityName, updateDtos);
75
+ });
76
+ }
77
+ // Use this function when you want to delete one or many records
78
+ delete(exchangeIds) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ return yield this._delete(this.moduleName, this.entityName, exchangeIds);
81
+ });
82
+ }
83
+ // Use this function when you want to restore one or many records
84
+ restore(exchangeIds) {
85
+ return __awaiter(this, void 0, void 0, function* () {
86
+ return yield this._restore(this.moduleName, this.entityName, exchangeIds);
87
+ });
88
+ }
89
+ // Use this function when you want to apply actions
90
+ applyAction(actionName, dto) {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ return yield this._applyAction(this.moduleName, this.entityName, dto);
93
+ });
94
+ }
95
+ // Use this function when you want to return the versions for a single record
96
+ getVersions() {
97
+ return __awaiter(this, void 0, void 0, function* () {
98
+ return yield this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id);
99
+ });
100
+ }
101
+ // Use this function when you want to return the change history for a single record
102
+ getRevisionTimeline() {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ return yield this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id);
105
+ });
106
+ }
107
+ }
108
+ exports.ExchangeDb = ExchangeDb;
@@ -0,0 +1,25 @@
1
+ import { OdinRecord } from '@d19n/odin-types/dist/types/odin.types';
2
+ export declare enum ExchangeEntityTypes {
3
+ DEFAULT = "DEFAULT"
4
+ }
5
+ export declare enum ExchangePropertyKeys {
6
+ Name = "Name",
7
+ ExPolygonId = "ExPolygonId",
8
+ Borough = "Borough",
9
+ ExternalRef = "ExternalRef"
10
+ }
11
+ export interface ExchangeProperties {
12
+ Name: string;
13
+ ExPolygonId: number;
14
+ Borough: string;
15
+ ExternalRef: number;
16
+ }
17
+ export declare class Exchange extends OdinRecord<ExchangeProperties> {
18
+ entity: 'FieldServiceModule:Exchange';
19
+ type: ExchangeEntityTypes;
20
+ schemaId: 'dc379fc8-514d-4938-9d6f-a26b305dafd2';
21
+ properties: ExchangeProperties;
22
+ }
23
+ export declare const ROUTING_KEY_EXCHANGE_CREATED = "FieldServiceModule.Exchange.SubDbRecordCreated";
24
+ export declare const ROUTING_KEY_EXCHANGE_UPDATED = "FieldServiceModule.Exchange.SubDbRecordUpdated";
25
+ export declare const ROUTING_KEY_EXCHANGE_DELETED = "FieldServiceModule.Exchange.SubDbRecordDeleted";
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ROUTING_KEY_EXCHANGE_DELETED = exports.ROUTING_KEY_EXCHANGE_UPDATED = exports.ROUTING_KEY_EXCHANGE_CREATED = exports.Exchange = exports.ExchangePropertyKeys = exports.ExchangeEntityTypes = void 0;
4
+ const odin_types_1 = require("@d19n/odin-types/dist/types/odin.types");
5
+ var ExchangeEntityTypes;
6
+ (function (ExchangeEntityTypes) {
7
+ ExchangeEntityTypes["DEFAULT"] = "DEFAULT";
8
+ })(ExchangeEntityTypes = exports.ExchangeEntityTypes || (exports.ExchangeEntityTypes = {}));
9
+ var ExchangePropertyKeys;
10
+ (function (ExchangePropertyKeys) {
11
+ ExchangePropertyKeys["Name"] = "Name";
12
+ ExchangePropertyKeys["ExPolygonId"] = "ExPolygonId";
13
+ ExchangePropertyKeys["Borough"] = "Borough";
14
+ ExchangePropertyKeys["ExternalRef"] = "ExternalRef";
15
+ })(ExchangePropertyKeys = exports.ExchangePropertyKeys || (exports.ExchangePropertyKeys = {}));
16
+ class Exchange extends odin_types_1.OdinRecord {
17
+ }
18
+ exports.Exchange = Exchange;
19
+ // Rabbitmq event routing keys
20
+ exports.ROUTING_KEY_EXCHANGE_CREATED = 'FieldServiceModule.Exchange.SubDbRecordCreated';
21
+ exports.ROUTING_KEY_EXCHANGE_UPDATED = 'FieldServiceModule.Exchange.SubDbRecordUpdated';
22
+ exports.ROUTING_KEY_EXCHANGE_DELETED = 'FieldServiceModule.Exchange.SubDbRecordDeleted';
@@ -108,6 +108,7 @@ export declare enum OdinEntities {
108
108
  OFFER = "ProductModule:Offer",
109
109
  FIELD_SERVICE_PRODUCT = "FieldServiceModule:FieldServiceProduct",
110
110
  SITE_SPECIFIC_RISK_ASSESSMENT_OUTCOME_FORM = "FieldServiceModule:SiteSpecificRiskAssessmentOutcomeForm",
111
+ EXCHANGE = "FieldServiceModule:Exchange",
111
112
  NOTIFICATION_TEMPLATE = "NotificationModule:NotificationTemplate",
112
113
  VOICE_CONFIGURATION = "ServiceModule:VoiceConfiguration",
113
114
  DASHBOARD = "SupportModule:Dashboard",
@@ -112,6 +112,7 @@ var OdinEntities;
112
112
  OdinEntities["OFFER"] = "ProductModule:Offer";
113
113
  OdinEntities["FIELD_SERVICE_PRODUCT"] = "FieldServiceModule:FieldServiceProduct";
114
114
  OdinEntities["SITE_SPECIFIC_RISK_ASSESSMENT_OUTCOME_FORM"] = "FieldServiceModule:SiteSpecificRiskAssessmentOutcomeForm";
115
+ OdinEntities["EXCHANGE"] = "FieldServiceModule:Exchange";
115
116
  OdinEntities["NOTIFICATION_TEMPLATE"] = "NotificationModule:NotificationTemplate";
116
117
  OdinEntities["VOICE_CONFIGURATION"] = "ServiceModule:VoiceConfiguration";
117
118
  OdinEntities["DASHBOARD"] = "SupportModule:Dashboard";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d19n/youfibre-odin-sdk",
3
- "version": "1.0.141",
3
+ "version": "1.0.142",
4
4
  "description": "",
5
5
  "author": "@d19n",
6
6
  "license": "UNLICENSED",
@@ -0,0 +1,133 @@
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 { ExchangeProperties } from '../entities-v2/Exchange';
8
+
9
+ export class ExchangeApi extends ApiProvider {
10
+
11
+ private readonly moduleName: string = 'FieldServiceModule';
12
+ private readonly entityName: string = 'Exchange';
13
+
14
+ private sourceRecord: any;
15
+
16
+ constructor(authParams?: OauthParams, protected readonly authToken?: string) {
17
+ super(authParams, authToken);
18
+
19
+ }
20
+
21
+
22
+ public setRecord(sourceRecord: any) {
23
+ this.sourceRecord = sourceRecord
24
+ }
25
+
26
+ public async schema() {
27
+ return await this.getSchema(this.moduleName, this.entityName);
28
+ }
29
+
30
+ // Use this function when you want to search and handle all pagination on your own
31
+ public async search(params: Partial<OdinSearchV2>) {
32
+ return await this._searchRecords<ExchangeProperties>(this.moduleName, this.entityName, params);
33
+ }
34
+
35
+ // Use this function when you want paginating through the results to be handled
36
+ public async searchAndPaginate(params: Partial<OdinSearchV2>) {
37
+ return await this._searchAllRecordsAndPaginate<ExchangeProperties>(this.moduleName, this.entityName, params);
38
+ }
39
+
40
+ // Use this function to re-index records in elastic search
41
+ public async reIndex(body: { id: string, schemaId: string }[]) {
42
+ return await this._reIndexRecords(body);
43
+ }
44
+
45
+ // Use this function when you want to return a single record
46
+ public async get(exchangeId: string) {
47
+ const res = await this._getByPrimaryKey<ExchangeProperties>(
48
+ this.moduleName,
49
+ this.entityName,
50
+ exchangeId
51
+ );
52
+ this.setRecord(res);
53
+
54
+ return res;
55
+ }
56
+
57
+ // Use this function when you want to return many records by primaryKeys
58
+ public async getMany(exchangeIds: string[]) {
59
+ return await this._getManyByPrimaryKey<ExchangeProperties>(
60
+ this.moduleName,
61
+ this.entityName,
62
+ exchangeIds
63
+ );
64
+ }
65
+
66
+ // Use this function when you want to upsert one record
67
+ public async upsert(upsertDto: OdinRecordCreateDto) {
68
+ const res = await this._upsert(this.moduleName, this.entityName, [upsertDto]);
69
+ return res[0];
70
+ }
71
+
72
+ // Use this function when you want to upsert many records
73
+ public async upsertMany(upsertDtos: OdinRecordCreateDto[]) {
74
+ return await this._upsert(this.moduleName, this.entityName, upsertDtos);
75
+ }
76
+
77
+ // Use this function when you want to update one record
78
+ public async update(updateDto: OdinRecordUpdateDto) {
79
+ const res = await 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
+ public async updateMany(updateDtos: OdinRecordUpdateDto[]) {
85
+ return await this._update(this.moduleName, this.entityName, updateDtos);
86
+ }
87
+
88
+ // Use this function when you want to delete one record
89
+ public async delete(exchangeId: string) {
90
+ const res = await this._delete(
91
+ this.moduleName,
92
+ this.entityName,
93
+ [exchangeId]
94
+ );
95
+ return res[0];
96
+ }
97
+
98
+ // Use this function when you want to delete many records
99
+ public async deleteMany(exchangeIds: string[]) {
100
+ return await this._delete(
101
+ this.moduleName,
102
+ this.entityName,
103
+ exchangeIds
104
+ );
105
+ }
106
+
107
+ // Use this function when you want to restore one or many records
108
+ public async restore(exchangeIds: string[]) {
109
+ return await this._restore(
110
+ this.moduleName,
111
+ this.entityName,
112
+ exchangeIds
113
+ );
114
+ }
115
+
116
+ // Use this function when you want to apply actions
117
+ public async applyAction(dto: any) {
118
+ return await this._applyAction(this.moduleName, this.entityName, dto);
119
+ }
120
+
121
+ // Use this function when you want to return the versions for a single record
122
+ public async getVersions() {
123
+ return await this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id);
124
+ }
125
+
126
+ // Use this function when you want to return the change history for a single record
127
+ public async getRevisionTimeline() {
128
+ return await this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id);
129
+ }
130
+
131
+
132
+ }
133
+
@@ -0,0 +1,119 @@
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 { ExchangeProperties } from '../entities-v2/Exchange';
7
+
8
+ export class ExchangeDb extends DbProvider {
9
+ protected readonly principal: any;
10
+ protected readonly dbService: any;
11
+
12
+
13
+ private readonly moduleName: string = 'FieldServiceModule';
14
+ private readonly entityName: string = 'Exchange';
15
+
16
+ private sourceRecord: any;
17
+
18
+ constructor(principal: any, dbService: any) {
19
+ super(principal, dbService);
20
+
21
+ this.principal = principal;
22
+ this.dbService = dbService;
23
+
24
+ }
25
+
26
+
27
+ public setRecord(sourceRecord: any) {
28
+ this.sourceRecord = sourceRecord
29
+ }
30
+
31
+ // Use this function when you want to search and handle all pagination on your own
32
+ public async searchRecords(params: Partial<OdinSearchV2>) {
33
+ return await this._searchRecords<ExchangeProperties>(this.moduleName, this.entityName, params);
34
+ }
35
+
36
+ // Use this function when you want paginating through the results to be handled
37
+ public async searchAllRecordsAndPaginate(params: Partial<OdinSearchV2>) {
38
+ return await this._searchAllRecordsAndPaginate<ExchangeProperties>(this.moduleName, this.entityName, params);
39
+ }
40
+
41
+ // Use this function when you want to return a single record
42
+ public async getByPrimaryKey(exchangeId: string) {
43
+ const res = await this._getByPrimaryKey<ExchangeProperties>(
44
+ this.moduleName,
45
+ this.entityName,
46
+ exchangeId
47
+ );
48
+ this.setRecord(res);
49
+
50
+ return res;
51
+ }
52
+
53
+ // Use this function when you want to return many records by primaryKeys
54
+ public async getManyByPrimaryKey(exchangeIds: string[]) {
55
+ return await this._getManyByPrimaryKey<ExchangeProperties>(
56
+ this.moduleName,
57
+ this.entityName,
58
+ exchangeIds
59
+ );
60
+ }
61
+
62
+ // Use this function when you want to upsert one record
63
+ public async upsert(upsertDto: OdinRecordCreateDto) {
64
+ const res = await this._upsert(this.moduleName, this.entityName, [upsertDto]);
65
+ return res[0];
66
+ }
67
+
68
+ // Use this function when you want to upsert many records
69
+ public async upsertMany(upsertDtos: OdinRecordCreateDto[]) {
70
+ return await this._upsert(this.moduleName, this.entityName, upsertDtos);
71
+ }
72
+
73
+ // Use this function when you want to update one record
74
+ public async update(updateDto: OdinRecordUpdateDto) {
75
+ const res = await this._update(this.moduleName, this.entityName, [updateDto]);
76
+ return res[0];
77
+ }
78
+
79
+ // Use this function when you want to update many records
80
+ public async updateMany(updateDtos: OdinRecordUpdateDto[]) {
81
+ return await this._update(this.moduleName, this.entityName, updateDtos);
82
+ }
83
+
84
+ // Use this function when you want to delete one or many records
85
+ public async delete(exchangeIds: string[]) {
86
+ return await this._delete(
87
+ this.moduleName,
88
+ this.entityName,
89
+ exchangeIds
90
+ );
91
+ }
92
+
93
+ // Use this function when you want to restore one or many records
94
+ public async restore(exchangeIds: string[]) {
95
+ return await this._restore(
96
+ this.moduleName,
97
+ this.entityName,
98
+ exchangeIds
99
+ );
100
+ }
101
+
102
+ // Use this function when you want to apply actions
103
+ public async applyAction(actionName: string, dto: any) {
104
+ return await this._applyAction(this.moduleName, this.entityName, dto);
105
+ }
106
+
107
+ // Use this function when you want to return the versions for a single record
108
+ public async getVersions() {
109
+ return await this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id);
110
+ }
111
+
112
+ // Use this function when you want to return the change history for a single record
113
+ public async getRevisionTimeline() {
114
+ return await this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id);
115
+ }
116
+
117
+
118
+ }
119
+
@@ -0,0 +1,49 @@
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
+
7
+
8
+ export enum ExchangeEntityTypes {
9
+ DEFAULT = 'DEFAULT',
10
+ }
11
+
12
+
13
+
14
+ export enum ExchangePropertyKeys {
15
+ Name = 'Name',
16
+ ExPolygonId = 'ExPolygonId',
17
+ Borough = 'Borough',
18
+ ExternalRef = 'ExternalRef',
19
+ }
20
+
21
+
22
+ export interface ExchangeProperties {
23
+ //name
24
+ Name: string
25
+ //ExPolygonId
26
+ ExPolygonId: number
27
+ //Borough
28
+ Borough: string
29
+ //ExternalRef
30
+ ExternalRef: number
31
+ }
32
+
33
+
34
+ export class Exchange extends OdinRecord<ExchangeProperties> {
35
+ entity: 'FieldServiceModule:Exchange';
36
+ type: ExchangeEntityTypes;
37
+ schemaId: 'dc379fc8-514d-4938-9d6f-a26b305dafd2';
38
+ properties: ExchangeProperties;
39
+ }
40
+
41
+ // Rabbitmq event routing keys
42
+
43
+
44
+ export const ROUTING_KEY_EXCHANGE_CREATED = 'FieldServiceModule.Exchange.SubDbRecordCreated';
45
+ export const ROUTING_KEY_EXCHANGE_UPDATED = 'FieldServiceModule.Exchange.SubDbRecordUpdated';
46
+ export const ROUTING_KEY_EXCHANGE_DELETED = 'FieldServiceModule.Exchange.SubDbRecordDeleted';
47
+
48
+
49
+
@@ -110,6 +110,7 @@ export enum OdinEntities {
110
110
  OFFER = 'ProductModule:Offer',
111
111
  FIELD_SERVICE_PRODUCT = 'FieldServiceModule:FieldServiceProduct',
112
112
  SITE_SPECIFIC_RISK_ASSESSMENT_OUTCOME_FORM = 'FieldServiceModule:SiteSpecificRiskAssessmentOutcomeForm',
113
+ EXCHANGE = 'FieldServiceModule:Exchange',
113
114
  NOTIFICATION_TEMPLATE = 'NotificationModule:NotificationTemplate',
114
115
  VOICE_CONFIGURATION = 'ServiceModule:VoiceConfiguration',
115
116
  DASHBOARD = 'SupportModule:Dashboard',