Rewrite electricity server to .NET web api

This commit is contained in:
2022-07-01 21:15:31 +02:00
parent b8387dfa1d
commit 642170172a
22 changed files with 354 additions and 509 deletions

View File

@@ -1,10 +0,0 @@
#pragma once
#include <pistache/http.h>
#include <pistache/router.h>
namespace Server::Api
{
void GetDay(Pistache::Http::Request const & request, Pistache::Http::ResponseWriter responseWrite);
void SetupRouting(Pistache::Rest::Router & router);
}

View File

@@ -1,33 +0,0 @@
#pragma once
#include <chrono>
#include <mutex>
#include <string>
namespace Server
{
class Configuration {
private:
std::string logDirectory;
std::string serverDomain;
std::string lastExternalIp;
std::chrono::time_point<std::chrono::steady_clock> lastIpCheckTimePoint;
std::mutex externalIpRefreshMutex;
Configuration();
Configuration(Configuration & other) = delete;
Configuration(Configuration && other) = delete;
Configuration & operator=(Configuration & other) = delete;
Configuration & operator=(Configuration && other) = delete;
void RefreshExternalIp();
bool ExternalIpRequiresRefresh() const;
public:
void Setup(std::string & electricityLogDirectory, std::string const & serverDomain);
std::string const & GetLogDirectory() const;
std::string const & GetExternalServerIp();
static Configuration & Get();
};
}

View File

@@ -1,8 +0,0 @@
#include <string>
#include <util/date.hpp>
namespace Server::Database
{
std::string GetDetailedJsonOf(Util::Date const & date);
std::string GetSummaryJsonOf(Util::Date const & startDate, Util::Date const & stopDate);
}