refactor: improved teams migrations

This commit is contained in:
Andrew Bastin
2021-08-25 08:41:09 +05:30
parent 6e9f16d8f1
commit 31258b1108
2 changed files with 8 additions and 3 deletions

View File

@@ -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)),
}
})

View File

@@ -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
}