From fc24958d9bec347be122003ae4730328ce7f6d4c Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Sat, 29 Jan 2022 21:15:57 +0100 Subject: [PATCH] Update cache properties --- .../frontend/read-only/project.spec.js | 1 + client/src/graphql/cache.js | 17 ----------------- client/src/graphql/gql/queries/projectQuery.gql | 4 ++-- client/src/pages/portfolio/project.vue | 4 ++-- client/src/router/portfolio.routes.js | 2 +- 5 files changed, 6 insertions(+), 22 deletions(-) diff --git a/client/cypress/integration/frontend/read-only/project.spec.js b/client/cypress/integration/frontend/read-only/project.spec.js index 5066633c..eaca9a57 100644 --- a/client/cypress/integration/frontend/read-only/project.spec.js +++ b/client/cypress/integration/frontend/read-only/project.spec.js @@ -5,6 +5,7 @@ const getOperations = ({readOnly = false, classReadOnly = false}) => ({ ProjectQuery: { project: { id: 'projectId', + slug: 'project-name', final: false, student: { id: btoa('PrivateUserNode:1'), diff --git a/client/src/graphql/cache.js b/client/src/graphql/cache.js index 2a358995..787e7f22 100644 --- a/client/src/graphql/cache.js +++ b/client/src/graphql/cache.js @@ -69,23 +69,6 @@ const typePolicies = { objective: {read: idToRefFactory('ObjectiveNode')}, objectiveGroup: {read: idToRefFactory('ObjectiveGroupNode')}, projectEntry: {read: idToRefFactory('ProjectEntryNode')}, - // project: {read: idToRefFactory('ProjectNode')}, - project: { - read(_, {args: {slug, id}, toReference}) { - console.log(`Trying to reference project with slug ${slug}, id ${id}`); - if (slug) { - return toReference({ - __typename: 'ProjectNode', - id: slug - }); - } else { - return toReference({ - __typename: 'ProjectNode', - id - }); - } - } - }, } }, }; diff --git a/client/src/graphql/gql/queries/projectQuery.gql b/client/src/graphql/gql/queries/projectQuery.gql index 8376172a..3a18036a 100644 --- a/client/src/graphql/gql/queries/projectQuery.gql +++ b/client/src/graphql/gql/queries/projectQuery.gql @@ -1,7 +1,7 @@ #import "../fragments/projectParts.gql" #import "../fragments/projectEntryParts.gql" -query ProjectQuery($id: ID, $slug: String){ - project(slug: $slug, id: $id) { +query ProjectQuery($slug: String){ + project(slug: $slug) { ...ProjectParts entries { ...ProjectEntryParts diff --git a/client/src/pages/portfolio/project.vue b/client/src/pages/portfolio/project.vue index cf2438d4..f883fdfd 100644 --- a/client/src/pages/portfolio/project.vue +++ b/client/src/pages/portfolio/project.vue @@ -43,7 +43,7 @@