Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

refactor: improved teams migrations

Andrew Bastin31258b11089b
diff --git a/helpers/teams/TeamCollectionAdapter.ts b/helpers/teams/TeamCollectionAdapter.ts
index d0c7d262a..73c01a72e 100644
--- a/helpers/teams/TeamCollectionAdapter.ts
+++ b/helpers/teams/TeamCollectionAdapter.ts
@@ -2,6 +2,7 @@ import { BehaviorSubject } from "rxjs"
import { gql } from "graphql-tag"
import pull from "lodash/pull"
import remove from "lodash/remove"
+import { translateToNewRequest } from "../types/HoppRESTRequest"
import { TeamCollection } from "./TeamCollection"
import { TeamRequest } from "./TeamRequest"
import {
@@ -466,7 +467,9 @@ export default class TeamCollectionAdapter {
this.addRequest({
id: data.teamRequestAdded.id,
collectionID: data.teamRequestAdded.collectionID,
- request: JSON.parse(data.teamRequestAdded.request),
+ request: translateToNewRequest(
+ JSON.parse(data.teamRequestAdded.request)
+ ),
title: data.teamRequestAdded.title,
})
})
@@ -548,7 +551,7 @@ export default class TeamCollectionAdapter {
id: el.id,
collectionID,
title: el.title,
- request: JSON.parse(el.request),
+ request: translateToNewRequest(JSON.parse(el.request)),
}
})
diff --git a/helpers/teams/TeamRequest.ts b/helpers/teams/TeamRequest.ts
index ccc04b235..24e235cff 100644
--- a/helpers/teams/TeamRequest.ts
+++ b/helpers/teams/TeamRequest.ts
@@ -1,3 +1,5 @@
+import { HoppRESTRequest } from "../types/HoppRESTRequest"
+
/**
* Defines how a Teams request is represented in TeamCollectionAdapter
*/
@@ -5,5 +7,5 @@ export interface TeamRequest {
id: string
collectionID: string
title: string
- request: any
+ request: HoppRESTRequest
}