You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.4 KiB
44 lines
1.4 KiB
<?php
|
|
|
|
use IQBall\Core\Connection;
|
|
use IQBall\Core\Gateway\AccountGateway;
|
|
use IQBall\Core\Model\AuthModel;
|
|
|
|
$hostname = getHostName();
|
|
$front_url = "http://$hostname:5173";
|
|
|
|
const _SUPPORTS_FAST_REFRESH = true;
|
|
$_data_source_name = "sqlite:${_SERVER['DOCUMENT_ROOT']}/../dev-database.sqlite";
|
|
|
|
// no user and password needed for sqlite databases
|
|
const _DATABASE_USER = null;
|
|
const _DATABASE_PASSWORD = null;
|
|
|
|
function _asset(string $assetURI): string {
|
|
global $front_url;
|
|
return $front_url . "/" . $assetURI;
|
|
}
|
|
|
|
function _init_database(PDO $pdo): void {
|
|
$accounts = new AccountGateway(new Connection($pdo));
|
|
$teams = new \IQBall\Core\Gateway\TeamGateway((new Connection($pdo)));
|
|
|
|
$defaultAccounts = ["maxime", "mael", "yanis", "vivien"];
|
|
$defaultTeams = ["Lakers", "Celtics", "Bulls"];
|
|
|
|
|
|
foreach ($defaultAccounts as $name) {
|
|
$email = "$name@mail.com";
|
|
$id = $accounts->insertAccount($name, $email, AuthModel::generateToken(), password_hash("123456", PASSWORD_DEFAULT), "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png");
|
|
$accounts->setIsAdmin($id, true);
|
|
}
|
|
|
|
foreach ($defaultTeams as $name) {
|
|
$id = $teams->insert($name, "https://lebasketographe.fr/wp-content/uploads/2019/11/nom-equipes-nba.jpg", "#1a2b3c", "#FF00AA");
|
|
}
|
|
}
|
|
|
|
function _get_base_path(): string {
|
|
return "";
|
|
}
|