wip: added rest api endpoint shiai

This commit is contained in:
marko
2023-12-26 20:24:34 +01:00
parent 49978a48df
commit f2cf7ff764
12 changed files with 245 additions and 44 deletions

View File

@@ -15,6 +15,12 @@ class Shiai
private $galleryUrl = null; //< url of the gallery to a gallery of the shiai
private $promoImgUrl = null; //< promotional image for the shiai (as url)
/** name of the table in the db holding the Shiai-s
*
* @var string
*/
private static $tableName = "wettkampfkalender";
public function __construct($id, $date, $name, $ageclasses, $place, $announcementUrl, $routeUrl, $galleryUrl, $promoImgUrl)
{
//! @todo input validation and sanitation
@@ -83,6 +89,17 @@ class Shiai
return self::fromDbArray($response[0]);
}
/** select shiai from the database
*
* - by default, only coming events will be returned
*/
public static function dbSelect(){
$query = "SELECT `".self::$tableName."`.* FROM `".self::$tableName."` WHERE `Datum` >= CURDATE();";
$response = dbConnector::query($query);
return $response;
}
public static function fromDbArray($member)
{
return new shiai(