mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 13:04:28 -04:00
Separate v1 and v2 server api classes and execution path.
This commit is contained in:
@ -0,0 +1,32 @@
|
||||
#include "readinglistscontroller_v2.h"
|
||||
|
||||
#include "db_helper.h"
|
||||
#include "reading_list.h"
|
||||
|
||||
ReadingListsControllerV2::ReadingListsControllerV2()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ReadingListsControllerV2::service(HttpRequest &request, HttpResponse &response)
|
||||
{
|
||||
response.setHeader("Content-Type", "text/plain; charset=utf-8");
|
||||
|
||||
QString path = QUrl::fromPercentEncoding(request.getPath()).toUtf8();
|
||||
QStringList pathElements = path.split('/');
|
||||
int libraryId = pathElements.at(3).toInt();
|
||||
|
||||
serviceContent(libraryId, response);
|
||||
|
||||
response.write("",true);
|
||||
}
|
||||
|
||||
void ReadingListsControllerV2::serviceContent(const int library, HttpResponse &response)
|
||||
{
|
||||
QList<ReadingList> readingLists = DBHelper::getReadingLists(library);
|
||||
|
||||
foreach(const ReadingList &item, readingLists)
|
||||
{
|
||||
response.write(QString("%1\t%2\t%3\r\n").arg(library).arg(item.getId()).arg(item.getName()).toUtf8());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user