Nut/test/common/user.h

41 lines
762 B
C
Raw Normal View History

2018-01-09 00:59:16 +08:00
#ifndef USER_H
#define USER_H
#include "table.h"
#include "tableset.h"
2018-01-09 05:44:01 +08:00
#include <QtCore/QUuid>
#include <QtCore/QString>
2018-01-09 00:59:16 +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;
2018-01-09 05:44:01 +08:00
class User : public Nut::Table
2018-01-09 00:59:16 +08:00
{
Q_OBJECT
2018-04-08 23:16:44 +08:00
NUT_PRIMARY_KEY(id)
NUT_DECLARE_FIELD(QUuid, id, id, setId)
2018-01-09 00:59:16 +08:00
NUT_NOT_NULL(username)
NUT_LEN(username, 50)
NUT_DECLARE_FIELD(QString, username, username, setUsername)
NUT_NOT_NULL(password)
NUT_LEN(password, 50)
NUT_DECLARE_FIELD(QString, password, password, setPassword)
NUT_DECLARE_CHILD_TABLE(Comment, comments)
2018-01-14 22:03:24 +08:00
NUT_DECLARE_CHILD_TABLE(Score, scores)
2018-01-09 00:59:16 +08:00
public:
2018-01-15 06:12:46 +08:00
Q_INVOKABLE User(QObject *parentTableSet = 0);
2018-01-09 00:59:16 +08:00
};
Q_DECLARE_METATYPE(User*)
#endif // USER_H