Correcting bugs and linting
This commit is contained in:
1 parent
a41d553387
commit
39f3071d2d
5 files changed
+11
-7
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import 'dotenv/config';
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
mongoose.connect(process.env.MONGO_URL, { useNewUrlParser: true })
|
||||
mongoose.connect(process.env.MONGO_URL, { useNewUrlParser: true });
|
||||
mongoose.set('useCreateIndex', true);
|
||||
mongoose.set('useFindAndModify', false);
|
||||
mongoose.Promise = global.Promise;
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
export class AuthentificationError extends Error {
|
||||
code = 401
|
||||
|
||||
message = 'Autentification not found, you have to be authentificated to perform this action'
|
||||
}
|
||||
|
||||
export class DatabaseError extends Error {
|
||||
code = 404
|
||||
|
||||
message = `Ressource not found : ${this.message}`
|
||||
}
|
||||
|
||||
export class WrongArgumentsError extends Error {
|
||||
code = 400
|
||||
|
||||
message = `Wrong arguments : ${this.message}`
|
||||
}
|
||||
|
||||
export class ServiceUnavailableError extends Error {
|
||||
code = 503
|
||||
|
||||
message = `At least one service is unresponding ${this.message}`
|
||||
}
|
||||
@@ -49,6 +49,6 @@ const tradingSystemSchema = new Schema(
|
||||
},
|
||||
);
|
||||
|
||||
const TradingSystem = mongoose.model('Signal', tradingSystemSchema);
|
||||
const TradingSystem = mongoose.model('TradingSystem', tradingSystemSchema);
|
||||
|
||||
export default TradingSystem;
|
||||
@@ -19,9 +19,9 @@ const resolve = (parent, { id: _id, tradingSystem: editedTradingSystem }) => new
|
||||
}
|
||||
tradingSystem.history.push({
|
||||
updatedAt: tradingSystem.updatedAt,
|
||||
subStrategies: tradingSystem.subStrategies,
|
||||
strategies: tradingSystem.strategies,
|
||||
});
|
||||
tradingSystem.subStrategies = editedTradingSystem.subStrategies;
|
||||
tradingSystem.strategies = editedTradingSystem.strategies;
|
||||
tradingSystem.save((error) => {
|
||||
if (error) {
|
||||
rej(error);
|
||||
|
||||
@@ -15,14 +15,14 @@ const Type = new GraphQLObjectType({
|
||||
fields: () => ({
|
||||
id: { type: GraphQLID },
|
||||
fbSlug: { type: GraphQLString },
|
||||
Strategies: {
|
||||
strategies: {
|
||||
args: { activeOnly: { type: GraphQLBoolean } },
|
||||
type: new GraphQLList(StrategyType),
|
||||
resolve(parent, { activeOnly }) {
|
||||
if (activeOnly) {
|
||||
return parent.Strategies.filter(Strategy => Strategy.active);
|
||||
return parent.strategies.filter(strategy => strategy.active);
|
||||
}
|
||||
return parent.Strategies;
|
||||
return parent.strategies;
|
||||
},
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user