Files
yacreader/YACReaderLibrary/server/controllers/v2/librariescontroller_v2.cpp
luisangelsm 3709b6e737
Some checks failed
Build / Initialization (push) Has been cancelled
Build / Code Format Validation (push) Has been cancelled
Build / Linux (Qt6) (push) Has been cancelled
Build / Linux (Qt6 + 7zip) (push) Has been cancelled
Build / macOS (Qt6 Universal) (push) Has been cancelled
Build / Windows x64 (Qt6) (push) Has been cancelled
Build / Windows ARM64 (Qt6) (push) Has been cancelled
Build / Docker amd64 Image (push) Has been cancelled
Build / Docker arm64 Image (push) Has been cancelled
Build / Publish Dev Builds (push) Has been cancelled
Build / Publish Release (push) Has been cancelled
Build / Publish YACReader10 Pre-release Builds (push) Has been cancelled
Format includes using clang-format
2026-03-13 18:21:38 +01:00

34 lines
918 B
C++

#include "librariescontroller_v2.h"
#include "db_helper.h" //get libraries
#include "yacreader_libraries.h"
using stefanfrings::HttpRequest;
using stefanfrings::HttpResponse;
LibrariesControllerV2::LibrariesControllerV2() { }
void LibrariesControllerV2::service(HttpRequest & /* request */, HttpResponse &response)
{
response.setHeader("Content-Type", "application/json");
auto libraries = DBHelper::getLibraries().sortedLibraries();
QJsonArray librariesJson;
foreach (YACReaderLibrary library, libraries) {
QJsonObject libraryJson;
libraryJson["name"] = library.getName();
libraryJson["id"] = library.getLegacyId();
libraryJson["uuid"] = library.getId().toString();
librariesJson.append(libraryJson);
}
QJsonDocument output(librariesJson);
response.setStatus(200, "OK");
response.write(output.toJson(QJsonDocument::Compact), true);
}