summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/work_items/graphql/resolvers.js
blob: fb74e27f840cd3e48f8479c69bae96eac0540fee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import workItemQuery from './work_item.query.graphql';

export const resolvers = {
  Mutation: {
    localUpdateWorkItem(_, { input }, { cache }) {
      const workItem = {
        __typename: 'LocalWorkItem',
        type: 'FEATURE',
        id: input.id,
        title: input.title,
        widgets: {
          __typename: 'LocalWorkItemWidgetConnection',
          nodes: [],
        },
      };

      cache.writeQuery({
        query: workItemQuery,
        variables: { id: input.id },
        data: { localWorkItem: workItem },
      });

      return {
        __typename: 'LocalUpdateWorkItemPayload',
        workItem,
      };
    },
  },
};