2025-03-16 10:46:06 +05:00
|
|
|
#ifndef BOOK_S_H
|
|
|
|
|
#define BOOK_S_H
|
|
|
|
|
|
2025-08-04 20:51:24 +05:00
|
|
|
#include "model_global.h"
|
2025-03-16 10:46:06 +05:00
|
|
|
|
2025-08-04 22:15:23 +05:00
|
|
|
#include <QDateTime>
|
2025-03-16 10:46:06 +05:00
|
|
|
|
|
|
|
|
#include "author_s.h"
|
2025-08-04 22:15:23 +05:00
|
|
|
#include "genre_s.h"
|
|
|
|
|
#include "series_s.h"
|
|
|
|
|
|
|
|
|
|
struct Book_SZ
|
|
|
|
|
{
|
|
|
|
|
SH<Author_S> author;
|
|
|
|
|
QString title;
|
|
|
|
|
SH<Series_S> series;
|
|
|
|
|
quint8 year;
|
|
|
|
|
SH<Genre_S> genre;
|
|
|
|
|
QDateTime lastModified = QDateTime::currentDateTime();
|
|
|
|
|
QString lang;
|
|
|
|
|
};
|
2025-03-16 10:46:06 +05:00
|
|
|
|
|
|
|
|
#pragma db object
|
2025-08-04 20:51:24 +05:00
|
|
|
class MODEL_EXPORT Book_S
|
2025-03-16 10:46:06 +05:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
Book_S() = default;
|
2025-08-04 22:15:23 +05:00
|
|
|
Book_S(const Book_SZ& book)
|
2025-03-16 10:46:06 +05:00
|
|
|
{
|
2025-08-04 22:15:23 +05:00
|
|
|
m_author = book.author;
|
|
|
|
|
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; }
|
2025-03-16 10:46:06 +05:00
|
|
|
|
|
|
|
|
SH<Author_S> author() const { return m_author; }
|
2025-08-04 22:15:23 +05:00
|
|
|
void setAuthor(const SH<Author_S>& newAuthor) { m_author = newAuthor; }
|
|
|
|
|
|
|
|
|
|
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; }
|
2025-03-16 10:46:06 +05:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
friend class odb::access;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
#pragma db id auto
|
|
|
|
|
quint64 m_id;
|
|
|
|
|
|
|
|
|
|
SH<Author_S> m_author;
|
2025-08-04 22:15:23 +05:00
|
|
|
QString m_title;
|
|
|
|
|
SH<Series_S> m_series;
|
2025-03-16 10:46:06 +05:00
|
|
|
quint8 m_year;
|
2025-08-04 22:15:23 +05:00
|
|
|
SH<Genre_S> m_genre;
|
|
|
|
|
QDateTime m_lastModified;
|
|
|
|
|
QString m_lang;
|
2025-03-16 10:46:06 +05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// #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
|