Files
cpp-opds/src/model/book_s.h

91 lines
2.1 KiB
C
Raw Normal View History

#ifndef BOOK_S_H
#define BOOK_S_H
#include "model_global.h"
#include <QDateTime>
#include "author_s.h"
#include "genre_s.h"
#include "series_s.h"
struct Book_SZ
{
QString title;
SH<Series_S> series;
quint8 year;
SH<Genre_S> genre;
QDateTime lastModified = QDateTime::currentDateTime();
QString lang;
};
#pragma db object
class MODEL_EXPORT Book_S
{
public:
Book_S() = default;
Book_S(const Book_SZ& book)
{
m_title = book.title;
m_series = book.series;
m_year = book.year;
m_genre = book.genre;
m_lastModified = book.lastModified;
m_lang = book.lang;
}
quint64 id() const { return m_id; }
void setId(const quint64& newId) { m_id = newId; }
QString title() const { return m_title; }
void setTitle(const QString& newTitle) { m_title = newTitle; }
SH<Series_S> series() const { return m_series; }
void setSeries(const SH<Series_S>& newSeries) { m_series = newSeries; }
quint8 year() const { return m_year; }
void setYear(const quint8& newYear) { m_year = newYear; }
SH<Genre_S> genre() const { return m_genre; }
void setGenre(const SH<Genre_S>& newGenre) { m_genre = newGenre; }
QDateTime lastModified() const { return m_lastModified; }
void setLastModified(const QDateTime& newLastModified) { m_lastModified = newLastModified; }
QString lang() const { return m_lang; }
void setLang(const QString& newLang) { m_lang = newLang; }
private:
friend class odb::access;
// public: // for Redkit-gen
private:
#pragma db id auto
quint64 m_id;
QString m_title;
SH<Series_S> m_series;
quint8 m_year;
SH<Genre_S> m_genre;
QDateTime m_lastModified;
QString m_lang;
};
// #pragma db view object(Book_S) object(Author_S = author:Book_S::m_author)
// struct BookByAuthorView
// {
// #pragma db column(Book_S::m_id)
// quint64 book_id;
// #pragma db column(Book_S::m_name)
// QString book_name;
// #pragma db column(Book_S::m_year)
// qint8 year;
// #pragma db column(Author_S::m_first + " " + Author_S::m_last)
// QString author_full_name;
// };
#endif // BOOK_S_H