diff --git a/client/src/GraphQL/Calls/getOptions.js b/client/src/GraphQL/Calls/getOptions.js index f7bd3edf0..cb9dfa700 100644 --- a/client/src/GraphQL/Calls/getOptions.js +++ b/client/src/GraphQL/Calls/getOptions.js @@ -1,31 +1,45 @@ import gql from 'graphql-tag'; +import { formulaInfo, plotterInfo } from '../Fragments'; const EVENTS_FORMULAS = gql` query Events_Formulas{ events_Formulas { - id - ownerId - isTemplate - name + ...FormulaInfo } } + ${formulaInfo} `; const EVENTS_PLOTTERS = gql` query Events_Plotters{ events_Plotters { - id - ownerId - isTemplate - name - host - repo - moduleName + ...PlotterInfo } } + ${plotterInfo} +`; + +const EVENTS_CREATEFORMULA = gql` + mutation Events_CreateEvent($event:events_EventInput!) { + events_CreateEvent(event: $event) { + ...FormulaInfo + } + } + ${formulaInfo} +`; + +const EVENTS_CREATEPLOTTER = gql` + mutation Events_CreatePlotter($plotter:events_PlotterInput!) { + events_CreatePlotter(plotter: $plotter) { + ...PlotterInfo + } + } + ${plotterInfo} `; export default { EVENTS_PLOTTERS, EVENTS_FORMULAS, + EVENTS_CREATEFORMULA, + EVENTS_CREATEPLOTTER, }; diff --git a/client/src/GraphQL/Fragments/index.js b/client/src/GraphQL/Fragments/index.js index cb2ce691c..a28f9ce7c 100644 --- a/client/src/GraphQL/Fragments/index.js +++ b/client/src/GraphQL/Fragments/index.js @@ -2,8 +2,14 @@ import { eventMinimalInfo, eventFullInfo, } from './event'; +import { + formulaInfo, + plotterInfo, +} from './options'; export { eventMinimalInfo, eventFullInfo, + formulaInfo, + plotterInfo, }; diff --git a/client/src/GraphQL/Fragments/options.js b/client/src/GraphQL/Fragments/options.js new file mode 100644 index 000000000..c25a82d08 --- /dev/null +++ b/client/src/GraphQL/Fragments/options.js @@ -0,0 +1,22 @@ +import gql from 'graphql-tag'; + +export const plotterInfo = gql` + fragment PlotterInfo on events_Plotter { + id + ownerId + isTemplate + name + host + repo + moduleName + } +`; + +export const formulaInfo = gql` + fragment FormulaInfo on events_Formula { + id + ownerId + isTemplate + name + } +`;