mirror of
https://gitlab.com/spaceti-app/integrations/acs/colnod-connector.git
synced 2026-07-12 18:40:48 +02:00
65 lines
1.9 KiB
C++
65 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include "entity.h"
|
|
#include <QSet>
|
|
#include <qsqlquery.h>
|
|
#include <QVariant>
|
|
|
|
class Token : public Entity {
|
|
public:
|
|
// using Entity::Entity;
|
|
|
|
Token() = default;
|
|
Token(const QString& name, QString tokenData, const QString& decription = "mobile");
|
|
Token(const QString& name);
|
|
|
|
friend bool operator<(const Token &rToken, const Token &lToken){
|
|
return rToken.getLastModified() < lToken.getLastUpdate();
|
|
}
|
|
friend bool operator>(const Token &rToken, const Token &lToken){
|
|
return rToken.getLastModified() > lToken.getLastUpdate();
|
|
}
|
|
|
|
const QString &getTokenType() const;
|
|
void setTokenType(const QString &tokenType);
|
|
int getTokenBits() const;
|
|
void setTokenBits(int tokenBits);
|
|
const QString &getTokenData() const;
|
|
void setTokenData(const QString &tokenData);
|
|
quint64 getValidFrom() const;
|
|
void setValidFrom(quint64 validFrom);
|
|
quint64 getValidTo() const;
|
|
void setValidTo(quint64 validTo);
|
|
int getTimeToLive() const;
|
|
void setTimeToLive(int timeToLive);
|
|
int getAuthErrors() const;
|
|
void setAuthErrors(int authErrors);
|
|
const QSet<QString> &getFlags() const;
|
|
void setFlags(const QSet<QString> &flags);
|
|
const QUuid &getSubjectId() const;
|
|
void setSubjectId(const QUuid &subjectId);
|
|
quint64 getLastModified() const;
|
|
void setLastModified(const quint64 &lastModified);
|
|
bool getDeleted() const;
|
|
void setDeleted(const bool &deleted);
|
|
|
|
QString subjectIdToStringWithoutBraces();
|
|
|
|
void fromSQLRecord(QSqlQuery* query);
|
|
void fromJSON(const QJsonObject &json) override;
|
|
QJsonObject toJSON() const override;
|
|
|
|
private:
|
|
QString tokenType;
|
|
int tokenBits{};
|
|
QString tokenData;
|
|
qint64 validFrom{};
|
|
qint64 validTo{};
|
|
int timeToLive{};
|
|
int authErrors{};
|
|
QSet<QString> flags;
|
|
QUuid subjectId;
|
|
quint64 lastModified{};
|
|
bool deleted{};
|
|
};
|