Merge pull request #4 from nikolabjelo/develop

Went from fbId to fbSlug
This commit is contained in:
nikolabjelo authored and GitHub committed 2019-03-17 20:56:11 +01:00
commit 60738cbab8
4 files changed
+9 -9

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@ import mongoose, { Schema } from 'mongoose';
const strategySchema = new Schema(
{
fbId: {
fbSlug: {
type: String,
required: true,
unique: true,
+3 -3
View File
@@ -7,12 +7,12 @@ import { Strategy } from '../../models';
import { StrategyInputType } from '../types/input';
export const args = {
fbId: { type: new GraphQLNonNull(GraphQLString) },
fbSlug: { type: new GraphQLNonNull(GraphQLString) },
strategy: { type: StrategyInputType },
};
const resolve = (parent, { fbId, strategy }) => {
strategy.fbId = fbId;
const resolve = (parent, { fbSlug, strategy }) => {
strategy.fbSlug = fbSlug;
const newStrategy = new Strategy(strategy);
return new Promise((res, rej) => {
+4 -4
View File
@@ -7,17 +7,17 @@ import { StrategyType } from '../types';
import { Strategy } from '../../models';
const args = {
fbId: { type: new GraphQLNonNull(GraphQLID) },
fbSlug: { type: new GraphQLNonNull(GraphQLID) },
};
const resolve = (parent, { fbId }) => new Promise((res, rej) => {
Strategy.findOne({ fbId }).exec((err, strategy) => {
const resolve = (parent, { fbSlug }) => new Promise((res, rej) => {
Strategy.findOne({ fbSlug }).exec((err, strategy) => {
if (err) {
rej(err);
return;
}
if (!strategy) {
rej(new DatabaseError('None of the strategy are linked to that fbId'));
rej(new DatabaseError('None of the strategy are linked to that fbSlug'));
return;
}
res(strategy);
+1 -1
View File
@@ -13,7 +13,7 @@ const Type = new GraphQLObjectType({
description: 'Everything you need to know about a strategy',
fields: () => ({
id: { type: GraphQLID },
fbId: { type: GraphQLString },
fbSlug: { type: GraphQLString },
subStrategies: {
type: new GraphQLList(SubStrategyType),
resolve(parent) {