From 31258b11089b5431e52446afcb265a534d89db3c Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Wed, 25 Aug 2021 08:41:09 +0530 Subject: [PATCH] refactor: improved teams migrations --- helpers/teams/TeamCollectionAdapter.ts | 7 +++++-- helpers/teams/TeamRequest.ts | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) 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 }