Merge branch 'development' of goeranh/fitness-api into master
This commit is contained in:
commit
31f826e1cb
@ -3,24 +3,26 @@
|
|||||||
|
|
||||||
class Exercise
|
class Exercise
|
||||||
{
|
{
|
||||||
public $id, $name, $description, $amount, $type, $unit, $current;
|
public $id, $name, $description, $amount, $sets, $type, $unit, $current;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Workout constructor.
|
* Exercise constructor.
|
||||||
* @param $id
|
* @param $id
|
||||||
* @param $name
|
* @param $name
|
||||||
* @param $description
|
* @param $description
|
||||||
* @param $amount
|
* @param $amount
|
||||||
|
* @param $sets
|
||||||
* @param $type
|
* @param $type
|
||||||
* @param $unit
|
* @param $unit
|
||||||
* @param $current
|
* @param $current
|
||||||
*/
|
*/
|
||||||
public function __construct($id, $name, $description, $amount, $type, $unit, $current = 0)
|
public function __construct($id, $name, $description, $amount, $sets, $type, $unit, $current = 0)
|
||||||
{
|
{
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->description = $description;
|
$this->description = $description;
|
||||||
$this->amount = $amount;
|
$this->amount = $amount;
|
||||||
|
$this->sets = $sets;
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
$this->unit = $unit;
|
$this->unit = $unit;
|
||||||
$this->current = $current;
|
$this->current = $current;
|
||||||
|
@ -13,7 +13,7 @@ if (isset($_GET['token'])){
|
|||||||
$userID = $userData[0]['user'];
|
$userID = $userData[0]['user'];
|
||||||
|
|
||||||
if(isset($_GET['workout'])){
|
if(isset($_GET['workout'])){
|
||||||
$sql = "SELECT exercises_in_workout.id, name, description, amount, type, unit FROM exercises_in_workout inner join workout_types on workout_types.id=exercises_in_workout.workout_type inner JOIN workout_type_measurements on workout_type_measurements.id=workout_types.measurement where exercises_in_workout.workout_routine=? order by exercises_in_workout.id asc ";
|
$sql = "SELECT exercises_in_workout.id, name, description, amount, sets, type, unit FROM exercises_in_workout inner join workout_types on workout_types.id=exercises_in_workout.workout_type inner JOIN workout_type_measurements on workout_type_measurements.id=workout_types.measurement where exercises_in_workout.workout_routine=? order by exercises_in_workout.id asc ";
|
||||||
$stmt = $pdo->prepare($sql);
|
$stmt = $pdo->prepare($sql);
|
||||||
$stmt->bindParam(1, $_GET['workout']);
|
$stmt->bindParam(1, $_GET['workout']);
|
||||||
if ($stmt->execute()){
|
if ($stmt->execute()){
|
||||||
@ -21,7 +21,7 @@ if (isset($_GET['token'])){
|
|||||||
$returnExercises = array();
|
$returnExercises = array();
|
||||||
foreach($exercises as $exercise){
|
foreach($exercises as $exercise){
|
||||||
|
|
||||||
$returnExercises[] = new Exercise($exercise['id'], $exercise['name'], $exercise['description'], $exercise['amount'], $exercise['type'], $exercise['unit']);
|
$returnExercises[] = new Exercise($exercise['id'], $exercise['name'], $exercise['description'], $exercise['amount'], $exercise['sets'], $exercise['type'], $exercise['unit']);
|
||||||
}
|
}
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode($returnExercises);
|
echo json_encode($returnExercises);
|
||||||
|
Loading…
Reference in New Issue
Block a user