Compare commits

...

3 Commits

Author SHA1 Message Date
flo
cfa750aff2 api keys change 2025-01-01 23:45:37 +01:00
flo
7a96e5175d deleted weedkeeper migrations 2025-01-01 23:41:04 +01:00
flo
56fa3c512e beekeeper -> template 2025-01-01 23:39:34 +01:00
6 changed files with 5 additions and 136 deletions

View File

@ -8,11 +8,7 @@ DB_NAME=template
DB_NAME_LOG=log DB_NAME_LOG=log
# API Keys # API Keys
AUTH_API_KEY= TEMPLATE_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

View File

@ -3,26 +3,7 @@
return [ return [
'api' => [ 'api' => [
'keys' => [ 'keys' => [
'template' => $_ENV['HOMEPAGE_API_KEY'], 'template' => $_ENV['TEMPLATE_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'
],
],
],
], ],
], ],
]; ];

View File

@ -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>Beekeeper</h1> <h1>Template</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 Beekeeper</p> <p>Der Template</p>
</div> </div>
</body> </body>
</html> </html>

View File

@ -1,31 +0,0 @@
<?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`");
}
}

View File

@ -1,77 +0,0 @@
<?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;
");
}
}

View File

@ -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,