mirror of
https://github.com/BreizhHardware/ProjetS4COMWEB.git
synced 2026-03-28 02:09:47 +01:00
58 lines
1.3 KiB
PHP
58 lines
1.3 KiB
PHP
<?php
|
|
|
|
require_once 'src/router.php';
|
|
require_once '../php/constants.php';
|
|
require_once '../php/db/dbconnect.php';
|
|
require_once '../php/db/Search.php';
|
|
require_once '../php/db/Calendrier.php';
|
|
ini_set('display_errors', 1);
|
|
error_reporting(E_ALL);
|
|
$pdo = dbConnect();
|
|
|
|
|
|
$router = new Router();
|
|
|
|
$router->GET('/api/requests', ["test"], function($test){
|
|
echo json_encode($test);
|
|
});
|
|
|
|
$router->GET('/api/search', ["type", "location"], function($type = null, $location = null){
|
|
global $pdo;
|
|
if ($type && $location){
|
|
searchDoctorByLocation($pdo, $location, $type);
|
|
}
|
|
else if ($type){
|
|
searchDoctor($pdo, $type);
|
|
}
|
|
else if ($location) {
|
|
searchDoctorByLocation($pdo, $location);
|
|
}
|
|
else {
|
|
echo json_encode([]);
|
|
}
|
|
});
|
|
|
|
$router->GET('/api/rdv-time', ["id"], function($id){
|
|
global $pdo;
|
|
selectRDVTimeByID($pdo, $id);
|
|
});
|
|
|
|
$router->GET('/api/rdv-date', ["date", "id"], function($date, $id){
|
|
global $pdo;
|
|
selectRDVForDate($pdo, $date, $id);
|
|
});
|
|
|
|
$router->POST('/api/requests', ["test"], function($test){
|
|
echo json_encode($test);
|
|
});
|
|
|
|
$router->PUT('/api/requests', ["test"], function($test){
|
|
echo json_encode($test);
|
|
});
|
|
|
|
$router->DELETE('/api/requests', ["test"], function($test){
|
|
echo json_encode($test);
|
|
});
|
|
|
|
$router->run();
|