Setting up the seven monolithics types for input types

This commit is contained in:
Unknown committed 2019-03-16 13:18:03 +01:00
1 parent f753b6f321
commit 93986e3d7d
3 files changed
+108 -24

No files matched your search

+16 -24
View File
@@ -1,37 +1,29 @@
import {
GraphQLString,
GraphQLInputObjectType,
GraphQLList,
} from 'graphql';
import InputSituationType from './Situation';
import InputPhaseType from './Phase';
import {
EntryPointInputType,
ExitPointInputType,
SellPointInputType,
BuyPointInputType,
StopLossInputType,
BuyOrderInputType,
SellOrderInputType,
} from './TheSevenMonolitics';
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) },
},
entryPoint: { type: EntryPointInputType },
exitPoint: { type: ExitPointInputType },
sellPoint: { type: SellPointInputType },
buyPoint: { type: BuyPointInputType },
stopLoss: { type: StopLossInputType },
buyOrder: { type: BuyOrderInputType },
sellOrder: { type: SellOrderInputType },
}),
});
@@ -0,0 +1,76 @@
import {
GraphQLInputObjectType,
GraphQLList,
} from 'graphql';
import InputSituationType from './Situation';
import InputPhaseType from './Phase';
// SituationBased
const EntryPointInputType = new GraphQLInputObjectType({
name: 'EntryPointInput',
description: 'Payload for entryPoint input',
fields: () => ({
situations: { type: new GraphQLList(InputSituationType) },
}),
});
const ExitPointInputType = new GraphQLInputObjectType({
name: 'ExitPointInput',
description: 'Payload for exitPoint input',
fields: () => ({
situations: { type: new GraphQLList(InputSituationType) },
}),
});
const SellPointInputType = new GraphQLInputObjectType({
name: 'SellPointInput',
description: 'Payload for sellPoint input',
fields: () => ({
situations: { type: new GraphQLList(InputSituationType) },
}),
});
const BuyPointInputType = new GraphQLInputObjectType({
name: 'BuyPointInput',
description: 'Payload for buyPoint input',
fields: () => ({
situations: { type: new GraphQLList(InputSituationType) },
}),
});
// PhaseBased
const StopLossInputType = new GraphQLInputObjectType({
name: 'StopLossTypeInput',
description: 'Payload for stopLossType input',
fields: () => ({
situations: { type: new GraphQLList(InputPhaseType) },
}),
});
const BuyOrderInputType = new GraphQLInputObjectType({
name: 'BuyOrderTypeInput',
description: 'Payload for buyOrderType input',
fields: () => ({
situations: { type: new GraphQLList(InputPhaseType) },
}),
});
const SellOrderInputType = new GraphQLInputObjectType({
name: 'SellOrderTypeInput',
description: 'Payload for sellOrderType input',
fields: () => ({
situations: { type: new GraphQLList(InputPhaseType) },
}),
});
export {
EntryPointInputType,
ExitPointInputType,
SellPointInputType,
BuyPointInputType,
StopLossInputType,
BuyOrderInputType,
SellOrderInputType,
};
+16
View File
@@ -3,6 +3,15 @@ import SubStrategyInputType from './SubStrategy';
import ConditionInputType from './Condition';
import SituationInputType from './Situation';
import PhaseInputType from './Phase';
import {
EntryPointInputType,
ExitPointInputType,
SellPointInputType,
BuyPointInputType,
StopLossInputType,
BuyOrderInputType,
SellOrderInputType,
} from './TheSevenMonolitics';
export {
StrategyInputType,
@@ -10,4 +19,11 @@ export {
ConditionInputType,
SituationInputType,
PhaseInputType,
EntryPointInputType,
ExitPointInputType,
SellPointInputType,
BuyPointInputType,
StopLossInputType,
BuyOrderInputType,
SellOrderInputType,
};