This repository has been archived by the owner on Dec 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(*): Refactor data type stucture
Refactored data-types to be easier to manage
- Loading branch information
Simon Wears
committed
Mar 25, 2017
1 parent
4024d15
commit 5f91364
Showing
10 changed files
with
231 additions
and
224 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const graphql = require('graphql'); | ||
const GraphQLObjectType = graphql.GraphQLObjectType; | ||
const GraphQLList = graphql.GraphQLList; | ||
const GraphQLInt = graphql.GraphQLInt; | ||
const resolveItems = require('../../helpers/resolve-items'); | ||
const i18n = require('../../helpers/i18n'); | ||
const StrengthTrainingItem = require('./item'); | ||
|
||
module.exports = new GraphQLObjectType({ | ||
name: 'StrengthTrainingActivities', | ||
fields: { | ||
size: { | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.ACTIVITIES.SIZE'), | ||
type: GraphQLInt | ||
}, | ||
items: { | ||
args: resolveItems.args, | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.ACTIVITIES.ITEMS'), | ||
resolve: resolveItems.resolve, | ||
type: new GraphQLList(StrengthTrainingItem) | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
const graphql = require('graphql'); | ||
const GraphQLEnumType = graphql.GraphQLEnumType; | ||
|
||
module.exports = new GraphQLEnumType({ | ||
name: 'ExerciseTypes', | ||
values: { | ||
BARBELL_CURL: {value: 'Barbell Curl'}, | ||
DUMBBELL_CURL: {value: 'Dumbbell Curl'}, | ||
BARBELL_TRICEP_PRESS: {value: 'Barbell Tricep Press'}, | ||
DUMBBELL_TRICEP_PRESS: {value: 'Dumbbell Tricep Press'}, | ||
OVERHEAD_PRESS: {value: 'Overhead Press'}, | ||
WRIST_CURL: {value: 'Wrist Curl'}, | ||
TRICEP_KICKBACK: {value: 'Tricep Kickback'}, | ||
BENCH_PRESS: {value: 'Bench Press'}, | ||
CABLE_CROSSOVER: {value: 'Cable Crossover'}, | ||
DUBBELL_FLY: {value: 'Dumbbell Fly'}, | ||
INCLINE_BENCH: {value: 'Incline Bench'}, | ||
DIPS: {value: 'Dips'}, | ||
PUSHUP: {value: 'Pushup'}, | ||
PULLUP: {value: 'Pullup'}, | ||
BACK_RAISE: {value: 'Back Raise'}, | ||
BENT_OVER_ROW: {value: 'Bent-Over Row'}, | ||
SEATED_ROW: {value: 'Seated Row'}, | ||
CHINUP: {value: 'Chinup'}, | ||
LAT_PULLDOWN: {value: 'Lat Pulldown'}, | ||
SEATED_REVERSE_FLY: {value: 'Seated Reverse Fly'}, | ||
MILITARY_PRESS: {value: 'Military Press'}, | ||
UPRIGHT_ROW: {value: 'Upright Row'}, | ||
FRONT_RAISE: {value: 'Front Raise'}, | ||
SIDE_LATERAL_RAISE: {value: 'Side Lateral Raise'}, | ||
SNATCH: {value: 'Snatch'}, | ||
PUSH_PRESS: {value: 'Push Press'}, | ||
SHRUG: {value: 'Shrug'}, | ||
CRUNCH_MACHINE: {value: 'Crunch Machine'}, | ||
CRUNCH: {value: 'Crunch'}, | ||
AB_TWIST: {value: 'Ab Twist'}, | ||
BICYCLE_KICK: {value: 'Bicycle Kick'}, | ||
HANGING_LEG_RAISE: {value: 'Hanging Leg Raise'}, | ||
HANGING_KNEE_RAISE: {value: 'Hanging Knee Raise'}, | ||
REVERSE_CRUNCH: {value: 'Reverse Crunch'}, | ||
V_UP: {value: 'V Up'}, | ||
SITUP: {value: 'Situp'}, | ||
SQUAT: {value: 'Squat'}, | ||
LUNGE: {value: 'Lunge'}, | ||
DEAD_LIFT: {value: 'Dead Lift'}, | ||
HAMSTRING_CURL: {value: 'Hamstring Curl'}, | ||
GOOD_MORNING: {value: 'Good Morning'}, | ||
CLEAN: {value: 'Clean'}, | ||
LEG_PRESS: {value: 'Leg Press'}, | ||
LEG_EXTENSION: {value: 'Leg Extension'}, | ||
OTHER: {value: 'Other'} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const graphql = require('graphql'); | ||
const GraphQLString = graphql.GraphQLString; | ||
const GraphQLList = graphql.GraphQLList; | ||
const GraphQLObjectType = graphql.GraphQLObjectType; | ||
const StrengthTrainingSet = require('./set'); | ||
const i18n = require('../../helpers/i18n'); | ||
|
||
module.exports = new GraphQLObjectType({ | ||
name: 'StrengthTrainingExercise', | ||
fields: { | ||
notes: { | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.EXERCISE.NOTES'), | ||
type: GraphQLString | ||
}, | ||
primary_muscle_group: { | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.EXERCISE.PRIMARY_MUSCLE_GROUP'), | ||
type: GraphQLString | ||
}, | ||
primary_type: { | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.EXERCISE.PRIMARY_TYPE'), | ||
type: GraphQLString | ||
}, | ||
routine: { | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.EXERCISE.ROUTINE'), | ||
type: GraphQLString | ||
}, | ||
secondary_muscle_group: { | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.EXERCISE.SECONDARY_MUSCLE_GROUP'), | ||
type: GraphQLString | ||
}, | ||
secondary_type: { | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.EXERCISE.SECONDARY_TYPE'), | ||
type: GraphQLString | ||
}, | ||
sets: { | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.EXERCISE.SETS'), | ||
type: new GraphQLList(StrengthTrainingSet) | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
const graphql = require('graphql'); | ||
const GraphQLString = graphql.GraphQLString; | ||
const GraphQLList = graphql.GraphQLList; | ||
const GraphQLInt = graphql.GraphQLInt; | ||
const GraphQLFloat = graphql.GraphQLFloat; | ||
const GraphQLObjectType = graphql.GraphQLObjectType; | ||
const StrengthTrainingExercise = require('./exercise'); | ||
const CommentType = require('../comment'); | ||
const i18n = require('../../helpers/i18n'); | ||
|
||
module.exports = new GraphQLObjectType({ | ||
name: 'StrengthTrainingItem', | ||
fields: { | ||
comments: { | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.ITEM.COMMENTS'), | ||
resolve (parent, args, context) { | ||
return context.healthGraphLoader.load(parent.uri) | ||
.then(d => context.healthGraphLoader.load(d.comments)) | ||
.then(c => c.comments); | ||
}, | ||
type: new GraphQLList(CommentType) | ||
}, | ||
exercises: { | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.ITEM.EXERCISES'), | ||
resolve (parent, args, context) { | ||
return context.healthGraphLoader.load(parent.uri).then(d => d.exercises); | ||
}, | ||
type: new GraphQLList(StrengthTrainingExercise) | ||
}, | ||
notes: { | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.ITEM.NOTES'), | ||
resolve (parent, args, context) { | ||
return context.healthGraphLoader.load(parent.uri).then(d => d.notes); | ||
}, | ||
type: GraphQLString | ||
}, | ||
source: { | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.ITEM.SOURCE'), | ||
resolve (parent, args, context) { | ||
return context.healthGraphLoader.load(parent.uri).then(d => d.source); | ||
}, | ||
type: GraphQLString | ||
}, | ||
start_time: { | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.ITEM.START_TIME'), | ||
type: GraphQLString | ||
}, | ||
total_calories: { | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.ITEM.TOTAL_CALORIES'), | ||
resolve (parent, args, context) { | ||
return context.healthGraphLoader.load(parent.uri).then(d => d.total_calories); | ||
}, | ||
type: GraphQLFloat | ||
}, | ||
userID: { | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.ITEM.USERID'), | ||
resolve (parent, args, context) { | ||
return context.healthGraphLoader.load(parent.uri).then(d => d.userID); | ||
}, | ||
type: GraphQLInt | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const graphql = require('graphql'); | ||
const GraphQLEnumType = graphql.GraphQLEnumType; | ||
|
||
module.exports = new GraphQLEnumType({ | ||
name: 'MuscleTypes', | ||
values: { | ||
ABS: {value: 'Abs'}, | ||
ARMS: {value: 'Arms'}, | ||
BACK: {value: 'Back'}, | ||
CHEST: {value: 'Chest'}, | ||
LEGS: {value: 'Legs'}, | ||
SHOULDERS: {value: 'Shoulders'} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const graphql = require('graphql'); | ||
const GraphQLString = graphql.GraphQLString; | ||
const GraphQLInt = graphql.GraphQLInt; | ||
const GraphQLFloat = graphql.GraphQLFloat; | ||
const GraphQLObjectType = graphql.GraphQLObjectType; | ||
const i18n = require('../../helpers/i18n'); | ||
|
||
module.exports = new GraphQLObjectType({ | ||
name: 'StrengthTrainingSet', | ||
fields: { | ||
notes: { | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.SET.NOTES'), | ||
type: GraphQLString | ||
}, | ||
repetitions: { | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.SET.REPETITIONS'), | ||
type: GraphQLInt | ||
}, | ||
weight: { | ||
description: i18n.t('GRAPHQL.STRENGTH_TRAINING.SET.WEIGHT'), | ||
type: GraphQLFloat | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.