Setting up the seven monolithics types for output types

This commit is contained in:
Unknown committed 2019-03-16 13:07:35 +01:00
1 parent 4166ed883c
commit 8f0c6e2e37
3 files changed
+157 -37

No files matched your search

+28 -37
View File
@@ -4,8 +4,13 @@ import {
GraphQLList,
} from 'graphql';
import {
SituationType,
PhaseType,
EntryPointType,
ExitPointType,
SellPointType,
BuyPointType,
StopLossType,
BuyOrderType,
SellOrderType,
} from './index';
const Type = new GraphQLObjectType({
@@ -14,59 +19,45 @@ const Type = new GraphQLObjectType({
fields: () => ({
name: { type: GraphQLString },
entryPoint: {
situations: {
type: new GraphQLList(SituationType),
resolve(parent) {
return parent.situations;
},
type: new GraphQLList(EntryPointType),
resolve(parent) {
return parent.entryPoint;
},
},
exitPoint: {
situations: {
type: new GraphQLList(SituationType),
resolve(parent) {
return parent.situations;
},
type: new GraphQLList(ExitPointType),
resolve(parent) {
return parent.exitPoint;
},
},
sellPoint: {
situations: {
type: new GraphQLList(SituationType),
resolve(parent) {
return parent.situations;
},
type: new GraphQLList(SellPointType),
resolve(parent) {
return parent.sellPoint;
},
},
buyPoint: {
situations: {
type: new GraphQLList(SituationType),
resolve(parent) {
return parent.situations;
},
type: new GraphQLList(BuyPointType),
resolve(parent) {
return parent.buyPoint;
},
},
stopLoss: {
phases: {
type: new GraphQLList(PhaseType),
resolve(parent) {
return parent.phases;
},
type: new GraphQLList(StopLossType),
resolve(parent) {
return parent.stopLoss;
},
},
buyOrder: {
phases: {
type: new GraphQLList(PhaseType),
resolve(parent) {
return parent.phases;
},
type: new GraphQLList(BuyOrderType),
resolve(parent) {
return parent.buyOrder;
},
},
sellOrder: {
phases: {
type: new GraphQLList(PhaseType),
resolve(parent) {
return parent.phases;
},
type: new GraphQLList(SellOrderType),
resolve(parent) {
return parent.sellOrder;
},
},
}),
+113
View File
@@ -0,0 +1,113 @@
import {
GraphQLObjectType,
GraphQLList,
} from 'graphql';
import {
SituationType,
PhaseType,
} from './index';
// ConditionBased
const EntryPointType = new GraphQLObjectType({
name: 'EntryPoint',
description: 'EntryPoint definition',
fields: () => ({
situations: {
type: new GraphQLList(SituationType),
resolve(parent) {
return parent.situations;
},
},
}),
});
const ExitPointType = new GraphQLObjectType({
name: 'ExitPoint',
description: 'ExitPoint definition',
fields: () => ({
situations: {
type: new GraphQLList(SituationType),
resolve(parent) {
return parent.situations;
},
},
}),
});
const SellPointType = new GraphQLObjectType({
name: 'SellPoint',
description: 'SellPoint definition',
fields: () => ({
situations: {
type: new GraphQLList(SituationType),
resolve(parent) {
return parent.situations;
},
},
}),
});
const BuyPointType = new GraphQLObjectType({
name: 'BuyPoint',
description: 'BuyPoint definition',
fields: () => ({
situations: {
type: new GraphQLList(SituationType),
resolve(parent) {
return parent.situations;
},
},
}),
});
// PhaseBased
const StopLossType = new GraphQLObjectType({
name: 'StopLoss',
description: 'StopLoss definition',
fields: () => ({
phases: {
type: new GraphQLList(PhaseType),
resolve(parent) {
return parent.phases;
},
},
}),
});
const BuyOrderType = new GraphQLObjectType({
name: 'BuyOrder',
description: 'BuyOrder definition',
fields: () => ({
phases: {
type: new GraphQLList(PhaseType),
resolve(parent) {
return parent.phases;
},
},
}),
});
const SellOrderType = new GraphQLObjectType({
name: 'SellOrder',
description: 'SellOrder definition',
fields: () => ({
phases: {
type: new GraphQLList(PhaseType),
resolve(parent) {
return parent.phases;
},
},
}),
});
export {
EntryPointType,
ExitPointType,
SellPointType,
BuyPointType,
StopLossType,
BuyOrderType,
SellOrderType,
};
+16
View File
@@ -3,6 +3,15 @@ import SubStrategyType from './SubStrategy';
import ConditionType from './Condition';
import SituationType from './Situation';
import PhaseType from './Phase';
import {
EntryPointType,
ExitPointType,
SellPointType,
BuyPointType,
StopLossType,
BuyOrderType,
SellOrderType,
} from './TheSevenMonolitics';
export {
StrategyType,
@@ -10,4 +19,11 @@ export {
ConditionType,
SituationType,
PhaseType,
EntryPointType,
ExitPointType,
SellPointType,
BuyPointType,
StopLossType,
BuyOrderType,
SellOrderType,
};