Nut/tests/auto/common/post.h

46 lines
875 B
C
Raw Normal View History

2018-01-09 17:33:54 +08:00
#ifndef POST_H
#define POST_H
2016-05-12 14:08:58 +08:00
#include <QtCore/qglobal.h>
2018-02-17 23:44:39 +08:00
#include <QtCore/QDateTime>
2016-05-12 14:08:58 +08:00
#include "table.h"
#include "database.h"
#include "databasemodel.h"
2017-02-01 18:01:21 +08:00
#ifdef NUT_NAMESPACE
using namespace NUT_NAMESPACE;
#endif
2018-01-09 01:07:26 +08:00
class Comment;
2018-01-14 22:03:24 +08:00
class Score;
2016-05-12 14:08:58 +08:00
class Post : public Table
{
Q_OBJECT
NUT_PRIMARY_AUTO_INCREMENT(id)
NUT_DECLARE_FIELD(int, id, id, setId)
NUT_NOT_NULL(title)
NUT_LEN(title, 50)
NUT_DECLARE_FIELD(QString, title, title, setTitle)
2016-05-21 16:09:03 +08:00
NUT_DECLARE_FIELD(QDateTime, saveDate, saveDate, setSaveDate)
2016-05-12 14:08:58 +08:00
NUT_DECLARE_FIELD(QString, body, body, setBody)
2018-02-26 14:47:05 +08:00
NUT_DECLARE_FIELD(bool, isPublic, isPublic, setPublic)
2016-05-12 14:08:58 +08:00
NUT_DECLARE_CHILD_TABLE(Comment, comments)
2018-01-14 22:03:24 +08:00
NUT_DECLARE_CHILD_TABLE(Score, scores)
2016-05-12 14:08:58 +08:00
public:
2019-02-08 17:26:26 +08:00
Q_INVOKABLE Post(QObject *parentTableSet = nullptr);
2016-05-12 14:08:58 +08:00
signals:
public slots:
};
2018-01-09 00:59:16 +08:00
Q_DECLARE_METATYPE(Post*)
2018-01-09 17:33:54 +08:00
#endif // POST_H