Nut/test/common/post.h

42 lines
720 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>
#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;
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)
NUT_DECLARE_CHILD_TABLE(Comment, comments)
public:
2018-01-10 01:32:28 +08:00
Q_INVOKABLE Post(QObject *tableSet = 0);
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