Билдим с odb из redkitty
This commit is contained in:
@@ -5,10 +5,11 @@
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
|
||||
#include <database/author_s-odb.hxx> // Должен быть здесь
|
||||
#include <database/author_s.h>
|
||||
#include <database/book_s-odb.hxx> // Должен быть здесь
|
||||
#include <database/book_s.h>
|
||||
|
||||
#include "database/book_s-odb.hxx"
|
||||
|
||||
#include <odb/core.hxx>
|
||||
#include <odb/database.hxx>
|
||||
#include <odb/query.hxx>
|
||||
@@ -57,6 +58,7 @@ QByteArray RestApiServer::processRequest(const QString& request)
|
||||
{
|
||||
QString author = request.section(' ', 1, 1).section('/', 3, 3).replace("%20", " ");
|
||||
|
||||
qWarning() << "THIS";
|
||||
// Books books;
|
||||
// QList<BookRecord> results = books.getBooksByAuthor(author);
|
||||
|
||||
@@ -72,7 +74,7 @@ QByteArray RestApiServer::processRequest(const QString& request)
|
||||
// }
|
||||
// if (results.size() > 0)
|
||||
// jsonResponse.chop(1); // Убираем последнюю запятую
|
||||
// jsonResponse += "] }";
|
||||
jsonResponse += "] }";
|
||||
|
||||
return "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n" + jsonResponse;
|
||||
}
|
||||
@@ -90,8 +92,8 @@ QByteArray RestApiServer::processRequest(const QString& request)
|
||||
|
||||
QJsonObject j;
|
||||
j["id"] = QString::number(book.id());
|
||||
j["title"] = QString::fromStdString(book.name());
|
||||
j["author"] = QString::fromStdString(book.author()->full_name());
|
||||
j["title"] = book.name();
|
||||
j["author"] = book.author()->full_name();
|
||||
j["year"] = book.year();
|
||||
jArray.push_back(j);
|
||||
}
|
||||
@@ -115,8 +117,8 @@ QByteArray RestApiServer::processRequest(const QString& request)
|
||||
|
||||
QJsonObject j;
|
||||
j["id"] = QString::number(author.id());
|
||||
j["first"] = QString::fromStdString(author.first());
|
||||
j["last"] = QString::fromStdString(author.last());
|
||||
j["first"] = author.first();
|
||||
j["last"] = author.last();
|
||||
j["age"] = author.age();
|
||||
jArray.push_back(j);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user