New types in order to dry up the code
This commit is contained in:
1 parent
895eb3c475
commit
f4cf5884f5
15 files changed
+167
-5
No files matched your search
@@ -1,15 +1,17 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLNonNull,
|
||||
GraphQLString,
|
||||
GraphQLInt,
|
||||
} from 'graphql';
|
||||
|
||||
const AdditionalPrizeType = new GraphQLObjectType({
|
||||
name: 'OtherPrize',
|
||||
name: 'AdditionalPrize',
|
||||
description: 'Non algo complementary prize',
|
||||
fields: () => ({
|
||||
condition: { type: GraphQLString },
|
||||
amount: { type: GraphQLInt },
|
||||
asset: { type: GraphQLString },
|
||||
amount: { type: new GraphQLNonNull(GraphQLInt) },
|
||||
asset: { type: new GraphQLNonNull(GraphQLString) },
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
|
||||
const EventType = new GraphQLObjectType({
|
||||
name: 'Event',
|
||||
description: 'Everything you need to know about an event',
|
||||
fields: () => ({
|
||||
designator: { type: GraphQLID },
|
||||
name: { type: GraphQLString },
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
|
||||
const FormulaType = new GraphQLObjectType({
|
||||
name: 'Formula',
|
||||
description: 'For now it\'s simplay a named field',
|
||||
fields: () => ({
|
||||
id: { type: GraphQLString },
|
||||
ownerId: { type: GraphQLString },
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
|
||||
const ParticipantType = new GraphQLObjectType({
|
||||
name: 'Participant',
|
||||
description: 'Informations about the participant of an event',
|
||||
fields: () => ({
|
||||
teamId: { type: GraphQLString },
|
||||
botId: { type: GraphQLString },
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
|
||||
const PlotterType = new GraphQLObjectType({
|
||||
name: 'Plotter',
|
||||
description: 'Will soon change in order to use contained plotter objects',
|
||||
fields: () => ({
|
||||
id: { type: GraphQLString },
|
||||
ownerId: { type: GraphQLString },
|
||||
|
||||
@@ -2,14 +2,16 @@ import {
|
||||
GraphQLObjectType,
|
||||
GraphQLList,
|
||||
GraphQLInt,
|
||||
GraphQLNonNull,
|
||||
} from 'graphql';
|
||||
import { AdditionalPrizeType } from './index';
|
||||
|
||||
const PrizeType = new GraphQLObjectType({
|
||||
name: 'Prize',
|
||||
description: 'Prize, by default in algos',
|
||||
fields: () => ({
|
||||
rank: { type: GraphQLInt },
|
||||
amount: { type: GraphQLInt },
|
||||
rank: { type: new GraphQLNonNull(GraphQLInt) },
|
||||
amount: { type: new GraphQLNonNull(GraphQLInt) },
|
||||
additional: {
|
||||
type: new GraphQLList(AdditionalPrizeType),
|
||||
resolve(parent) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
|
||||
const RuleType = new GraphQLObjectType({
|
||||
name: 'Rule',
|
||||
description: 'Textual rules of an event',
|
||||
fields: () => ({
|
||||
position: { type: GraphQLInt },
|
||||
title: { type: GraphQLString },
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import {
|
||||
GraphQLInputObjectType,
|
||||
GraphQLNonNull,
|
||||
GraphQLString,
|
||||
GraphQLInt,
|
||||
} from 'graphql';
|
||||
|
||||
const Type = new GraphQLInputObjectType({
|
||||
name: 'AdditionalPrizeInput',
|
||||
description: 'Payload for formula input',
|
||||
fields: () => ({
|
||||
condition: { type: GraphQLString },
|
||||
amount: { type: new GraphQLNonNull(GraphQLInt) },
|
||||
asset: { type: new GraphQLNonNull(GraphQLString) },
|
||||
}),
|
||||
});
|
||||
|
||||
export default Type;
|
||||
@@ -0,0 +1,29 @@
|
||||
import {
|
||||
GraphQLString,
|
||||
GraphQLInt,
|
||||
GraphQLInputObjectType,
|
||||
GraphQLList,
|
||||
} from 'graphql';
|
||||
import InputFormulaType from './Formula';
|
||||
import InputPlotterType from './Plotter';
|
||||
import InputPrizeType from './Prize';
|
||||
import InputParticipantType from './Participant';
|
||||
|
||||
const Type = new GraphQLInputObjectType({
|
||||
name: 'EventInput',
|
||||
description: 'Payload for event input',
|
||||
fields: () => ({
|
||||
name: { type: GraphQLString },
|
||||
description: { type: GraphQLString },
|
||||
startDatetime: { type: GraphQLInt },
|
||||
finishDatetime: { type: GraphQLInt },
|
||||
formulaId: { type: GraphQLString },
|
||||
formula: { type: InputFormulaType },
|
||||
plotterId: { type: GraphQLString },
|
||||
plotter: { type: InputPlotterType },
|
||||
prizes: { type: new GraphQLList(InputPrizeType) },
|
||||
participants: { type: new GraphQLList(InputParticipantType) },
|
||||
}),
|
||||
});
|
||||
|
||||
export default Type;
|
||||
@@ -0,0 +1,15 @@
|
||||
import {
|
||||
GraphQLNonNull,
|
||||
GraphQLString,
|
||||
GraphQLInputObjectType,
|
||||
} from 'graphql';
|
||||
|
||||
const Type = new GraphQLInputObjectType({
|
||||
name: 'FormulaInput',
|
||||
description: 'Payload for formula input',
|
||||
fields: () => ({
|
||||
name: { type: new GraphQLNonNull(GraphQLString) },
|
||||
}),
|
||||
});
|
||||
|
||||
export default Type;
|
||||
@@ -0,0 +1,17 @@
|
||||
import {
|
||||
GraphQLInputObjectType,
|
||||
GraphQLString,
|
||||
GraphQLNonNull,
|
||||
} from 'graphql';
|
||||
|
||||
const Type = new GraphQLInputObjectType({
|
||||
name: 'ParticipantInput',
|
||||
description: 'Payload for formula input',
|
||||
fields: () => ({
|
||||
teamId: { type: new GraphQLNonNull(GraphQLString) },
|
||||
botId: { type: GraphQLString },
|
||||
releaseId: { type: GraphQLString },
|
||||
}),
|
||||
});
|
||||
|
||||
export default Type;
|
||||
@@ -0,0 +1,18 @@
|
||||
import {
|
||||
GraphQLNonNull,
|
||||
GraphQLString,
|
||||
GraphQLInputObjectType,
|
||||
} from 'graphql';
|
||||
|
||||
const Type = new GraphQLInputObjectType({
|
||||
name: 'PlotterInput',
|
||||
description: 'Payload for plotter input',
|
||||
fields: () => ({
|
||||
name: { type: new GraphQLNonNull(GraphQLString) },
|
||||
host: { type: GraphQLString },
|
||||
repo: { type: GraphQLString },
|
||||
moduleName: { type: GraphQLString },
|
||||
}),
|
||||
});
|
||||
|
||||
export default Type;
|
||||
@@ -0,0 +1,21 @@
|
||||
import {
|
||||
GraphQLInputObjectType,
|
||||
GraphQLList,
|
||||
GraphQLInt,
|
||||
GraphQLNonNull,
|
||||
} from 'graphql';
|
||||
import InputAdditionalPrizeType from './AdditionalPrize';
|
||||
|
||||
const Type = new GraphQLInputObjectType({
|
||||
name: 'PrizeInput',
|
||||
description: 'Payload for formula input',
|
||||
fields: () => ({
|
||||
rank: { type: new GraphQLNonNull(GraphQLInt) },
|
||||
amount: { type: new GraphQLNonNull(GraphQLInt) },
|
||||
additional: {
|
||||
type: new GraphQLList(InputAdditionalPrizeType),
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
export default Type;
|
||||
@@ -0,0 +1,18 @@
|
||||
import {
|
||||
GraphQLNonNull,
|
||||
GraphQLString,
|
||||
GraphQLInt,
|
||||
GraphQLInputObjectType,
|
||||
} from 'graphql';
|
||||
|
||||
const Type = new GraphQLInputObjectType({
|
||||
name: 'RuleInput',
|
||||
description: 'Payload for rule input',
|
||||
fields: () => ({
|
||||
position: { type: GraphQLInt },
|
||||
title: { type: new GraphQLNonNull(GraphQLString) },
|
||||
description: { type: GraphQLString },
|
||||
}),
|
||||
});
|
||||
|
||||
export default Type;
|
||||
@@ -0,0 +1,17 @@
|
||||
import PlotterInputType from './Plotter';
|
||||
import RuleInputType from './Rule';
|
||||
import PrizeInputType from './Prize';
|
||||
import FormulaInputType from './Formula';
|
||||
import EventInputType from './Event';
|
||||
import AdditionalPrizeInputType from './AdditionalPrize';
|
||||
import ParticipantInputType from './Participant';
|
||||
|
||||
export {
|
||||
PlotterInputType,
|
||||
RuleInputType,
|
||||
PrizeInputType,
|
||||
FormulaInputType,
|
||||
EventInputType,
|
||||
AdditionalPrizeInputType,
|
||||
ParticipantInputType,
|
||||
};
|
||||
Reference in new issue
Block a user