Compare commits
No commits in common. "cfa750aff2518d35be6a9f2d60a672a61328f77d" and "cc989e96f7e60694872904b9c34bf52f221f6a45" have entirely different histories.
cfa750aff2
...
cc989e96f7
@ -8,7 +8,11 @@ DB_NAME=template
|
|||||||
DB_NAME_LOG=log
|
DB_NAME_LOG=log
|
||||||
|
|
||||||
# API Keys
|
# API Keys
|
||||||
TEMPLATE_API_KEY=
|
AUTH_API_KEY=
|
||||||
|
NOTIFICATION_API_KEY=
|
||||||
|
FILE_API_KEY=
|
||||||
|
HOMEPAGE_API_KEY=
|
||||||
|
BEE_API_KEY=
|
||||||
|
|
||||||
# Template Setup
|
# Template Setup
|
||||||
INIT_USER_NAME=admin
|
INIT_USER_NAME=admin
|
||||||
|
|||||||
@ -3,7 +3,26 @@
|
|||||||
return [
|
return [
|
||||||
'api' => [
|
'api' => [
|
||||||
'keys' => [
|
'keys' => [
|
||||||
'template' => $_ENV['TEMPLATE_API_KEY'],
|
'template' => $_ENV['HOMEPAGE_API_KEY'],
|
||||||
|
'notification' => $_ENV['NOTIFICATION_API_KEY'],
|
||||||
|
],
|
||||||
|
|
||||||
|
'services' => [
|
||||||
|
'template' => [
|
||||||
|
'host' => 'template-backend-nginx',
|
||||||
|
'apis' => [
|
||||||
|
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'notification' => [
|
||||||
|
'host' => 'notification-backend-nginx',
|
||||||
|
'apis' => [
|
||||||
|
'send-mail' => [
|
||||||
|
'path' => '/api/mail/send',
|
||||||
|
'method' => 'POST'
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -44,7 +44,7 @@
|
|||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div id="title" class="title">
|
<div id="title" class="title">
|
||||||
<img src="assets/icon.png" />
|
<img src="assets/icon.png" />
|
||||||
<h1>Template</h1>
|
<h1>Beekeeper</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -57,7 +57,7 @@
|
|||||||
<p>Wenn du dein Passwort nicht zurückgesetzt hast, kannst du diese Nachricht ignorieren!</p>
|
<p>Wenn du dein Passwort nicht zurückgesetzt hast, kannst du diese Nachricht ignorieren!</p>
|
||||||
<br />
|
<br />
|
||||||
<p>Mit fleißigen Grüßen,</p>
|
<p>Mit fleißigen Grüßen,</p>
|
||||||
<p>Der Template</p>
|
<p>Der Beekeeper</p>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
31
data/migrations/template/Version20241130201314.php
Normal file
31
data/migrations/template/Version20241130201314.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Template\Migrations\Template;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20241130201314 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'rename status and thermometer to reference location';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql("RENAME TABLE `thermometer` TO `location_thermometer`");
|
||||||
|
$this->addSql("RENAME TABLE `status` TO `location_status`");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql("RENAME TABLE `location_thermometer` TO `thermometer`");
|
||||||
|
$this->addSql("RENAME TABLE `location_status` TO `status`");
|
||||||
|
}
|
||||||
|
}
|
||||||
77
data/migrations/template/Version20241130202949.php
Normal file
77
data/migrations/template/Version20241130202949.php
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Template\Migrations\Template;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20241130202949 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'update procedure to last migration';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql("DROP PROCEDURE pS_LOCATION_ThermometerHistoryGraphList");
|
||||||
|
$this->addSql("
|
||||||
|
CREATE PROCEDURE pS_LOCATION_ThermometerHistoryGraphList (
|
||||||
|
IN locaiton_id BINARY(16),
|
||||||
|
IN start_at DATETIME,
|
||||||
|
IN end_at DATETIME,
|
||||||
|
IN `interval` int
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
SELECT
|
||||||
|
FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(created_at) / (`interval` * 60)) * (`interval` * 60)) AS time_interval,
|
||||||
|
ROUND(AVG(temperature),1) AS avg_temperature,
|
||||||
|
ROUND(AVG(humidity)) AS avg_humidity
|
||||||
|
FROM
|
||||||
|
location_thermometer
|
||||||
|
WHERE
|
||||||
|
locaiton_id = locaiton_id AND
|
||||||
|
(created_at >= COALESCE(start_at, '1970-01-01 00:00:00')) AND
|
||||||
|
(created_at <= COALESCE(end_at, NOW()))
|
||||||
|
GROUP BY
|
||||||
|
time_interval
|
||||||
|
ORDER BY
|
||||||
|
time_interval ASC;
|
||||||
|
END;
|
||||||
|
");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql("DROP PROCEDURE pS_LOCATION_ThermometerHistoryGraphList");
|
||||||
|
$this->addSql("
|
||||||
|
CREATE PROCEDURE pS_LOCATION_ThermometerHistoryGraphList (
|
||||||
|
IN locaiton_id BINARY(16),
|
||||||
|
IN start_at DATETIME,
|
||||||
|
IN end_at DATETIME,
|
||||||
|
IN `interval` int
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
SELECT
|
||||||
|
FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(created_at) / (`interval` * 60)) * (`interval` * 60)) AS time_interval,
|
||||||
|
ROUND(AVG(temperature),1) AS avg_temperature,
|
||||||
|
ROUND(AVG(humidity)) AS avg_humidity
|
||||||
|
FROM
|
||||||
|
thermometer
|
||||||
|
WHERE
|
||||||
|
locaiton_id = locaiton_id AND
|
||||||
|
(created_at >= COALESCE(start_at, '1970-01-01 00:00:00')) AND
|
||||||
|
(created_at <= COALESCE(end_at, NOW()))
|
||||||
|
GROUP BY
|
||||||
|
time_interval
|
||||||
|
ORDER BY
|
||||||
|
time_interval ASC;
|
||||||
|
END;
|
||||||
|
");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -18,7 +18,7 @@ class RequestServiceFactory implements FactoryInterface
|
|||||||
{
|
{
|
||||||
/** @var ConfigService $configService */
|
/** @var ConfigService $configService */
|
||||||
$configService = $container->get(ConfigService::class);
|
$configService = $container->get(ConfigService::class);
|
||||||
$apiKey = $configService->resolve("api.keys.template");
|
$apiKey = $configService->resolve("api.keys.Template");
|
||||||
|
|
||||||
return new RequestService(
|
return new RequestService(
|
||||||
$apiKey,
|
$apiKey,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user