@getjones/test-infra 2.11.9 → 2.11.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getjones/test-infra",
3
- "version": "2.11.9",
3
+ "version": "2.11.10",
4
4
  "description": "Providing internal and openapi interface",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -49,8 +49,8 @@ const deleteByContractorId = (contractorId, context) => {
49
49
  return requests.deleteRequestHandler(Endpoints.delete(contractorId), context);
50
50
  };
51
51
 
52
- const archiveByContractorId = (contractorId, context) => {
53
- return requests.deleteRequestHandler(Endpoints.archive(contractorId), context);
52
+ const archiveRecord = (recordVerificationModel, context) => {
53
+ return requests.deleteRequestHandler(Endpoints.archive(recordVerificationModel.contractorId), context, {}, {}, recordVerificationModel);
54
54
  };
55
55
 
56
56
  const restoreRecord = (recordVerificationModel, context) => {
@@ -146,7 +146,7 @@ module.exports = {
146
146
  getContractorById,
147
147
  getRecordHistory,
148
148
  deleteByContractorId,
149
- archiveByContractorId,
149
+ archiveRecord,
150
150
  restoreRecord,
151
151
  editContractor,
152
152
  updateInviteDate,
@@ -28,8 +28,9 @@ const getRecordHistory = (contractorId, context) => {
28
28
  return contractorsAPI.getRecordHistory(contractorId, context);
29
29
  };
30
30
 
31
- const archiveByContractorId = (contractorId, context) => {
32
- return contractorsAPI.archiveByContractorId(contractorId, context);
31
+ const archiveRecord = (recordVerificationModel, context) => {
32
+ validateType(recordVerificationModel, RecordModifyDateVerificationModel);
33
+ return contractorsAPI.archiveRecord(recordVerificationModel, context);
33
34
  };
34
35
 
35
36
  const restoreRecord = (recordVerificationModel, context) => {
@@ -162,6 +163,17 @@ const restoreByRecordId = async (recordId, context) => {
162
163
  return restoreResponse;
163
164
  };
164
165
 
166
+ const archiveByRecordId = async (recordId, context) => {
167
+ const recordModifyModel = await getRecordVerificationModel(recordId, context);
168
+ const archiveResponse = await archiveRecord(recordModifyModel, context);
169
+
170
+ if (archiveResponse.status !== httpResponseStatusCodes.OK) {
171
+ throw new Error(`Failed to archive record "${recordId}"\n${archiveResponse.statusText}`);
172
+ }
173
+
174
+ return archiveResponse;
175
+ };
176
+
165
177
  const getInviteLinkStatus = (encryptedData, context) => {
166
178
  return contractorsAPI.getInviteLinkStatus(encryptedData, context);
167
179
  };
@@ -172,7 +184,7 @@ module.exports = {
172
184
  getContractorsByAccountId,
173
185
  getContractorById,
174
186
  getRecordHistory,
175
- archiveByContractorId,
187
+ archiveRecord,
176
188
  restoreRecord,
177
189
  editContractor,
178
190
  updateInviteDate,
@@ -192,6 +204,7 @@ module.exports = {
192
204
  assignRequirement,
193
205
  getAssignRequirementModel,
194
206
  getLinkedProjectsCount,
207
+ archiveByRecordId,
195
208
  restoreByRecordId,
196
209
  updateLastInviteActionDate,
197
210
  getInviteLinkStatus