Skip to content

GreekGodBod/be_greek_god_bod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GREEK GOD BOD BACK END REPOSITORY

Screen Shot 2022-05-20 at 7 29 38 AM

Table of Contents

PURPOSE

This application is used in conjunction with the FE respository for Greek God Bod. This repository and hosted application is the primary server, exposing API endpoints that our FE application calls. Please see below for a list of end points that are exposed plus detailed information about our database schema.

CALLING ENDPOINTS

The follow endpoints can be called individually via URI input in your browser, or individually using . Our FE application has already established API calls that are triggered automatically via user interaction.

Retrieve Suggested Workout

GET /api/v1/workouts
Content-Type: application/json
Accept: application/json

Response

{
  "data": {
      "id": 3,
      "name": "killer leg day",
      "user_id": 1,
      "created_at": "2022-05-25T02:18:37.383Z",
      "updated_at": "2022-05-25T02:18:37.383Z",
      "status": "completed",
      "exercises": [
          {
              "id": 11,
              "name": "smith sumo squat",
              "created_at": "2022-05-25T02:18:37.484Z",
              "updated_at": "2022-05-25T02:18:37.484Z",
              "gif": "http://d205bpvrqc9yn1.cloudfront.net/3142.gif",
              "equipment": "smith machine"
          },
          {
              "id": 12,
              "name": "trap bar deadlift",
              "created_at": "2022-05-25T02:18:37.489Z",
              "updated_at": "2022-05-25T02:18:37.489Z",
              "gif": "http://d205bpvrqc9yn1.cloudfront.net/0811.gif",
              "equipment": "trap bar"
          },
          {
              "id": 13,
              "name": "weighted lunge with swing",
              "created_at": "2022-05-25T02:18:37.493Z",
              "updated_at": "2022-05-25T02:18:37.493Z",
              "gif": "http://d205bpvrqc9yn1.cloudfront.net/3644.gif",
              "equipment": "weighted"
          },
          {
              "id": 14,
              "name": "cable assisted inverse leg curl",
              "created_at": "2022-05-25T02:18:37.499Z",
              "updated_at": "2022-05-25T02:18:37.499Z",
              "gif": "http://d205bpvrqc9yn1.cloudfront.net/3235.gif",
              "equipment": "cable"
          },
          {
              "id": 15,
              "name": "lever leg extension",
              "created_at": "2022-05-25T02:18:37.504Z",
              "updated_at": "2022-05-25T02:18:37.504Z",
              "gif": "http://d205bpvrqc9yn1.cloudfront.net/0585.gif",
              "equipment": "leverage machine"
          }
      ]
  }
}

Retrieve All Users

GET /api/v1/user
Content-Type: application/json
Accept: application/json

Response

[
  {
      "id": 1,
      "name": "user_1",
      "password": *********,
      "created_at": "2022-05-25T22:20:49.361Z",
      "updated_at": "2022-05-25T22:20:49.361Z"
  },
  {
      "id": 2,
      "name": "user_2",
      "password": *********,
      "created_at": "2022-05-25T22:20:49.366Z",
      "updated_at": "2022-05-25T22:20:49.366Z"
  },
  {
      "id": 3,
      "name": "user_3",
      "password": *********,
      "created_at": "2022-05-25T22:20:49.371Z",
      "updated_at": "2022-05-25T22:20:49.371Z"
  },
  {
      "id": 4,
      "name": "user_4",
      "password": *********,
      "created_at": "2022-05-25T22:20:49.376Z",
      "updated_at": "2022-05-25T22:20:49.376Z"
  },
  {
      "id": 5,
      "name": "user_5",
      "password": *********,
      "created_at": "2022-05-25T22:20:49.381Z",
      "updated_at": "2022-05-25T22:20:49.381Z"
  }
]

Create A Workout

POST /api/v1/user
Content-Type: application/json
Accept: application/json

{
"id": 1,
"name": "Tester",
"exercises": [
  {
    "bodyPart": "chest",
    "equipment": "assisted",
    "gifUrl": "http://d205bpvrqc9yn1.cloudfront.net/1716.gif",
    "id": "1716",
    "name": "assisted seated pectoralis major stretch with stability ball",
    "target": "pectorals",
    "intervals": []
  },
  {
    "bodyPart": "chest",
    "equipment": "leverage-machine",
    "gifUrl": "http://d205bpvrqc9yn1.cloudfront.net/1716.gif",
    "id": "0009",
    "name": "assisted chest dip (kneeling)",
    "target": "pectorals",
    "intervals": []
  }
]
}

Response

{
  "data": {
      "id": 15,
      "name": "Tester",
      "user_id": 1,
      "created_at": "2022-05-25T16:51:39.466Z",
      "updated_at": "2022-05-25T16:51:39.466Z",
      "status": "in progress",
      "exercises": [
          {
              "id": 46,
              "name": "assisted seated pectoralis major stretch with stability ball",
              "created_at": "2022-05-25T16:51:39.471Z",
              "updated_at": "2022-05-25T16:51:39.471Z",
              "gif": "http://d205bpvrqc9yn1.cloudfront.net/1716.gif",
              "equipment": "assisted",
              "intervals": []
          },
          {
              "id": 47,
              "name": "assisted chest dip (kneeling)",
              "created_at": "2022-05-25T16:51:39.481Z",
              "updated_at": "2022-05-25T16:51:39.481Z",
              "gif": "http://d205bpvrqc9yn1.cloudfront.net/1716.gif",
              "equipment": "leverage-machine",
              "intervals": []
          }
      ]
  }
}

Complete A Workout

PATCH /api/v1/user
Content-Type: application/json
Accept: application/json
{
  "id": 1,
  "name": "Tester",
  "exercises": [
      {
          "equipment": "leverage machine",
          "gif_url": "http://d205bpvrqc9yn1.cloudfront.net/0015.gif",
          "id": 29,
          "intervals": [
              {
                  "workout_exercise_id": 29, 
                  "reps": 12,
                  "weight_lbs": 123
              }
              ],
          "name": "assisted parallel close grip pull-up"
      }
  ]
}

Response

{
  "message": "Workout Completed"
}

Post A Message via Action Cable

POST api/v1/social
Content-Type: application/json
Accept: application/json

body:

{
"name": "user_1",
"content": "This is a secret test message"
}

Response

{
  "id": 21,
  "content": "This is a secret test message",
  "user_id": 1,
  "created_at": "2022-05-25T23:24:45.816Z",
  "updated_at": "2022-05-25T23:24:45.816Z",
  "name": "user_1",
  "social_id": 1
}

Retrieve All Messages

GET api/v1/social
Content-Type: application/json
Accept: application/json

Response

[
  {
      "id": 1,
      "content": "message 1",
      "user_id": 1,
      "created_at": "2022-05-25T22:20:50.405Z",
      "updated_at": "2022-05-25T22:20:50.405Z",
      "name": "user_1",
      "social_id": 1
  },
  {
      "id": 2,
      "content": "message 2",
      "user_id": 2,
      "created_at": "2022-05-25T22:20:50.411Z",
      "updated_at": "2022-05-25T22:20:50.411Z",
      "name": "user_2",
      "social_id": 1
  },
  {
      "id": 3,
      "content": "message 3",
      "user_id": 2,
      "created_at": "2022-05-25T22:20:50.417Z",
      "updated_at": "2022-05-25T22:20:50.417Z",
      "name": "user_2",
      "social_id": 1
  }
]

DATABASE

Screen Shot 2022-05-26 at 10 09 25 AM

BUILT WITH

Git CircleCI Redis Heroku Visual Studio Code

πŸ’Ž Additional Gems πŸ’Ž

Capybara | Fast JSON API | Faraday | VCR | Webmock | Shoulda Matchers | SimpleCov | Figaro |

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published