@d19n/youfibre-odin-sdk 1.0.25 → 1.0.26

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.
@@ -62,6 +62,13 @@ export declare class FileApi extends ApiProvider {
62
62
  relatedAssociationId?: string;
63
63
  }[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinAssociationMetaData[]>;
64
64
  unLinkInternalInstallAuditFiles(fileId: string, linkedInternalInstallAuditId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinLinkDeleteResponse[]>;
65
+ getKnowledgeArticles(fileId: string): Promise<any>;
66
+ linkKnowledgeArticleFiles(fileId: string, knowledgeArticleIds: {
67
+ id: string;
68
+ relationType?: RelationTypeEnum;
69
+ relatedAssociationId?: string;
70
+ }[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinAssociationMetaData[]>;
71
+ unLinkKnowledgeArticleFiles(fileId: string, linkedKnowledgeArticleId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinLinkDeleteResponse[]>;
65
72
  getCases(fileId: string): Promise<any>;
66
73
  linkCaseFiles(fileId: string, caseIds: {
67
74
  id: string;
@@ -209,6 +216,20 @@ export declare class FileApi extends ApiProvider {
209
216
  relatedAssociationId?: string;
210
217
  }[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinAssociationMetaData[]>;
211
218
  unLinkVisitFiles(fileId: string, linkedVisitId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinLinkDeleteResponse[]>;
219
+ getNetomniaFtth2StageInstallAudits(fileId: string): Promise<any>;
220
+ linkNetomniaFtth2StageInstallAuditFiles(fileId: string, netomniaFtth2StageInstallAuditIds: {
221
+ id: string;
222
+ relationType?: RelationTypeEnum;
223
+ relatedAssociationId?: string;
224
+ }[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinAssociationMetaData[]>;
225
+ unLinkNetomniaFtth2StageInstallAuditFiles(fileId: string, linkedNetomniaFtth2StageInstallAuditId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinLinkDeleteResponse[]>;
226
+ getYfStockCounts(fileId: string): Promise<any>;
227
+ linkYfStockCountFiles(fileId: string, yfStockCountIds: {
228
+ id: string;
229
+ relationType?: RelationTypeEnum;
230
+ relatedAssociationId?: string;
231
+ }[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinAssociationMetaData[]>;
232
+ unLinkYfStockCountFiles(fileId: string, linkedYfStockCountId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinLinkDeleteResponse[]>;
212
233
  getYfEquipmentCollections(fileId: string): Promise<any>;
213
234
  linkYfEquipmentCollectionFiles(fileId: string, yfEquipmentCollectionIds: {
214
235
  id: string;
@@ -299,6 +320,27 @@ export declare class FileApi extends ApiProvider {
299
320
  relatedAssociationId?: string;
300
321
  }[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinAssociationMetaData[]>;
301
322
  unLinkUgAuditOfInstallationFiles(fileId: string, linkedUgAuditOfInstallationId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinLinkDeleteResponse[]>;
323
+ getUgRetroAudits(fileId: string): Promise<any>;
324
+ linkUgRetroAuditFiles(fileId: string, ugRetroAuditIds: {
325
+ id: string;
326
+ relationType?: RelationTypeEnum;
327
+ relatedAssociationId?: string;
328
+ }[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinAssociationMetaData[]>;
329
+ unLinkUgRetroAuditFiles(fileId: string, linkedUgRetroAuditId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinLinkDeleteResponse[]>;
330
+ getOhRetroAudits(fileId: string): Promise<any>;
331
+ linkOhRetroAuditFiles(fileId: string, ohRetroAuditIds: {
332
+ id: string;
333
+ relationType?: RelationTypeEnum;
334
+ relatedAssociationId?: string;
335
+ }[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinAssociationMetaData[]>;
336
+ unLinkOhRetroAuditFiles(fileId: string, linkedOhRetroAuditId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinLinkDeleteResponse[]>;
337
+ getRemediationOutcomeForms(fileId: string): Promise<any>;
338
+ linkRemediationOutcomeFormFiles(fileId: string, remediationOutcomeFormIds: {
339
+ id: string;
340
+ relationType?: RelationTypeEnum;
341
+ relatedAssociationId?: string;
342
+ }[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinAssociationMetaData[]>;
343
+ unLinkRemediationOutcomeFormFiles(fileId: string, linkedRemediationOutcomeFormId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinLinkDeleteResponse[]>;
302
344
  getUgInProgressAudits(fileId: string): Promise<any>;
303
345
  linkUgInProgressAuditFiles(fileId: string, ugInProgressAuditIds: {
304
346
  id: string;
@@ -313,6 +355,13 @@ export declare class FileApi extends ApiProvider {
313
355
  relatedAssociationId?: string;
314
356
  }[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinAssociationMetaData[]>;
315
357
  unLinkOhInProgressAuditFiles(fileId: string, linkedOhInProgressAuditId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinLinkDeleteResponse[]>;
358
+ getBlockageA55s(fileId: string): Promise<any>;
359
+ linkOverlayA55Files(fileId: string, blockageA55Ids: {
360
+ id: string;
361
+ relationType?: RelationTypeEnum;
362
+ relatedAssociationId?: string;
363
+ }[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinAssociationMetaData[]>;
364
+ unLinkOverlayA55Files(fileId: string, linkedBlockageA55Id: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinLinkDeleteResponse[]>;
316
365
  getOverlayRealA55s(fileId: string): Promise<any>;
317
366
  linkOverlayRealA55Files(fileId: string, overlayRealA55Ids: {
318
367
  id: string;
@@ -221,6 +221,32 @@ class FileApi extends api_provider_1.ApiProvider {
221
221
  });
222
222
  }
223
223
  // Use this function when you want to return a single record
224
+ getKnowledgeArticles(fileId) {
225
+ return __awaiter(this, void 0, void 0, function* () {
226
+ return yield this._getLinks(this.moduleName, this.entityName, fileId, 'KnowledgeArticle');
227
+ });
228
+ }
229
+ linkKnowledgeArticleFiles(fileId, knowledgeArticleIds) {
230
+ return __awaiter(this, void 0, void 0, function* () {
231
+ const associationDtos = [];
232
+ for (const param of knowledgeArticleIds) {
233
+ associationDtos.push({
234
+ entity: 'SupportModule:KnowledgeArticle',
235
+ recordId: param.id,
236
+ linkType: 'KnowledgeArticle__File',
237
+ relationType: param === null || param === void 0 ? void 0 : param.relationType,
238
+ relatedAssociationId: param === null || param === void 0 ? void 0 : param.relatedAssociationId
239
+ });
240
+ }
241
+ return yield this._createLinks(this.moduleName, this.entityName, fileId, associationDtos);
242
+ });
243
+ }
244
+ unLinkKnowledgeArticleFiles(fileId, linkedKnowledgeArticleId) {
245
+ return __awaiter(this, void 0, void 0, function* () {
246
+ return yield this._deleteLinks(this.moduleName, this.entityName, fileId, linkedKnowledgeArticleId);
247
+ });
248
+ }
249
+ // Use this function when you want to return a single record
224
250
  getCases(fileId) {
225
251
  return __awaiter(this, void 0, void 0, function* () {
226
252
  return yield this._getLinks(this.moduleName, this.entityName, fileId, 'Case');
@@ -767,6 +793,58 @@ class FileApi extends api_provider_1.ApiProvider {
767
793
  });
768
794
  }
769
795
  // Use this function when you want to return a single record
796
+ getNetomniaFtth2StageInstallAudits(fileId) {
797
+ return __awaiter(this, void 0, void 0, function* () {
798
+ return yield this._getLinks(this.moduleName, this.entityName, fileId, 'NetomniaFtth2StageInstallAudit');
799
+ });
800
+ }
801
+ linkNetomniaFtth2StageInstallAuditFiles(fileId, netomniaFtth2StageInstallAuditIds) {
802
+ return __awaiter(this, void 0, void 0, function* () {
803
+ const associationDtos = [];
804
+ for (const param of netomniaFtth2StageInstallAuditIds) {
805
+ associationDtos.push({
806
+ entity: 'FieldServiceModule:NetomniaFtth2StageInstallAudit',
807
+ recordId: param.id,
808
+ linkType: 'NetomniaFtth2StageInstallAudit__File',
809
+ relationType: param === null || param === void 0 ? void 0 : param.relationType,
810
+ relatedAssociationId: param === null || param === void 0 ? void 0 : param.relatedAssociationId
811
+ });
812
+ }
813
+ return yield this._createLinks(this.moduleName, this.entityName, fileId, associationDtos);
814
+ });
815
+ }
816
+ unLinkNetomniaFtth2StageInstallAuditFiles(fileId, linkedNetomniaFtth2StageInstallAuditId) {
817
+ return __awaiter(this, void 0, void 0, function* () {
818
+ return yield this._deleteLinks(this.moduleName, this.entityName, fileId, linkedNetomniaFtth2StageInstallAuditId);
819
+ });
820
+ }
821
+ // Use this function when you want to return a single record
822
+ getYfStockCounts(fileId) {
823
+ return __awaiter(this, void 0, void 0, function* () {
824
+ return yield this._getLinks(this.moduleName, this.entityName, fileId, 'YfStockCount');
825
+ });
826
+ }
827
+ linkYfStockCountFiles(fileId, yfStockCountIds) {
828
+ return __awaiter(this, void 0, void 0, function* () {
829
+ const associationDtos = [];
830
+ for (const param of yfStockCountIds) {
831
+ associationDtos.push({
832
+ entity: 'FieldServiceModule:YfStockCount',
833
+ recordId: param.id,
834
+ linkType: 'YfStockCount__File',
835
+ relationType: param === null || param === void 0 ? void 0 : param.relationType,
836
+ relatedAssociationId: param === null || param === void 0 ? void 0 : param.relatedAssociationId
837
+ });
838
+ }
839
+ return yield this._createLinks(this.moduleName, this.entityName, fileId, associationDtos);
840
+ });
841
+ }
842
+ unLinkYfStockCountFiles(fileId, linkedYfStockCountId) {
843
+ return __awaiter(this, void 0, void 0, function* () {
844
+ return yield this._deleteLinks(this.moduleName, this.entityName, fileId, linkedYfStockCountId);
845
+ });
846
+ }
847
+ // Use this function when you want to return a single record
770
848
  getYfEquipmentCollections(fileId) {
771
849
  return __awaiter(this, void 0, void 0, function* () {
772
850
  return yield this._getLinks(this.moduleName, this.entityName, fileId, 'YfEquipmentCollection');
@@ -1099,6 +1177,84 @@ class FileApi extends api_provider_1.ApiProvider {
1099
1177
  });
1100
1178
  }
1101
1179
  // Use this function when you want to return a single record
1180
+ getUgRetroAudits(fileId) {
1181
+ return __awaiter(this, void 0, void 0, function* () {
1182
+ return yield this._getLinks(this.moduleName, this.entityName, fileId, 'UgRetroAudit');
1183
+ });
1184
+ }
1185
+ linkUgRetroAuditFiles(fileId, ugRetroAuditIds) {
1186
+ return __awaiter(this, void 0, void 0, function* () {
1187
+ const associationDtos = [];
1188
+ for (const param of ugRetroAuditIds) {
1189
+ associationDtos.push({
1190
+ entity: 'FieldServiceModule:UgRetroAudit',
1191
+ recordId: param.id,
1192
+ linkType: 'UgRetroAudit__File',
1193
+ relationType: param === null || param === void 0 ? void 0 : param.relationType,
1194
+ relatedAssociationId: param === null || param === void 0 ? void 0 : param.relatedAssociationId
1195
+ });
1196
+ }
1197
+ return yield this._createLinks(this.moduleName, this.entityName, fileId, associationDtos);
1198
+ });
1199
+ }
1200
+ unLinkUgRetroAuditFiles(fileId, linkedUgRetroAuditId) {
1201
+ return __awaiter(this, void 0, void 0, function* () {
1202
+ return yield this._deleteLinks(this.moduleName, this.entityName, fileId, linkedUgRetroAuditId);
1203
+ });
1204
+ }
1205
+ // Use this function when you want to return a single record
1206
+ getOhRetroAudits(fileId) {
1207
+ return __awaiter(this, void 0, void 0, function* () {
1208
+ return yield this._getLinks(this.moduleName, this.entityName, fileId, 'OhRetroAudit');
1209
+ });
1210
+ }
1211
+ linkOhRetroAuditFiles(fileId, ohRetroAuditIds) {
1212
+ return __awaiter(this, void 0, void 0, function* () {
1213
+ const associationDtos = [];
1214
+ for (const param of ohRetroAuditIds) {
1215
+ associationDtos.push({
1216
+ entity: 'FieldServiceModule:OhRetroAudit',
1217
+ recordId: param.id,
1218
+ linkType: 'OhRetroAudit__File',
1219
+ relationType: param === null || param === void 0 ? void 0 : param.relationType,
1220
+ relatedAssociationId: param === null || param === void 0 ? void 0 : param.relatedAssociationId
1221
+ });
1222
+ }
1223
+ return yield this._createLinks(this.moduleName, this.entityName, fileId, associationDtos);
1224
+ });
1225
+ }
1226
+ unLinkOhRetroAuditFiles(fileId, linkedOhRetroAuditId) {
1227
+ return __awaiter(this, void 0, void 0, function* () {
1228
+ return yield this._deleteLinks(this.moduleName, this.entityName, fileId, linkedOhRetroAuditId);
1229
+ });
1230
+ }
1231
+ // Use this function when you want to return a single record
1232
+ getRemediationOutcomeForms(fileId) {
1233
+ return __awaiter(this, void 0, void 0, function* () {
1234
+ return yield this._getLinks(this.moduleName, this.entityName, fileId, 'RemediationOutcomeForm');
1235
+ });
1236
+ }
1237
+ linkRemediationOutcomeFormFiles(fileId, remediationOutcomeFormIds) {
1238
+ return __awaiter(this, void 0, void 0, function* () {
1239
+ const associationDtos = [];
1240
+ for (const param of remediationOutcomeFormIds) {
1241
+ associationDtos.push({
1242
+ entity: 'FieldServiceModule:RemediationOutcomeForm',
1243
+ recordId: param.id,
1244
+ linkType: 'RemediationOutcomeForm_File',
1245
+ relationType: param === null || param === void 0 ? void 0 : param.relationType,
1246
+ relatedAssociationId: param === null || param === void 0 ? void 0 : param.relatedAssociationId
1247
+ });
1248
+ }
1249
+ return yield this._createLinks(this.moduleName, this.entityName, fileId, associationDtos);
1250
+ });
1251
+ }
1252
+ unLinkRemediationOutcomeFormFiles(fileId, linkedRemediationOutcomeFormId) {
1253
+ return __awaiter(this, void 0, void 0, function* () {
1254
+ return yield this._deleteLinks(this.moduleName, this.entityName, fileId, linkedRemediationOutcomeFormId);
1255
+ });
1256
+ }
1257
+ // Use this function when you want to return a single record
1102
1258
  getUgInProgressAudits(fileId) {
1103
1259
  return __awaiter(this, void 0, void 0, function* () {
1104
1260
  return yield this._getLinks(this.moduleName, this.entityName, fileId, 'UgInProgressAudit');
@@ -1151,6 +1307,32 @@ class FileApi extends api_provider_1.ApiProvider {
1151
1307
  });
1152
1308
  }
1153
1309
  // Use this function when you want to return a single record
1310
+ getBlockageA55s(fileId) {
1311
+ return __awaiter(this, void 0, void 0, function* () {
1312
+ return yield this._getLinks(this.moduleName, this.entityName, fileId, 'BlockageA55');
1313
+ });
1314
+ }
1315
+ linkOverlayA55Files(fileId, blockageA55Ids) {
1316
+ return __awaiter(this, void 0, void 0, function* () {
1317
+ const associationDtos = [];
1318
+ for (const param of blockageA55Ids) {
1319
+ associationDtos.push({
1320
+ entity: 'FieldServiceModule:BlockageA55',
1321
+ recordId: param.id,
1322
+ linkType: 'OverlayA55_File',
1323
+ relationType: param === null || param === void 0 ? void 0 : param.relationType,
1324
+ relatedAssociationId: param === null || param === void 0 ? void 0 : param.relatedAssociationId
1325
+ });
1326
+ }
1327
+ return yield this._createLinks(this.moduleName, this.entityName, fileId, associationDtos);
1328
+ });
1329
+ }
1330
+ unLinkOverlayA55Files(fileId, linkedBlockageA55Id) {
1331
+ return __awaiter(this, void 0, void 0, function* () {
1332
+ return yield this._deleteLinks(this.moduleName, this.entityName, fileId, linkedBlockageA55Id);
1333
+ });
1334
+ }
1335
+ // Use this function when you want to return a single record
1154
1336
  getOverlayRealA55s(fileId) {
1155
1337
  return __awaiter(this, void 0, void 0, function* () {
1156
1338
  return yield this._getLinks(this.moduleName, this.entityName, fileId, 'OverlayRealA55');
@@ -0,0 +1,30 @@
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
+ export declare class OntReplacementApprovalApi extends ApiProvider {
6
+ protected readonly authParams: OauthParams;
7
+ protected readonly authToken?: string;
8
+ private readonly moduleName;
9
+ private readonly entityName;
10
+ constructor(authParams: OauthParams, authToken?: string);
11
+ schema(): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinSchema>;
12
+ searchRecords(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-sdk-generator/dist/api.interfaces").OdinSearchResponse<any>>;
13
+ reIndexRecords(body: {
14
+ id: string;
15
+ schemaId: string;
16
+ }[]): Promise<any>;
17
+ searchAllRecordsAndPaginate(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-sdk-generator/dist/api.interfaces").OdinSearchResponse<any>>;
18
+ getByPrimaryKey(ontReplacementApprovalId: string): Promise<any>;
19
+ getVersions(ontReplacementApprovalId: string): Promise<{
20
+ [key: string]: Record<string, any>;
21
+ }>;
22
+ getRevisionTimeline(ontReplacementApprovalId: string): Promise<{
23
+ [key: string]: Record<string, any>[];
24
+ }>;
25
+ getManyByPrimaryKey(ontReplacementApprovalIds: string[]): Promise<any[]>;
26
+ upsert(upsertDtos: OdinRecordCreateDto[]): Promise<any[]>;
27
+ update(updateDtos: OdinRecordUpdateDto[]): Promise<any[]>;
28
+ delete(ontReplacementApprovalIds: string[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinDeleteResponse[]>;
29
+ restore(ontReplacementApprovalIds: string[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinRestoreResponse[]>;
30
+ }
@@ -0,0 +1,94 @@
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.OntReplacementApprovalApi = void 0;
13
+ const api_provider_1 = require("@d19n/odin-sdk-generator/dist/api.provider");
14
+ class OntReplacementApprovalApi extends api_provider_1.ApiProvider {
15
+ constructor(authParams, authToken) {
16
+ super(authParams, authToken);
17
+ this.authParams = authParams;
18
+ this.authToken = authToken;
19
+ this.moduleName = 'FieldServiceModule';
20
+ this.entityName = 'OntReplacementApproval';
21
+ }
22
+ schema() {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ return yield this.getSchema(this.moduleName, this.entityName);
25
+ });
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 to re-index records in elastic search
34
+ reIndexRecords(body) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ return yield this._reIndexRecords(body);
37
+ });
38
+ }
39
+ // Use this function when you want paginating through the results to be handled
40
+ searchAllRecordsAndPaginate(params) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ return yield this._searchAllRecordsAndPaginate(this.moduleName, this.entityName, params);
43
+ });
44
+ }
45
+ // Use this function when you want to return a single record
46
+ getByPrimaryKey(ontReplacementApprovalId) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ return yield this._getByPrimaryKey(this.moduleName, this.entityName, ontReplacementApprovalId);
49
+ });
50
+ }
51
+ // Use this function when you want to return the versions for a single record
52
+ getVersions(ontReplacementApprovalId) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ return yield this._getVersions(this.moduleName, this.entityName, ontReplacementApprovalId);
55
+ });
56
+ }
57
+ // Use this function when you want to return the change history for a single record
58
+ getRevisionTimeline(ontReplacementApprovalId) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ return yield this._getRevisionTimeline(this.moduleName, this.entityName, ontReplacementApprovalId);
61
+ });
62
+ }
63
+ // Use this function when you want to return many records by primaryKeys
64
+ getManyByPrimaryKey(ontReplacementApprovalIds) {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ return yield this._getManyByPrimaryKey(this.moduleName, this.entityName, ontReplacementApprovalIds);
67
+ });
68
+ }
69
+ // Use this function when you want to upsert one or many records
70
+ upsert(upsertDtos) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ return yield this._upsert(this.moduleName, this.entityName, upsertDtos);
73
+ });
74
+ }
75
+ // Use this function when you want to update one or many records
76
+ update(updateDtos) {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ return yield this._update(this.moduleName, this.entityName, updateDtos);
79
+ });
80
+ }
81
+ // Use this function when you want to delete one or many records
82
+ delete(ontReplacementApprovalIds) {
83
+ return __awaiter(this, void 0, void 0, function* () {
84
+ return yield this._delete(this.moduleName, this.entityName, ontReplacementApprovalIds);
85
+ });
86
+ }
87
+ // Use this function when you want to restore one or many records
88
+ restore(ontReplacementApprovalIds) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ return yield this._restore(this.moduleName, this.entityName, ontReplacementApprovalIds);
91
+ });
92
+ }
93
+ }
94
+ exports.OntReplacementApprovalApi = OntReplacementApprovalApi;
@@ -0,0 +1,34 @@
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, RelationTypeEnum } from '@d19n/odin-types/dist/dtos/odin.dtos';
4
+ export declare class OntReplacementApprovalDb extends DbProvider {
5
+ protected readonly principal: any;
6
+ protected readonly dbService: any;
7
+ private readonly moduleName;
8
+ private readonly entityName;
9
+ constructor(principal: any, dbService: any);
10
+ searchRecords(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-sdk-generator/dist/db.interfaces").OdinSearchResponse<any>>;
11
+ searchAllRecordsAndPaginate(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-sdk-generator/dist/db.interfaces").OdinSearchResponse<any>>;
12
+ getByPrimaryKey(ontReplacementApprovalId: string): Promise<any>;
13
+ getVersions(ontReplacementApprovalId: string): Promise<any>;
14
+ getRevisionTimeline(ontReplacementApprovalId: string): Promise<any>;
15
+ getManyByPrimaryKey(ontReplacementApprovalIds: string[]): Promise<any[]>;
16
+ upsert(upsertDtos: OdinRecordCreateDto[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes[]>;
17
+ update(updateDtos: OdinRecordUpdateDto[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes[]>;
18
+ delete(ontReplacementApprovalIds: string[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").DbRecordDeleted[]>;
19
+ restore(ontReplacementApprovalIds: string[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").DbRecordRestored[]>;
20
+ getCustomerDeviceOnts(ontReplacementApprovalId: string): Promise<any>;
21
+ linkOntReplacementApprovalCustomerDeviceOnts(ontReplacementApprovalId: string, customerDeviceOntIds: {
22
+ id: string;
23
+ relationType?: RelationTypeEnum;
24
+ relatedAssociationId?: string;
25
+ }[]): Promise<any>;
26
+ unlinkOntReplacementApprovalCustomerDeviceOnts(ontReplacementApprovalId: string, linkedCustomerDeviceOntIds: string[]): Promise<any>;
27
+ getWorkOrders(ontReplacementApprovalId: string): Promise<any>;
28
+ linkOntReplacementApprovalWorkOrders(ontReplacementApprovalId: string, workOrderIds: {
29
+ id: string;
30
+ relationType?: RelationTypeEnum;
31
+ relatedAssociationId?: string;
32
+ }[]): Promise<any>;
33
+ unlinkOntReplacementApprovalWorkOrders(ontReplacementApprovalId: string, linkedWorkOrderIds: string[]): Promise<any>;
34
+ }
@@ -0,0 +1,149 @@
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.OntReplacementApprovalDb = void 0;
13
+ const db_provider_1 = require("@d19n/odin-sdk-generator/dist/db.provider");
14
+ class OntReplacementApprovalDb extends db_provider_1.DbProvider {
15
+ constructor(principal, dbService) {
16
+ super(principal, dbService);
17
+ this.principal = principal;
18
+ this.dbService = dbService;
19
+ this.moduleName = 'FieldServiceModule';
20
+ this.entityName = 'OntReplacementApproval';
21
+ }
22
+ // Use this function when you want to search and handle all pagination on your own
23
+ searchRecords(params) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ return yield this._searchRecords(this.moduleName, this.entityName, params);
26
+ });
27
+ }
28
+ // Use this function when you want paginating through the results to be handled
29
+ searchAllRecordsAndPaginate(params) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ return yield this._searchAllRecordsAndPaginate(this.moduleName, this.entityName, params);
32
+ });
33
+ }
34
+ // Use this function when you want to return a single record
35
+ getByPrimaryKey(ontReplacementApprovalId) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ return yield this._getByPrimaryKey(this.moduleName, this.entityName, ontReplacementApprovalId);
38
+ });
39
+ }
40
+ // Use this function when you want to return the versions for a single record
41
+ getVersions(ontReplacementApprovalId) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ return yield this._getVersions(this.moduleName, this.entityName, ontReplacementApprovalId);
44
+ });
45
+ }
46
+ // Use this function when you want to return the change history for a single record
47
+ getRevisionTimeline(ontReplacementApprovalId) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ return yield this._getRevisionTimeline(this.moduleName, this.entityName, ontReplacementApprovalId);
50
+ });
51
+ }
52
+ // Use this function when you want to return many records by primaryKeys
53
+ getManyByPrimaryKey(ontReplacementApprovalIds) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ return yield this._getManyByPrimaryKey(this.moduleName, this.entityName, ontReplacementApprovalIds);
56
+ });
57
+ }
58
+ // Use this function when you want to upsert one or many records
59
+ upsert(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 or many records
65
+ update(updateDtos) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ return yield this._update(this.moduleName, this.entityName, updateDtos);
68
+ });
69
+ }
70
+ // Use this function when you want to delete one or many records
71
+ delete(ontReplacementApprovalIds) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ return yield this._delete(this.moduleName, this.entityName, ontReplacementApprovalIds);
74
+ });
75
+ }
76
+ // Use this function when you want to restore one or many records
77
+ restore(ontReplacementApprovalIds) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ return yield this._restore(this.moduleName, this.entityName, ontReplacementApprovalIds);
80
+ });
81
+ }
82
+ // Use this function when you want to return a single record
83
+ getCustomerDeviceOnts(ontReplacementApprovalId) {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ return yield this._getLinks(this.moduleName, this.entityName, ontReplacementApprovalId, 'CustomerDeviceOnt');
86
+ });
87
+ }
88
+ linkOntReplacementApprovalCustomerDeviceOnts(ontReplacementApprovalId, customerDeviceOntIds) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ const associationDtos = [];
91
+ for (const param of customerDeviceOntIds) {
92
+ associationDtos.push({
93
+ entity: 'ServiceModule:CustomerDeviceOnt',
94
+ recordId: param.id,
95
+ linkType: 'OntReplacementApproval_CustomerDeviceOnt',
96
+ relationType: param === null || param === void 0 ? void 0 : param.relationType,
97
+ relatedAssociationId: param === null || param === void 0 ? void 0 : param.relatedAssociationId
98
+ });
99
+ }
100
+ return yield this._createLinks(this.moduleName, this.entityName, ontReplacementApprovalId, associationDtos);
101
+ });
102
+ }
103
+ unlinkOntReplacementApprovalCustomerDeviceOnts(ontReplacementApprovalId, linkedCustomerDeviceOntIds) {
104
+ return __awaiter(this, void 0, void 0, function* () {
105
+ const associationDtos = [];
106
+ for (const pk of linkedCustomerDeviceOntIds) {
107
+ associationDtos.push({
108
+ primaryKey: ontReplacementApprovalId,
109
+ linkedRecordPrimaryKey: pk,
110
+ });
111
+ }
112
+ return yield this._deleteLinks(this.moduleName, this.entityName, ontReplacementApprovalId, associationDtos);
113
+ });
114
+ }
115
+ // Use this function when you want to return a single record
116
+ getWorkOrders(ontReplacementApprovalId) {
117
+ return __awaiter(this, void 0, void 0, function* () {
118
+ return yield this._getLinks(this.moduleName, this.entityName, ontReplacementApprovalId, 'WorkOrder');
119
+ });
120
+ }
121
+ linkOntReplacementApprovalWorkOrders(ontReplacementApprovalId, workOrderIds) {
122
+ return __awaiter(this, void 0, void 0, function* () {
123
+ const associationDtos = [];
124
+ for (const param of workOrderIds) {
125
+ associationDtos.push({
126
+ entity: 'FieldServiceModule:WorkOrder',
127
+ recordId: param.id,
128
+ linkType: 'OntReplacementApproval_WorkOrder',
129
+ relationType: param === null || param === void 0 ? void 0 : param.relationType,
130
+ relatedAssociationId: param === null || param === void 0 ? void 0 : param.relatedAssociationId
131
+ });
132
+ }
133
+ return yield this._createLinks(this.moduleName, this.entityName, ontReplacementApprovalId, associationDtos);
134
+ });
135
+ }
136
+ unlinkOntReplacementApprovalWorkOrders(ontReplacementApprovalId, linkedWorkOrderIds) {
137
+ return __awaiter(this, void 0, void 0, function* () {
138
+ const associationDtos = [];
139
+ for (const pk of linkedWorkOrderIds) {
140
+ associationDtos.push({
141
+ primaryKey: ontReplacementApprovalId,
142
+ linkedRecordPrimaryKey: pk,
143
+ });
144
+ }
145
+ return yield this._deleteLinks(this.moduleName, this.entityName, ontReplacementApprovalId, associationDtos);
146
+ });
147
+ }
148
+ }
149
+ exports.OntReplacementApprovalDb = OntReplacementApprovalDb;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d19n/youfibre-odin-sdk",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "description": "",
5
5
  "author": "@d19n",
6
6
  "license": "UNLICENSED",
@@ -209,6 +209,33 @@
209
209
  }
210
210
 
211
211
 
212
+ // Use this function when you want to return a single record
213
+ public async getKnowledgeArticles(fileId: string) {
214
+ return await this._getLinks(this.moduleName, this.entityName, fileId, 'KnowledgeArticle');
215
+ }
216
+
217
+ public async linkKnowledgeArticleFiles(fileId: string, knowledgeArticleIds: {id: string, relationType?: RelationTypeEnum, relatedAssociationId?: string}[]) {
218
+
219
+ const associationDtos = [];
220
+ for(const param of knowledgeArticleIds){
221
+ associationDtos.push({
222
+ entity: 'SupportModule:KnowledgeArticle',
223
+ recordId: param.id,
224
+ linkType: 'KnowledgeArticle__File',
225
+ relationType: param?.relationType,
226
+ relatedAssociationId: param?.relatedAssociationId
227
+ });
228
+ }
229
+
230
+ return await this._createLinks(this.moduleName, this.entityName, fileId, associationDtos);
231
+ }
232
+
233
+ public async unLinkKnowledgeArticleFiles(fileId: string, linkedKnowledgeArticleId: string) {
234
+
235
+ return await this._deleteLinks(this.moduleName, this.entityName, fileId, linkedKnowledgeArticleId);
236
+ }
237
+
238
+
212
239
  // Use this function when you want to return a single record
213
240
  public async getCases(fileId: string) {
214
241
  return await this._getLinks(this.moduleName, this.entityName, fileId, 'Case');
@@ -776,6 +803,60 @@
776
803
  }
777
804
 
778
805
 
806
+ // Use this function when you want to return a single record
807
+ public async getNetomniaFtth2StageInstallAudits(fileId: string) {
808
+ return await this._getLinks(this.moduleName, this.entityName, fileId, 'NetomniaFtth2StageInstallAudit');
809
+ }
810
+
811
+ public async linkNetomniaFtth2StageInstallAuditFiles(fileId: string, netomniaFtth2StageInstallAuditIds: {id: string, relationType?: RelationTypeEnum, relatedAssociationId?: string}[]) {
812
+
813
+ const associationDtos = [];
814
+ for(const param of netomniaFtth2StageInstallAuditIds){
815
+ associationDtos.push({
816
+ entity: 'FieldServiceModule:NetomniaFtth2StageInstallAudit',
817
+ recordId: param.id,
818
+ linkType: 'NetomniaFtth2StageInstallAudit__File',
819
+ relationType: param?.relationType,
820
+ relatedAssociationId: param?.relatedAssociationId
821
+ });
822
+ }
823
+
824
+ return await this._createLinks(this.moduleName, this.entityName, fileId, associationDtos);
825
+ }
826
+
827
+ public async unLinkNetomniaFtth2StageInstallAuditFiles(fileId: string, linkedNetomniaFtth2StageInstallAuditId: string) {
828
+
829
+ return await this._deleteLinks(this.moduleName, this.entityName, fileId, linkedNetomniaFtth2StageInstallAuditId);
830
+ }
831
+
832
+
833
+ // Use this function when you want to return a single record
834
+ public async getYfStockCounts(fileId: string) {
835
+ return await this._getLinks(this.moduleName, this.entityName, fileId, 'YfStockCount');
836
+ }
837
+
838
+ public async linkYfStockCountFiles(fileId: string, yfStockCountIds: {id: string, relationType?: RelationTypeEnum, relatedAssociationId?: string}[]) {
839
+
840
+ const associationDtos = [];
841
+ for(const param of yfStockCountIds){
842
+ associationDtos.push({
843
+ entity: 'FieldServiceModule:YfStockCount',
844
+ recordId: param.id,
845
+ linkType: 'YfStockCount__File',
846
+ relationType: param?.relationType,
847
+ relatedAssociationId: param?.relatedAssociationId
848
+ });
849
+ }
850
+
851
+ return await this._createLinks(this.moduleName, this.entityName, fileId, associationDtos);
852
+ }
853
+
854
+ public async unLinkYfStockCountFiles(fileId: string, linkedYfStockCountId: string) {
855
+
856
+ return await this._deleteLinks(this.moduleName, this.entityName, fileId, linkedYfStockCountId);
857
+ }
858
+
859
+
779
860
  // Use this function when you want to return a single record
780
861
  public async getYfEquipmentCollections(fileId: string) {
781
862
  return await this._getLinks(this.moduleName, this.entityName, fileId, 'YfEquipmentCollection');
@@ -1122,6 +1203,87 @@
1122
1203
  }
1123
1204
 
1124
1205
 
1206
+ // Use this function when you want to return a single record
1207
+ public async getUgRetroAudits(fileId: string) {
1208
+ return await this._getLinks(this.moduleName, this.entityName, fileId, 'UgRetroAudit');
1209
+ }
1210
+
1211
+ public async linkUgRetroAuditFiles(fileId: string, ugRetroAuditIds: {id: string, relationType?: RelationTypeEnum, relatedAssociationId?: string}[]) {
1212
+
1213
+ const associationDtos = [];
1214
+ for(const param of ugRetroAuditIds){
1215
+ associationDtos.push({
1216
+ entity: 'FieldServiceModule:UgRetroAudit',
1217
+ recordId: param.id,
1218
+ linkType: 'UgRetroAudit__File',
1219
+ relationType: param?.relationType,
1220
+ relatedAssociationId: param?.relatedAssociationId
1221
+ });
1222
+ }
1223
+
1224
+ return await this._createLinks(this.moduleName, this.entityName, fileId, associationDtos);
1225
+ }
1226
+
1227
+ public async unLinkUgRetroAuditFiles(fileId: string, linkedUgRetroAuditId: string) {
1228
+
1229
+ return await this._deleteLinks(this.moduleName, this.entityName, fileId, linkedUgRetroAuditId);
1230
+ }
1231
+
1232
+
1233
+ // Use this function when you want to return a single record
1234
+ public async getOhRetroAudits(fileId: string) {
1235
+ return await this._getLinks(this.moduleName, this.entityName, fileId, 'OhRetroAudit');
1236
+ }
1237
+
1238
+ public async linkOhRetroAuditFiles(fileId: string, ohRetroAuditIds: {id: string, relationType?: RelationTypeEnum, relatedAssociationId?: string}[]) {
1239
+
1240
+ const associationDtos = [];
1241
+ for(const param of ohRetroAuditIds){
1242
+ associationDtos.push({
1243
+ entity: 'FieldServiceModule:OhRetroAudit',
1244
+ recordId: param.id,
1245
+ linkType: 'OhRetroAudit__File',
1246
+ relationType: param?.relationType,
1247
+ relatedAssociationId: param?.relatedAssociationId
1248
+ });
1249
+ }
1250
+
1251
+ return await this._createLinks(this.moduleName, this.entityName, fileId, associationDtos);
1252
+ }
1253
+
1254
+ public async unLinkOhRetroAuditFiles(fileId: string, linkedOhRetroAuditId: string) {
1255
+
1256
+ return await this._deleteLinks(this.moduleName, this.entityName, fileId, linkedOhRetroAuditId);
1257
+ }
1258
+
1259
+
1260
+ // Use this function when you want to return a single record
1261
+ public async getRemediationOutcomeForms(fileId: string) {
1262
+ return await this._getLinks(this.moduleName, this.entityName, fileId, 'RemediationOutcomeForm');
1263
+ }
1264
+
1265
+ public async linkRemediationOutcomeFormFiles(fileId: string, remediationOutcomeFormIds: {id: string, relationType?: RelationTypeEnum, relatedAssociationId?: string}[]) {
1266
+
1267
+ const associationDtos = [];
1268
+ for(const param of remediationOutcomeFormIds){
1269
+ associationDtos.push({
1270
+ entity: 'FieldServiceModule:RemediationOutcomeForm',
1271
+ recordId: param.id,
1272
+ linkType: 'RemediationOutcomeForm_File',
1273
+ relationType: param?.relationType,
1274
+ relatedAssociationId: param?.relatedAssociationId
1275
+ });
1276
+ }
1277
+
1278
+ return await this._createLinks(this.moduleName, this.entityName, fileId, associationDtos);
1279
+ }
1280
+
1281
+ public async unLinkRemediationOutcomeFormFiles(fileId: string, linkedRemediationOutcomeFormId: string) {
1282
+
1283
+ return await this._deleteLinks(this.moduleName, this.entityName, fileId, linkedRemediationOutcomeFormId);
1284
+ }
1285
+
1286
+
1125
1287
  // Use this function when you want to return a single record
1126
1288
  public async getUgInProgressAudits(fileId: string) {
1127
1289
  return await this._getLinks(this.moduleName, this.entityName, fileId, 'UgInProgressAudit');
@@ -1176,6 +1338,33 @@
1176
1338
  }
1177
1339
 
1178
1340
 
1341
+ // Use this function when you want to return a single record
1342
+ public async getBlockageA55s(fileId: string) {
1343
+ return await this._getLinks(this.moduleName, this.entityName, fileId, 'BlockageA55');
1344
+ }
1345
+
1346
+ public async linkOverlayA55Files(fileId: string, blockageA55Ids: {id: string, relationType?: RelationTypeEnum, relatedAssociationId?: string}[]) {
1347
+
1348
+ const associationDtos = [];
1349
+ for(const param of blockageA55Ids){
1350
+ associationDtos.push({
1351
+ entity: 'FieldServiceModule:BlockageA55',
1352
+ recordId: param.id,
1353
+ linkType: 'OverlayA55_File',
1354
+ relationType: param?.relationType,
1355
+ relatedAssociationId: param?.relatedAssociationId
1356
+ });
1357
+ }
1358
+
1359
+ return await this._createLinks(this.moduleName, this.entityName, fileId, associationDtos);
1360
+ }
1361
+
1362
+ public async unLinkOverlayA55Files(fileId: string, linkedBlockageA55Id: string) {
1363
+
1364
+ return await this._deleteLinks(this.moduleName, this.entityName, fileId, linkedBlockageA55Id);
1365
+ }
1366
+
1367
+
1179
1368
  // Use this function when you want to return a single record
1180
1369
  public async getOverlayRealA55s(fileId: string) {
1181
1370
  return await this._getLinks(this.moduleName, this.entityName, fileId, 'OverlayRealA55');
@@ -0,0 +1,77 @@
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, OdinLinkedRecordUpdateDto, RelationTypeEnum } from '@d19n/odin-types/dist/dtos/odin.dtos';
6
+
7
+ export class OntReplacementApprovalApi extends ApiProvider {
8
+
9
+ private readonly moduleName: string = 'FieldServiceModule';
10
+ private readonly entityName: string = 'OntReplacementApproval';
11
+
12
+ constructor(protected readonly authParams: OauthParams, protected readonly authToken?: string) {
13
+ super(authParams, authToken);
14
+ }
15
+
16
+
17
+ public async schema() {
18
+ return await this.getSchema(this.moduleName, this.entityName);
19
+ }
20
+
21
+ // Use this function when you want to search and handle all pagination on your own
22
+ public async searchRecords(params: Partial<OdinSearchV2>) {
23
+ return await this._searchRecords(this.moduleName, this.entityName, params);
24
+ }
25
+
26
+ // Use this function to re-index records in elastic search
27
+ public async reIndexRecords(body: { id: string, schemaId: string }[]) {
28
+ return await this._reIndexRecords(body);
29
+ }
30
+
31
+ // Use this function when you want paginating through the results to be handled
32
+ public async searchAllRecordsAndPaginate(params: Partial<OdinSearchV2>) {
33
+ return await this._searchAllRecordsAndPaginate(this.moduleName, this.entityName, params);
34
+ }
35
+
36
+ // Use this function when you want to return a single record
37
+ public async getByPrimaryKey(ontReplacementApprovalId: string) {
38
+ return await this._getByPrimaryKey(this.moduleName, this.entityName, ontReplacementApprovalId);
39
+ }
40
+
41
+ // Use this function when you want to return the versions for a single record
42
+ public async getVersions(ontReplacementApprovalId: string) {
43
+ return await this._getVersions(this.moduleName, this.entityName, ontReplacementApprovalId);
44
+ }
45
+
46
+ // Use this function when you want to return the change history for a single record
47
+ public async getRevisionTimeline(ontReplacementApprovalId: string) {
48
+ return await this._getRevisionTimeline(this.moduleName, this.entityName, ontReplacementApprovalId);
49
+ }
50
+
51
+ // Use this function when you want to return many records by primaryKeys
52
+ public async getManyByPrimaryKey(ontReplacementApprovalIds: string[]) {
53
+ return await this._getManyByPrimaryKey(this.moduleName, this.entityName, ontReplacementApprovalIds);
54
+ }
55
+
56
+ // Use this function when you want to upsert one or many records
57
+ public async upsert(upsertDtos: OdinRecordCreateDto[]) {
58
+ return await this._upsert(this.moduleName, this.entityName, upsertDtos);
59
+ }
60
+
61
+ // Use this function when you want to update one or many records
62
+ public async update(updateDtos: OdinRecordUpdateDto[]) {
63
+ return await this._update(this.moduleName, this.entityName, updateDtos);
64
+ }
65
+
66
+ // Use this function when you want to delete one or many records
67
+ public async delete(ontReplacementApprovalIds: string[]) {
68
+ return await this._delete(this.moduleName, this.entityName, ontReplacementApprovalIds);
69
+ }
70
+
71
+ // Use this function when you want to restore one or many records
72
+ public async restore(ontReplacementApprovalIds: string[]) {
73
+ return await this._restore(this.moduleName, this.entityName, ontReplacementApprovalIds);
74
+ }
75
+
76
+
77
+ }
@@ -0,0 +1,137 @@
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, OdinLinkedRecordUpdateDto, RelationTypeEnum } from '@d19n/odin-types/dist/dtos/odin.dtos';
5
+
6
+ export class OntReplacementApprovalDb extends DbProvider {
7
+
8
+ private readonly moduleName: string = 'FieldServiceModule';
9
+ private readonly entityName: string = 'OntReplacementApproval';
10
+
11
+ constructor(protected readonly principal: any, protected readonly dbService: any) {
12
+ super(principal, dbService);
13
+ }
14
+
15
+
16
+ // Use this function when you want to search and handle all pagination on your own
17
+ public async searchRecords(params: Partial<OdinSearchV2>) {
18
+ return await this._searchRecords(this.moduleName, this.entityName, params);
19
+ }
20
+
21
+ // Use this function when you want paginating through the results to be handled
22
+ public async searchAllRecordsAndPaginate(params: Partial<OdinSearchV2>) {
23
+ return await this._searchAllRecordsAndPaginate(this.moduleName, this.entityName, params);
24
+ }
25
+
26
+ // Use this function when you want to return a single record
27
+ public async getByPrimaryKey(ontReplacementApprovalId: string) {
28
+ return await this._getByPrimaryKey(this.moduleName, this.entityName, ontReplacementApprovalId);
29
+ }
30
+
31
+ // Use this function when you want to return the versions for a single record
32
+ public async getVersions(ontReplacementApprovalId: string) {
33
+ return await this._getVersions(this.moduleName, this.entityName, ontReplacementApprovalId);
34
+ }
35
+
36
+ // Use this function when you want to return the change history for a single record
37
+ public async getRevisionTimeline(ontReplacementApprovalId: string) {
38
+ return await this._getRevisionTimeline(this.moduleName, this.entityName, ontReplacementApprovalId);
39
+ }
40
+
41
+ // Use this function when you want to return many records by primaryKeys
42
+ public async getManyByPrimaryKey(ontReplacementApprovalIds: string[]) {
43
+ return await this._getManyByPrimaryKey(this.moduleName, this.entityName, ontReplacementApprovalIds);
44
+ }
45
+
46
+ // Use this function when you want to upsert one or many records
47
+ public async upsert(upsertDtos: OdinRecordCreateDto[]) {
48
+ return await this._upsert(this.moduleName, this.entityName, upsertDtos);
49
+ }
50
+
51
+ // Use this function when you want to update one or many records
52
+ public async update(updateDtos: OdinRecordUpdateDto[]) {
53
+ return await this._update(this.moduleName, this.entityName, updateDtos);
54
+ }
55
+
56
+ // Use this function when you want to delete one or many records
57
+ public async delete(ontReplacementApprovalIds: string[]) {
58
+ return await this._delete(this.moduleName, this.entityName, ontReplacementApprovalIds);
59
+ }
60
+
61
+ // Use this function when you want to restore one or many records
62
+ public async restore(ontReplacementApprovalIds: string[]) {
63
+ return await this._restore(this.moduleName, this.entityName, ontReplacementApprovalIds);
64
+ }
65
+
66
+
67
+ // Use this function when you want to return a single record
68
+ public async getCustomerDeviceOnts(ontReplacementApprovalId: string) {
69
+ return await this._getLinks(this.moduleName, this.entityName, ontReplacementApprovalId, 'CustomerDeviceOnt');
70
+ }
71
+
72
+ public async linkOntReplacementApprovalCustomerDeviceOnts(ontReplacementApprovalId: string, customerDeviceOntIds: {id: string, relationType?: RelationTypeEnum, relatedAssociationId?: string}[]) {
73
+
74
+ const associationDtos = [];
75
+ for(const param of customerDeviceOntIds){
76
+ associationDtos.push({
77
+ entity: 'ServiceModule:CustomerDeviceOnt',
78
+ recordId: param.id,
79
+ linkType: 'OntReplacementApproval_CustomerDeviceOnt',
80
+ relationType: param?.relationType,
81
+ relatedAssociationId: param?.relatedAssociationId
82
+ });
83
+ }
84
+
85
+ return await this._createLinks(this.moduleName, this.entityName, ontReplacementApprovalId, associationDtos);
86
+ }
87
+
88
+ public async unlinkOntReplacementApprovalCustomerDeviceOnts(ontReplacementApprovalId: string, linkedCustomerDeviceOntIds: string[]) {
89
+
90
+ const associationDtos = [];
91
+ for(const pk of linkedCustomerDeviceOntIds){
92
+ associationDtos.push({
93
+ primaryKey: ontReplacementApprovalId,
94
+ linkedRecordPrimaryKey: pk,
95
+ });
96
+ }
97
+
98
+ return await this._deleteLinks(this.moduleName, this.entityName, ontReplacementApprovalId, associationDtos);
99
+ }
100
+
101
+
102
+ // Use this function when you want to return a single record
103
+ public async getWorkOrders(ontReplacementApprovalId: string) {
104
+ return await this._getLinks(this.moduleName, this.entityName, ontReplacementApprovalId, 'WorkOrder');
105
+ }
106
+
107
+ public async linkOntReplacementApprovalWorkOrders(ontReplacementApprovalId: string, workOrderIds: {id: string, relationType?: RelationTypeEnum, relatedAssociationId?: string}[]) {
108
+
109
+ const associationDtos = [];
110
+ for(const param of workOrderIds){
111
+ associationDtos.push({
112
+ entity: 'FieldServiceModule:WorkOrder',
113
+ recordId: param.id,
114
+ linkType: 'OntReplacementApproval_WorkOrder',
115
+ relationType: param?.relationType,
116
+ relatedAssociationId: param?.relatedAssociationId
117
+ });
118
+ }
119
+
120
+ return await this._createLinks(this.moduleName, this.entityName, ontReplacementApprovalId, associationDtos);
121
+ }
122
+
123
+ public async unlinkOntReplacementApprovalWorkOrders(ontReplacementApprovalId: string, linkedWorkOrderIds: string[]) {
124
+
125
+ const associationDtos = [];
126
+ for(const pk of linkedWorkOrderIds){
127
+ associationDtos.push({
128
+ primaryKey: ontReplacementApprovalId,
129
+ linkedRecordPrimaryKey: pk,
130
+ });
131
+ }
132
+
133
+ return await this._deleteLinks(this.moduleName, this.entityName, ontReplacementApprovalId, associationDtos);
134
+ }
135
+
136
+
137
+ }