47 lines
1.5 KiB
C
47 lines
1.5 KiB
C
|
#ifndef APISERVER_H
|
||
|
#define APISERVER_H
|
||
|
|
||
|
#include <QCoreApplication>
|
||
|
#include <QHttpServer>
|
||
|
#include <QHttpServerResponse>
|
||
|
#include <QJsonDocument>
|
||
|
#include <QJsonObject>
|
||
|
#include <QJsonArray>
|
||
|
|
||
|
#include "service/businesslogic/devicelogic.h"
|
||
|
#include "service/businesslogic/departmentlogic.h"
|
||
|
#include "service/businesslogic/devicemodellogic.h"
|
||
|
#include "service/businesslogic/devicetypelogic.h"
|
||
|
#include "service/businesslogic/locationlogic.h"
|
||
|
#include "service/businesslogic/manufacturerlogic.h"
|
||
|
|
||
|
class ApiServer
|
||
|
{
|
||
|
public:
|
||
|
ApiServer();
|
||
|
void start(ServiceLoadDB *serviceDB);
|
||
|
|
||
|
private:
|
||
|
QHttpServer server;
|
||
|
|
||
|
DeviceLogic *deviceLogic;
|
||
|
DepartmentLogic *departmentLogic;
|
||
|
DeviceModelLogic *deviceModelLogic;
|
||
|
DeviceTypeLogic *deviceTypeLogic;
|
||
|
LocationLogic *locationLogic;
|
||
|
ManufacturerLogic *manufacturerLogic;
|
||
|
|
||
|
QHttpServerResponse handleGetFilteredDevices(const QHttpServerRequest &request);
|
||
|
QHttpServerResponse handleGetAllDepartments(const QHttpServerRequest &request);
|
||
|
QHttpServerResponse handleGetAllDeviceModels(const QHttpServerRequest &request);
|
||
|
QHttpServerResponse handleGetAllDeviceTypes(const QHttpServerRequest &request);
|
||
|
QHttpServerResponse handleGetAllLocations(const QHttpServerRequest &request);
|
||
|
QHttpServerResponse handleGetAllManufacturers(const QHttpServerRequest &request);
|
||
|
QHttpServerResponse handleUpdateDevice(int id, const QHttpServerRequest &request);
|
||
|
|
||
|
template <typename T>
|
||
|
QJsonArray createJsonArray(const QMap<int, T> &items);
|
||
|
};
|
||
|
|
||
|
#endif // APISERVER_H
|