@d19n/youfibre-odin-sdk 1.0.24 → 1.0.25

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.
@@ -24,4 +24,11 @@ export declare class CustomerDeviceOntRemovalDb extends DbProvider {
24
24
  relatedAssociationId?: string;
25
25
  }[]): Promise<any>;
26
26
  unlinkCustomerDeviceOntCustomerDeviceOntRemovals(customerDeviceOntRemovalId: string, linkedCustomerDeviceOntIds: string[]): Promise<any>;
27
+ getWorkOrders(customerDeviceOntRemovalId: string): Promise<any>;
28
+ linkWorkOrderCustomerDeviceOntRemovals(customerDeviceOntRemovalId: string, workOrderIds: {
29
+ id: string;
30
+ relationType?: RelationTypeEnum;
31
+ relatedAssociationId?: string;
32
+ }[]): Promise<any>;
33
+ unlinkWorkOrderCustomerDeviceOntRemovals(customerDeviceOntRemovalId: string, linkedWorkOrderIds: string[]): Promise<any>;
27
34
  }
@@ -112,5 +112,38 @@ class CustomerDeviceOntRemovalDb extends db_provider_1.DbProvider {
112
112
  return yield this._deleteLinks(this.moduleName, this.entityName, customerDeviceOntRemovalId, associationDtos);
113
113
  });
114
114
  }
115
+ // Use this function when you want to return a single record
116
+ getWorkOrders(customerDeviceOntRemovalId) {
117
+ return __awaiter(this, void 0, void 0, function* () {
118
+ return yield this._getLinks(this.moduleName, this.entityName, customerDeviceOntRemovalId, 'WorkOrder');
119
+ });
120
+ }
121
+ linkWorkOrderCustomerDeviceOntRemovals(customerDeviceOntRemovalId, 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: 'WorkOrder_CustomerDeviceOntRemoval',
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, customerDeviceOntRemovalId, associationDtos);
134
+ });
135
+ }
136
+ unlinkWorkOrderCustomerDeviceOntRemovals(customerDeviceOntRemovalId, linkedWorkOrderIds) {
137
+ return __awaiter(this, void 0, void 0, function* () {
138
+ const associationDtos = [];
139
+ for (const pk of linkedWorkOrderIds) {
140
+ associationDtos.push({
141
+ primaryKey: customerDeviceOntRemovalId,
142
+ linkedRecordPrimaryKey: pk,
143
+ });
144
+ }
145
+ return yield this._deleteLinks(this.moduleName, this.entityName, customerDeviceOntRemovalId, associationDtos);
146
+ });
147
+ }
115
148
  }
116
149
  exports.CustomerDeviceOntRemovalDb = CustomerDeviceOntRemovalDb;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d19n/youfibre-odin-sdk",
3
- "version": "1.0.24",
3
+ "version": "1.0.25",
4
4
  "description": "",
5
5
  "author": "@d19n",
6
6
  "license": "UNLICENSED",
@@ -99,4 +99,39 @@
99
99
  }
100
100
 
101
101
 
102
+ // Use this function when you want to return a single record
103
+ public async getWorkOrders(customerDeviceOntRemovalId: string) {
104
+ return await this._getLinks(this.moduleName, this.entityName, customerDeviceOntRemovalId, 'WorkOrder');
105
+ }
106
+
107
+ public async linkWorkOrderCustomerDeviceOntRemovals(customerDeviceOntRemovalId: 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: 'WorkOrder_CustomerDeviceOntRemoval',
115
+ relationType: param?.relationType,
116
+ relatedAssociationId: param?.relatedAssociationId
117
+ });
118
+ }
119
+
120
+ return await this._createLinks(this.moduleName, this.entityName, customerDeviceOntRemovalId, associationDtos);
121
+ }
122
+
123
+ public async unlinkWorkOrderCustomerDeviceOntRemovals(customerDeviceOntRemovalId: string, linkedWorkOrderIds: string[]) {
124
+
125
+ const associationDtos = [];
126
+ for(const pk of linkedWorkOrderIds){
127
+ associationDtos.push({
128
+ primaryKey: customerDeviceOntRemovalId,
129
+ linkedRecordPrimaryKey: pk,
130
+ });
131
+ }
132
+
133
+ return await this._deleteLinks(this.moduleName, this.entityName, customerDeviceOntRemovalId, associationDtos);
134
+ }
135
+
136
+
102
137
  }