Table of Contents generated with DocToc
Yeah, writing this (again), using graphQL/Relay, let's see if I can actually get it working.
- Postgres (may do sqllite for dev)
> npm install
> npm start
Relay GraphIQL on http://localhost:8080 App on http://localhost:3000
> npm run update-schema
{
user(email:"jay@jay.com") {
workouts {
edges {
node {
id,
name
lifts {
edges {
node {
id,
name,
}
}
}
}
}
}
}
}
mutation RemoveLiftMutation($input: RemoveLiftMutationInput!) {
removeLift(input: $input) {
removedLiftId,
workout {
id,
name,
lifts {
edges {
node {
id,
name,
}
}
}
}
}
}
// Variables
{
"input": {
"id": "TGlmdDozMzY",
"clientMutationId": 0
}
}
mutation addLift($input: AddLiftMutationInput!) {
addLiftMutation(input: $input) {
newLiftEdge {
node {
id,
sets,
weight,
reps,
}
},
workout {
id,
name,
lifts {
edges {
node {
id,
name,
reps
}
}
}
}
clientMutationId
}
}
// Variables
{
"input": {
"workout_id": "V29ya291dDox",
"sets": 1,
"reps": 2,
"weight": 100,
"name": "stuff",
"clientMutationId": 0
}
}
mutation EditLiftMutation($input: EditLiftMutationInput!) {
editLift(input: $input) {
lift {
name,
id,
sets,
}
}
}
// Variables
{
"input": {
"id": "TGlmdDozMzk=",
"workout_id": "50",
"sets": 3,
"reps": 3,
"weight": 100,
"name": "test update",
"clientMutationId": 0
}
}
{
workout(id:1) {
id,
lifts {
edges {
cursor,
node {
id,
name,
sets,
reps
}
},
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
}
}
}
{
workout(id:1) {
id,
lifts(first:1) {
edges {
cursor,
node {
id,
name,
sets,
reps
}
},
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
}
}
}
{
liftToWorkout: lift(id:1) {
id,
sets,
name,
workout {
edges {
cursor,
node {
id,
name,
date
}
}
}
}
workout: workout(id:1) {
id,
lifts(first: 2) {
edges {
cursor,
node {
id,
name,
sets,
reps
}
},
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
}
},
account: account(id:1) {
id,
email,
workouts {
edges {
cursor,
node {
id,
name,
date
}
}
}
}
}
query AccountQuery {
node(id: "QWNjb3VudDox") {
id
... on Account {
name,
email
}
}
}
{
workout: workout(id:1) {
id,
name,
lifts(first: 1) {
edges {
cursor,
node {
id,
name
}
}
}
}
workoutCont: workout(id:1) {
id,
name,
lifts(first: 5 after: "YXJyYXljb25uZWN0aW9uOjA=") {
pageInfo {
hasPreviousPage,
hasNextPage
}
edges {
cursor,
node {
id,
name
}
}
}
}
}
Stil figuring out why, but if I'm tinkering and killing the servr during a seed or migration bad things can happy. in that case
knex migrate:rollback
knex migrate:latest