diff --git a/server/src/schema/types/AdditionalPrize.js b/server/src/schema/types/AdditionalPrize.js index ee3a791ff..1c888b687 100644 --- a/server/src/schema/types/AdditionalPrize.js +++ b/server/src/schema/types/AdditionalPrize.js @@ -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) }, }), }); diff --git a/server/src/schema/types/Event.js b/server/src/schema/types/Event.js index 7917e3032..ec0bf6c2b 100644 --- a/server/src/schema/types/Event.js +++ b/server/src/schema/types/Event.js @@ -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 }, diff --git a/server/src/schema/types/Formula.js b/server/src/schema/types/Formula.js index f5d312327..934cbcd60 100644 --- a/server/src/schema/types/Formula.js +++ b/server/src/schema/types/Formula.js @@ -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 }, diff --git a/server/src/schema/types/Participant.js b/server/src/schema/types/Participant.js index f3afb7745..28c2833df 100644 --- a/server/src/schema/types/Participant.js +++ b/server/src/schema/types/Participant.js @@ -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 }, diff --git a/server/src/schema/types/Plotter.js b/server/src/schema/types/Plotter.js index 9e86390a5..798d197af 100644 --- a/server/src/schema/types/Plotter.js +++ b/server/src/schema/types/Plotter.js @@ -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 }, diff --git a/server/src/schema/types/Prize.js b/server/src/schema/types/Prize.js index 4b2fc8aba..7a81a702a 100644 --- a/server/src/schema/types/Prize.js +++ b/server/src/schema/types/Prize.js @@ -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) { diff --git a/server/src/schema/types/Rule.js b/server/src/schema/types/Rule.js index e39a877fc..46358242d 100644 --- a/server/src/schema/types/Rule.js +++ b/server/src/schema/types/Rule.js @@ -6,6 +6,7 @@ import { const RuleType = new GraphQLObjectType({ name: 'Rule', + description: 'Textual rules of an event', fields: () => ({ position: { type: GraphQLInt }, title: { type: GraphQLString }, diff --git a/server/src/schema/types/input/AdditionalPrize.js b/server/src/schema/types/input/AdditionalPrize.js new file mode 100644 index 000000000..0fe28c2f0 --- /dev/null +++ b/server/src/schema/types/input/AdditionalPrize.js @@ -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; diff --git a/server/src/schema/types/input/Event.js b/server/src/schema/types/input/Event.js new file mode 100644 index 000000000..54c8e0865 --- /dev/null +++ b/server/src/schema/types/input/Event.js @@ -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; diff --git a/server/src/schema/types/input/Formula.js b/server/src/schema/types/input/Formula.js new file mode 100644 index 000000000..bd9d070f1 --- /dev/null +++ b/server/src/schema/types/input/Formula.js @@ -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; diff --git a/server/src/schema/types/input/Participant.js b/server/src/schema/types/input/Participant.js new file mode 100644 index 000000000..c3853df83 --- /dev/null +++ b/server/src/schema/types/input/Participant.js @@ -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; diff --git a/server/src/schema/types/input/Plotter.js b/server/src/schema/types/input/Plotter.js new file mode 100644 index 000000000..1368aecf9 --- /dev/null +++ b/server/src/schema/types/input/Plotter.js @@ -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; diff --git a/server/src/schema/types/input/Prize.js b/server/src/schema/types/input/Prize.js new file mode 100644 index 000000000..5be06f0f2 --- /dev/null +++ b/server/src/schema/types/input/Prize.js @@ -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; diff --git a/server/src/schema/types/input/Rule.js b/server/src/schema/types/input/Rule.js new file mode 100644 index 000000000..220b99412 --- /dev/null +++ b/server/src/schema/types/input/Rule.js @@ -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; diff --git a/server/src/schema/types/input/index.js b/server/src/schema/types/input/index.js new file mode 100644 index 000000000..5bab6702a --- /dev/null +++ b/server/src/schema/types/input/index.js @@ -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, +};