diff --git a/src/schema/types/input/Formula.js b/src/schema/types/input/Condition.js similarity index 53% rename from src/schema/types/input/Formula.js rename to src/schema/types/input/Condition.js index bd9d070f1..a6271162a 100644 --- a/src/schema/types/input/Formula.js +++ b/src/schema/types/input/Condition.js @@ -1,14 +1,14 @@ import { - GraphQLNonNull, GraphQLString, GraphQLInputObjectType, } from 'graphql'; const Type = new GraphQLInputObjectType({ - name: 'FormulaInput', - description: 'Payload for formula input', + name: 'ConditionInput', + description: 'Payload for condition input', fields: () => ({ - name: { type: new GraphQLNonNull(GraphQLString) }, + name: { type: GraphQLString }, + code: { type: GraphQLString }, }), }); diff --git a/src/schema/types/input/Phase.js b/src/schema/types/input/Phase.js new file mode 100644 index 000000000..23784e921 --- /dev/null +++ b/src/schema/types/input/Phase.js @@ -0,0 +1,18 @@ +import { + GraphQLString, + GraphQLInputObjectType, + GraphQLList, +} from 'graphql'; +import InputSituationType from './Situation'; + +const Type = new GraphQLInputObjectType({ + name: 'PhaseInput', + description: 'Payload for phase input', + fields: () => ({ + name: { type: GraphQLString }, + code: { type: GraphQLString }, + situations: { type: new GraphQLList(InputSituationType) }, + }), +}); + +export default Type; diff --git a/src/schema/types/input/Plotter.js b/src/schema/types/input/Plotter.js deleted file mode 100644 index f66d30644..000000000 --- a/src/schema/types/input/Plotter.js +++ /dev/null @@ -1,15 +0,0 @@ -import { - GraphQLNonNull, - GraphQLString, - GraphQLInputObjectType, -} from 'graphql'; - -const Type = new GraphQLInputObjectType({ - name: 'PlotterInput', - description: 'Payload for plotter input', - fields: () => ({ - name: { type: new GraphQLNonNull(GraphQLString) }, - }), -}); - -export default Type; diff --git a/src/schema/types/input/Prize.js b/src/schema/types/input/Prize.js deleted file mode 100644 index 52eb81612..000000000 --- a/src/schema/types/input/Prize.js +++ /dev/null @@ -1,21 +0,0 @@ -import { - GraphQLInputObjectType, - GraphQLList, - GraphQLInt, - GraphQLNonNull, -} from 'graphql'; -import InputSubPrizeType from './SubPrize'; - -const Type = new GraphQLInputObjectType({ - name: 'PrizeInput', - description: 'Payload for formula input', - fields: () => ({ - rank: { type: new GraphQLNonNull(GraphQLInt) }, - amount: { type: new GraphQLNonNull(GraphQLInt) }, - subPrize: { - type: new GraphQLList(InputSubPrizeType), - }, - }), -}); - -export default Type; diff --git a/src/schema/types/input/Situation.js b/src/schema/types/input/Situation.js new file mode 100644 index 000000000..f06205ba2 --- /dev/null +++ b/src/schema/types/input/Situation.js @@ -0,0 +1,17 @@ +import { + GraphQLString, + GraphQLInputObjectType, + GraphQLList, +} from 'graphql'; +import InputConditionType from './Condition'; + +const Type = new GraphQLInputObjectType({ + name: 'SituationInput', + description: 'Payload for situation input', + fields: () => ({ + name: { type: GraphQLString }, + conditions: { type: new GraphQLList(InputConditionType) }, + }), +}); + +export default Type; diff --git a/src/schema/types/input/Event.js b/src/schema/types/input/Strategy.js similarity index 50% rename from src/schema/types/input/Event.js rename to src/schema/types/input/Strategy.js index f7e67c72b..319591d97 100644 --- a/src/schema/types/input/Event.js +++ b/src/schema/types/input/Strategy.js @@ -1,18 +1,14 @@ import { - GraphQLString, GraphQLInputObjectType, GraphQLList, } from 'graphql'; -import InputPrizeType from './Prize'; +import SubStrategyType from './SubStrategy'; const Type = new GraphQLInputObjectType({ name: 'EventInput', description: 'Payload for event input', fields: () => ({ - name: { type: GraphQLString }, - formulaId: { type: GraphQLString }, - plotterId: { type: GraphQLString }, - prizes: { type: new GraphQLList(InputPrizeType) }, + subStrategies: { type: new GraphQLList(SubStrategyType) }, }), }); diff --git a/src/schema/types/input/SubPrize.js b/src/schema/types/input/SubPrize.js deleted file mode 100644 index c3c4e7f29..000000000 --- a/src/schema/types/input/SubPrize.js +++ /dev/null @@ -1,14 +0,0 @@ -import { - GraphQLInputObjectType, - GraphQLString, -} from 'graphql'; - -const Type = new GraphQLInputObjectType({ - name: 'SubPrizeInput', - description: 'Payload prize input', - fields: () => ({ - condition: { type: GraphQLString }, - }), -}); - -export default Type; diff --git a/src/schema/types/input/SubStrategy.js b/src/schema/types/input/SubStrategy.js new file mode 100644 index 000000000..80269ea42 --- /dev/null +++ b/src/schema/types/input/SubStrategy.js @@ -0,0 +1,38 @@ +import { + GraphQLString, + GraphQLInputObjectType, + GraphQLList, +} from 'graphql'; +import InputSituationType from './Situation'; +import InputPhaseType from './Phase'; + +const Type = new GraphQLInputObjectType({ + name: 'SubStrategyInput', + description: 'Payload for subStrategy input', + fields: () => ({ + name: { type: GraphQLString }, + entryPoint: { + situations: { type: new GraphQLList(InputSituationType) }, + }, + exitPoint: { + situations: { type: new GraphQLList(InputSituationType) }, + }, + sellPoint: { + situations: { type: new GraphQLList(InputSituationType) }, + }, + buyPoint: { + situations: { type: new GraphQLList(InputSituationType) }, + }, + stopLoss: { + phases: { type: new GraphQLList(InputPhaseType) }, + }, + buyOrder: { + phases: { type: new GraphQLList(InputPhaseType) }, + }, + sellOrder: { + phases: { type: new GraphQLList(InputPhaseType) }, + }, + }), +}); + +export default Type; diff --git a/src/schema/types/input/index.js b/src/schema/types/input/index.js index b929934d2..c00687bd6 100644 --- a/src/schema/types/input/index.js +++ b/src/schema/types/input/index.js @@ -1,13 +1,13 @@ -import PlotterInputType from './Plotter'; -import PrizeInputType from './Prize'; -import FormulaInputType from './Formula'; -import EventInputType from './Event'; -import SubPrizeInputType from './SubPrize'; +import StrategyInputType from './Strategy'; +import SubStrategyInputType from './SubStrategy'; +import ConditionInputType from './Condition'; +import SituationInputType from './Situation'; +import PhaseInputType from './Phase'; export { - PlotterInputType, - PrizeInputType, - FormulaInputType, - EventInputType, - SubPrizeInputType, + StrategyInputType, + SubStrategyInputType, + ConditionInputType, + SituationInputType, + PhaseInputType, };