Progress pre master app
This commit is contained in:
1 parent
8ef729b77f
commit
7f5b093de0
17 files changed
+464
-26
No files matched your search
+200
-4
@@ -6,7 +6,7 @@ const ecosystemSchema = new Schema({
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
teams: [{
|
||||
devTeams: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
@@ -15,7 +15,7 @@ const ecosystemSchema = new Schema({
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
host:{
|
||||
host: {
|
||||
url: {
|
||||
type: String,
|
||||
required: true
|
||||
@@ -42,6 +42,10 @@ const ecosystemSchema = new Schema({
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
repo: {
|
||||
type: String,
|
||||
required: false
|
||||
@@ -49,9 +53,115 @@ const ecosystemSchema = new Schema({
|
||||
configFile: {
|
||||
type: String,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
products: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
displayName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
dataSets: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
validPeriods: [{
|
||||
type: String,
|
||||
required: true
|
||||
}],
|
||||
filePath: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
fileName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
dataRange: {
|
||||
filePath: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
fileName: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
},
|
||||
}],
|
||||
exchangeList: [{
|
||||
name: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
}],
|
||||
plotter: {
|
||||
codeName: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
devTeam: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
moduleName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
}
|
||||
}]
|
||||
}],
|
||||
plotters: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
displayName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
modules: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
moduleName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
profilePicture: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
panels: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
moduleName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
event: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
}],
|
||||
}],
|
||||
repo: {
|
||||
type: String,
|
||||
required: true
|
||||
@@ -71,7 +181,7 @@ const ecosystemSchema = new Schema({
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
host:{
|
||||
host: {
|
||||
url: {
|
||||
type: String,
|
||||
required: true
|
||||
@@ -90,6 +200,52 @@ const ecosystemSchema = new Schema({
|
||||
}
|
||||
},
|
||||
competitions: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
displayName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
startDatetime: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
finishDatetime: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
formula: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
plotter: {
|
||||
codeName: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
host: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
repo: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
moduleName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
},
|
||||
participants: [{
|
||||
type: String,
|
||||
required: false
|
||||
}],
|
||||
repo: {
|
||||
type: String,
|
||||
required: true
|
||||
@@ -100,6 +256,46 @@ const ecosystemSchema = new Schema({
|
||||
}
|
||||
}],
|
||||
plotters: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
displayName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
modules: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
moduleName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
profilePicture: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
panels: [{
|
||||
codeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
moduleName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
event: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
}],
|
||||
}],
|
||||
repo: {
|
||||
type: String,
|
||||
required: true
|
||||
|
||||
@@ -27,8 +27,8 @@ const resolve = async (parent, { team }, context) => {
|
||||
userEcosystem.authId = context.userId
|
||||
}
|
||||
|
||||
for (let i = 0; i < userEcosystem.teams.length; i++) {
|
||||
const auxTeam = userEcosystem.teams[i];
|
||||
for (let i = 0; i < userEcosystem.devTeams.length; i++) {
|
||||
const auxTeam = userEcosystem.devTeams[i];
|
||||
if (auxTeam.codeName === team.codeName) {
|
||||
throw new WrongArgumentsError("The team already exist on the user ecosystem.")
|
||||
}
|
||||
@@ -44,11 +44,26 @@ const resolve = async (parent, { team }, context) => {
|
||||
team.host = nodeEndpoint
|
||||
}
|
||||
|
||||
let bots= []
|
||||
bots.push(team.bot)
|
||||
let bots = []
|
||||
let tradingBot = {
|
||||
codeName: team.bot.codeName,
|
||||
displayName: team.bot.displayName,
|
||||
repo: team.bot.codeName + '-Trading-Bot',
|
||||
configFile: 'this.bot.config.json'
|
||||
}
|
||||
bots.push(tradingBot)
|
||||
|
||||
let simulatorBot = {
|
||||
codeName: 'simulator-' + team.bot.codeName,
|
||||
displayName: 'Simulator ' + team.bot.displayName,
|
||||
repo: 'simulator-' + team.bot.codeName + '-Indicator-Bot',
|
||||
configFile: 'this.bot.config.json'
|
||||
}
|
||||
bots.push(simulatorBot)
|
||||
|
||||
team.bots = bots
|
||||
|
||||
userEcosystem.teams.push(team)
|
||||
userEcosystem.devTeams.push(team)
|
||||
await userEcosystem.save()
|
||||
return team
|
||||
} catch (err) {
|
||||
|
||||
@@ -25,13 +25,13 @@ const resolve = async (parent, { team }, context) => {
|
||||
}
|
||||
|
||||
let teamFound = false
|
||||
for (let i = 0; i < userEcosystem.teams.length; i++) {
|
||||
const auxTeam = userEcosystem.teams[i]
|
||||
for (let i = 0; i < userEcosystem.devTeams.length; i++) {
|
||||
const auxTeam = userEcosystem.devTeams[i]
|
||||
if (auxTeam.codeName === team.codeName) {
|
||||
logger.debug('deleteTeam -> Team found, removing.')
|
||||
teamFound = true
|
||||
await deleteTeam(team)
|
||||
userEcosystem.teams.splice(i, 1)
|
||||
userEcosystem.devTeams.splice(i, 1)
|
||||
await userEcosystem.save()
|
||||
break
|
||||
}
|
||||
|
||||
+12
-2
@@ -1,15 +1,25 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString
|
||||
GraphQLString,
|
||||
GraphQLList
|
||||
} from 'graphql';
|
||||
|
||||
import { ProductType } from './index'
|
||||
|
||||
const BotType = new GraphQLObjectType({
|
||||
name: 'Bot',
|
||||
fields: () => ({
|
||||
codeName: { type: GraphQLString },
|
||||
displayName: { type: GraphQLString },
|
||||
type: { type: GraphQLString },
|
||||
repo: { type: GraphQLString },
|
||||
configFile: { type: GraphQLString }
|
||||
configFile: { type: GraphQLString },
|
||||
products: {
|
||||
type: new GraphQLList(ProductType),
|
||||
resolve(parent) {
|
||||
return parent.products;
|
||||
}
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString,
|
||||
GraphQLList
|
||||
} from 'graphql';
|
||||
|
||||
import { PlotterReferenceType } from './index';
|
||||
|
||||
const CompetitionType = new GraphQLObjectType({
|
||||
name: 'Competition',
|
||||
fields: () => ({
|
||||
codeName: { type: GraphQLString },
|
||||
displayName: { type: GraphQLString },
|
||||
description: { type: GraphQLString },
|
||||
startDatetime: { type: GraphQLString },
|
||||
finishDatetime: { type: GraphQLString },
|
||||
formula: { type: GraphQLString },
|
||||
plotter: {
|
||||
type: PlotterReferenceType,
|
||||
resolve(parent) {
|
||||
return parent.plotter;
|
||||
}
|
||||
},
|
||||
rules:{ type: new GraphQLList(GraphQLString) },
|
||||
prizes:{ type: new GraphQLList(GraphQLString) },
|
||||
participants:{ type: new GraphQLList(GraphQLString) },
|
||||
repo: { type: GraphQLString },
|
||||
configFile: { type: GraphQLString }
|
||||
}),
|
||||
});
|
||||
|
||||
export default CompetitionType;
|
||||
@@ -0,0 +1,14 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString
|
||||
} from 'graphql';
|
||||
|
||||
const DataRangeType = new GraphQLObjectType({
|
||||
name: 'DataRange',
|
||||
fields: () => ({
|
||||
filePath: { type: GraphQLString },
|
||||
fileName: { type: GraphQLString }
|
||||
}),
|
||||
});
|
||||
|
||||
export default DataRangeType;
|
||||
@@ -0,0 +1,21 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString,
|
||||
GraphQLList
|
||||
} from 'graphql';
|
||||
|
||||
import { DataRangeType } from './index'
|
||||
|
||||
const DataSetType = new GraphQLObjectType({
|
||||
name: 'DataSet',
|
||||
fields: () => ({
|
||||
codeName: { type: GraphQLString },
|
||||
type: { type: GraphQLString },
|
||||
validPeriods: { type: new GraphQLList(GraphQLString) },
|
||||
filePath: { type: GraphQLString },
|
||||
fileName: { type: GraphQLString },
|
||||
dataRange: { type: DataRangeType }
|
||||
}),
|
||||
});
|
||||
|
||||
export default DataSetType;
|
||||
@@ -13,10 +13,10 @@ const EcosystemType = new GraphQLObjectType({
|
||||
id: { type: GraphQLID },
|
||||
authId: { type: GraphQLString },
|
||||
userName: { type: GraphQLString }, // TODO this field is temporary, it should be used the user module query
|
||||
teams: {
|
||||
devTeams: {
|
||||
type: new GraphQLList(TeamType),
|
||||
resolve(parent) {
|
||||
return parent.teams;
|
||||
return parent.devTeams;
|
||||
}
|
||||
},
|
||||
hosts: {
|
||||
|
||||
@@ -4,26 +4,31 @@ import {
|
||||
GraphQLList
|
||||
} from 'graphql';
|
||||
|
||||
import { BotType } from './index';
|
||||
import { CompetitionType, PlotterType, HostType } from './index';
|
||||
|
||||
const EventHostType = new GraphQLObjectType({
|
||||
name: 'EventHost',
|
||||
fields: () => ({
|
||||
codeName: { type: GraphQLString },
|
||||
displayName: { type: GraphQLString },
|
||||
host: { type: GraphQLString },
|
||||
host: {
|
||||
type: HostType,
|
||||
resolve(parent) {
|
||||
return parent.host;
|
||||
}
|
||||
},
|
||||
container: { type: GraphQLString },
|
||||
accessKey: { type: GraphQLString },
|
||||
competitions: {
|
||||
type: new GraphQLList(BotType),
|
||||
type: new GraphQLList(CompetitionType),
|
||||
resolve(parent) {
|
||||
return parent.bots;
|
||||
return parent.competitions;
|
||||
}
|
||||
},
|
||||
plotters: {
|
||||
type: new GraphQLList(BotType),
|
||||
type: new GraphQLList(PlotterType),
|
||||
resolve(parent) {
|
||||
return parent.bots;
|
||||
return parent.plotters;
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString
|
||||
} from 'graphql';
|
||||
|
||||
const ExchangeType = new GraphQLObjectType({
|
||||
name: 'Exchange',
|
||||
fields: () => ({
|
||||
name: { type: GraphQLString }
|
||||
}),
|
||||
});
|
||||
|
||||
export default ExchangeType;
|
||||
@@ -0,0 +1,25 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString,
|
||||
GraphQLList
|
||||
} from 'graphql'
|
||||
|
||||
import { PanelType } from './index'
|
||||
|
||||
const ModuleType = new GraphQLObjectType({
|
||||
name: 'Module',
|
||||
fields: () => ({
|
||||
codeName: { type: GraphQLString },
|
||||
moduleName: { type: GraphQLString },
|
||||
description: { type: GraphQLString },
|
||||
profilePicture: { type: GraphQLString },
|
||||
panels: {
|
||||
type: new GraphQLList(PanelType),
|
||||
resolve(parent) {
|
||||
return parent.panels;
|
||||
}
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
||||
export default ModuleType;
|
||||
@@ -0,0 +1,15 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString
|
||||
} from 'graphql';
|
||||
|
||||
const PanelType = new GraphQLObjectType({
|
||||
name: 'Panel',
|
||||
fields: () => ({
|
||||
codeName: { type: GraphQLString },
|
||||
moduleName: { type: GraphQLString },
|
||||
event: { type: GraphQLString }
|
||||
}),
|
||||
});
|
||||
|
||||
export default PanelType;
|
||||
@@ -0,0 +1,26 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString,
|
||||
GraphQLList
|
||||
} from 'graphql';
|
||||
|
||||
import { ModuleType } from './index'
|
||||
|
||||
const PlotterType = new GraphQLObjectType({
|
||||
name: 'Plotter',
|
||||
fields: () => ({
|
||||
codeName: { type: GraphQLString },
|
||||
displayName: { type: GraphQLString },
|
||||
host: { type: GraphQLString },
|
||||
modules: {
|
||||
type: new GraphQLList(ModuleType),
|
||||
resolve(parent) {
|
||||
return parent.modules;
|
||||
}
|
||||
},
|
||||
repo: { type: GraphQLString },
|
||||
configFile: { type: GraphQLString }
|
||||
}),
|
||||
});
|
||||
|
||||
export default PlotterType;
|
||||
@@ -0,0 +1,17 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString
|
||||
} from 'graphql';
|
||||
|
||||
const PlotterReferenceType = new GraphQLObjectType({
|
||||
name: 'PlotterReference',
|
||||
fields: () => ({
|
||||
codeName: { type: GraphQLString },
|
||||
host: { type: GraphQLString },
|
||||
devTeam: { type: GraphQLString },
|
||||
moduleName: { type: GraphQLString },
|
||||
repo: { type: GraphQLString }
|
||||
}),
|
||||
});
|
||||
|
||||
export default PlotterReferenceType;
|
||||
@@ -0,0 +1,31 @@
|
||||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLString,
|
||||
GraphQLList
|
||||
} from 'graphql';
|
||||
|
||||
import { ExchangeType, DataSetType, PlotterReferenceType } from './index'
|
||||
|
||||
const ProductType = new GraphQLObjectType({
|
||||
name: 'Product',
|
||||
fields: () => ({
|
||||
codeName: { type: GraphQLString },
|
||||
displayName: { type: GraphQLString },
|
||||
description: { type: GraphQLString },
|
||||
dataSets: {
|
||||
type: new GraphQLList(DataSetType),
|
||||
resolve(parent) {
|
||||
return parent.dataSets;
|
||||
}
|
||||
},
|
||||
exchangeList: {
|
||||
type: new GraphQLList(ExchangeType),
|
||||
resolve(parent) {
|
||||
return parent.exchangeList;
|
||||
}
|
||||
},
|
||||
plotter: { type: PlotterReferenceType }
|
||||
}),
|
||||
});
|
||||
|
||||
export default ProductType;
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
GraphQLList
|
||||
} from 'graphql';
|
||||
|
||||
import { BotType, HostType } from './index';
|
||||
import { BotType, PlotterType, HostType } from './index';
|
||||
|
||||
const TeamType = new GraphQLObjectType({
|
||||
name: 'Team',
|
||||
@@ -24,9 +24,9 @@ const TeamType = new GraphQLObjectType({
|
||||
}
|
||||
},
|
||||
plotters: {
|
||||
type: new GraphQLList(BotType),
|
||||
type: new GraphQLList(PlotterType),
|
||||
resolve(parent) {
|
||||
return parent.bots;
|
||||
return parent.plotters;
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
@@ -4,6 +4,15 @@ import EventHostType from './EventHost';
|
||||
import HostType from './Host';
|
||||
import EcosystemType from './Ecosystem';
|
||||
import FileType from './File';
|
||||
import PanelType from './Panel';
|
||||
import ModuleType from './Module';
|
||||
import PlotterType from './Plotter';
|
||||
import CompetitionType from './Competition';
|
||||
import PlotterReferenceType from './PlotterReference';
|
||||
import ProductType from './Product';
|
||||
import DataSetType from './DataSet';
|
||||
import DataRangeType from './DataRange';
|
||||
import ExchangeType from './Exchange';
|
||||
|
||||
export {
|
||||
TeamType,
|
||||
@@ -11,5 +20,14 @@ export {
|
||||
EventHostType,
|
||||
HostType,
|
||||
EcosystemType,
|
||||
FileType
|
||||
FileType,
|
||||
PanelType,
|
||||
ModuleType,
|
||||
PlotterType,
|
||||
CompetitionType,
|
||||
PlotterReferenceType,
|
||||
ProductType,
|
||||
DataSetType,
|
||||
DataRangeType,
|
||||
ExchangeType
|
||||
};
|
||||
Reference in new issue
Block a user