forked from ondra/colnod-connector
60 lines
1.9 KiB
C++
60 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include <QSet>
|
|
|
|
#include "entity.h"
|
|
#include <QDebug>
|
|
#include <QPointer>
|
|
#include <QPair>
|
|
#include <QDateTime>
|
|
#include "serversdk/databasetable.h"
|
|
#include <qjsondocument.h>
|
|
|
|
class SubjectAttribute : public serversdk::DatabaseTable {
|
|
Q_OBJECT
|
|
TABLE_PROPERTY(QString, id, setId, "")
|
|
TABLE_PROPERTY(QString, attributeKey, setAttributeKey, "")
|
|
TABLE_PROPERTY(QString, attributeValue, setAttributeValue, "")
|
|
TABLE_PROPERTY(QString, subjectId, setSubjectId, "")
|
|
};
|
|
|
|
|
|
class Subject : public serversdk::DatabaseTable {
|
|
Q_OBJECT
|
|
TABLE_PROPERTY(QString, id, setId, QString())
|
|
TABLE_PROPERTY(QString, description, setDescription, "")
|
|
TABLE_PROPERTY(QDateTime, lastUpdate, setLastUpdate, QDateTime())
|
|
TABLE_PROPERTY(QString, name, setName, "")
|
|
TABLE_PROPERTY(QString, pin, setP, "")
|
|
TABLE_PROPERTY(QDateTime, lastModified, setLastModified, QDateTime())
|
|
TABLE_PROPERTY(bool, deleted, setDeleted, false)
|
|
|
|
|
|
public:
|
|
Subject() = default;
|
|
explicit Subject(const QString& name);
|
|
|
|
QByteArray jsonData() const override;
|
|
bool fromJson(const QByteArray &data) override;
|
|
|
|
const QJsonObject &getAttributes() const;
|
|
void setAttributes(const QJsonObject &attributes);
|
|
const QSet<QString> &getTokenFlags() const;
|
|
void setTokenFlags(const QSet<QString> &tokenFlags);
|
|
const QString &getPin() const;
|
|
void setPin(const QString &pin);
|
|
const QSet<QString> &getPinFlags() const;
|
|
void setPinFlags(const QSet<QString> &pinFlags);
|
|
|
|
const QList<QPair<QString, QString>> &getAtr() const;
|
|
void setAtr(const QList<QPair<QString, QString>> &atr);
|
|
|
|
private:
|
|
QList<std::shared_ptr <SubjectAttribute>> attributes;
|
|
QSet<QString> tokenFlags;
|
|
QSet<QString> pinFlags;
|
|
QList<QPair<QString, QString>> atr;
|
|
const QList<QString> attributeTypes = {"Jmeno", "Prijmeni", "ProfilParking", "Spolecnost", "Profil", "spz"};
|
|
|
|
};
|