Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 26 additions & 20 deletions Interfaces/AAA/AAADefs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ namespace tblUser {
TARGOMAN_CREATE_CONSTEXPR(usrPass);
TARGOMAN_CREATE_CONSTEXPR(usr_rolID);
TARGOMAN_CREATE_CONSTEXPR(usrSpecialPrivs);
TARGOMAN_CREATE_CONSTEXPR(usrSSID);
TARGOMAN_CREATE_CONSTEXPR(usrAddress);
TARGOMAN_CREATE_CONSTEXPR(usrLanguage);
TARGOMAN_CREATE_CONSTEXPR(usrEnableEmailAlerts);
TARGOMAN_CREATE_CONSTEXPR(usrEnableSMSAlerts);
Expand All @@ -113,29 +115,31 @@ namespace tblUser {

namespace Private {
const QList<clsORMField> ORMFields = {
///ColName Type Validation Default UpBy Sort Filter Self Virt PK
//ColName Type Validation Default UpBy Sort Filter Self Virt PK
//ORM_PRIMARYKEY_64 with self:true
{ Fields::usrID, S(quint64), QFV.integer().minValue(1), QAuto, UPNone, true, true, true, false, true },
{ Fields::usrEmail, S(TAPI::Email_t), QFV.emailNotFake(), QNull, UPOwner },
{ Fields::usrName, S(QString), QFV.unicodeAlNum().maxLenght(128), QNull, UPOwner },
{ Fields::usrFamily, S(QString), QFV.unicodeAlNum().maxLenght(128), QNull, UPOwner },
{ Fields::usrGender, S(TAPI::enuGender::Type), QFV, TAPI::enuGender::NotExpressed, UPOwner },
{ Fields::usrMobile, S(TAPI::Mobile_t), QFV, QNull, UPOwner },
{ Fields::usrApprovalState, S(TAPI::enuUserApproval::Type), QFV, TAPI::enuUserApproval::None },
{ Fields::usrID, S(quint64), QFV.integer().minValue(1), QAuto, UPNone, true, true, true, false, true },
{ Fields::usrEmail, S(TAPI::Email_t), QFV.emailNotFake(), QNull, UPOwner },
{ Fields::usrName, S(QString), QFV.unicodeAlNum().maxLenght(128), QNull, UPOwner },
{ Fields::usrFamily, S(QString), QFV.unicodeAlNum().maxLenght(128), QNull, UPOwner },
{ Fields::usrGender, S(TAPI::enuGender::Type), QFV, TAPI::enuGender::NotExpressed, UPOwner },
{ Fields::usrMobile, S(TAPI::Mobile_t), QFV, QNull, UPOwner },
{ Fields::usrApprovalState, S(TAPI::enuUserApproval::Type), QFV, TAPI::enuUserApproval::None },
//usrPass : not define here
{ Fields::usr_rolID, S(quint32), QFV.integer().minValue(1), QRequired, UPAdmin },
{ Fields::usrSpecialPrivs, S(TAPI::PrivObject_t), QFV, QNull, UPAdmin, false, false },
{ Fields::usrLanguage, S(QString), QFV.languageCode(), "fa", UPOwner },
{ Fields::usrEnableEmailAlerts, S(bool), QFV, true, UPOwner },
{ Fields::usrEnableSMSAlerts, S(bool), QFV, true, UPOwner },
{ Fields::usrMaxSessions, S(qint32), QFV.integer().betweenValues(-1, 100), -1, UPAdmin },
{ Fields::usrActiveSessions, S(qint32), QFV.integer().betweenValues(-1, 1000), QInvalid, UPNone },
{ Fields::usrLastLogin, S(TAPI::DateTime_t), QFV, QInvalid, UPNone },
{ Fields::usrStatus, ORM_STATUS_FIELD(TAPI::enuUserStatus, TAPI::enuUserStatus::MustValidate) },
{ Fields::usr_rolID, S(quint32), QFV.integer().minValue(1), QRequired, UPAdmin },
{ Fields::usrSpecialPrivs, S(TAPI::PrivObject_t), QFV, QNull, UPAdmin, false, false },
{ Fields::usrSSID, S(QString), QFV.unicodeAlNum().maxLenght(10), QNull, UPOwner },
{ Fields::usrAddress, S(QString), QFV.unicodeAlNum().maxLenght(1024), QNull, UPOwner },
{ Fields::usrLanguage, S(QString), QFV.languageCode(), "fa", UPOwner },
{ Fields::usrEnableEmailAlerts, S(bool), QFV, true, UPOwner },
{ Fields::usrEnableSMSAlerts, S(bool), QFV, true, UPOwner },
{ Fields::usrMaxSessions, S(qint32), QFV.integer().betweenValues(-1, 100), -1, UPAdmin },
{ Fields::usrActiveSessions, S(qint32), QFV.integer().betweenValues(-1, 1000), QInvalid, UPNone },
{ Fields::usrLastLogin, S(TAPI::DateTime_t), QFV, QInvalid, UPNone },
{ Fields::usrStatus, ORM_STATUS_FIELD(TAPI::enuUserStatus, TAPI::enuUserStatus::MustValidate) },
{ ORM_INVALIDATED_AT_FIELD },
{ Fields::usrCreationDateTime, ORM_CREATED_ON },
{ Fields::usrCreatedBy_usrID, ORM_CREATED_BY_NULLABLE },
{ Fields::usrUpdatedBy_usrID, ORM_UPDATED_BY },
{ Fields::usrCreationDateTime, ORM_CREATED_ON },
{ Fields::usrCreatedBy_usrID, ORM_CREATED_BY_NULLABLE },
{ Fields::usrUpdatedBy_usrID, ORM_UPDATED_BY },
};

///Col Reference Table ForeignCol Rename LeftJoin
Expand Down Expand Up @@ -170,6 +174,8 @@ namespace tblUser {
SF_Enum (usrApprovalState, TAPI::enuUserApproval, TAPI::enuUserApproval::None),
SF_quint32 (usr_rolID),
SF_JSON_t (usrSpecialPrivs),
SF_QString (usrSSID),
SF_QString (usrAddress),
SF_QString (usrLanguage),
SF_bool (usrEnableEmailAlerts),
SF_bool (usrEnableSMSAlerts),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* Migration File: m20220907_162657_AAA_add_ssid_and_address_to_user.sql */
/* CAUTION: don't forget to use {{dbprefix}} for schemas */

USE `{{dbprefix}}{{Schema}}`;

ALTER TABLE `tblUser`
ADD COLUMN `usrSSID` VARCHAR(10) NULL DEFAULT NULL AFTER `usrSpecialPrivs`,
ADD COLUMN `usrAddress` VARCHAR(1024) NULL DEFAULT NULL AFTER `usrSSID`;
8 changes: 7 additions & 1 deletion Modules/Account/moduleSrc/ORM/User.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ QVariant IMPL_ORMGET_USER(User) {
tblUser::Fields::usrApprovalState,
tblUser::Fields::usr_rolID,
// tblUser::Fields::usrSpecialPrivs,
tblUser::Fields::usrSSID,
tblUser::Fields::usrAddress,
tblUser::Fields::usrLanguage,
tblUser::Fields::usrEnableEmailAlerts,
tblUser::Fields::usrEnableSMSAlerts,
Expand Down Expand Up @@ -299,7 +301,9 @@ bool IMPL_REST_UPDATE(User, personalInfo, (
TAPI::ISO639_2_t _language,
NULLABLE_TYPE(TAPI::enuGender::Type) _gender,
NULLABLE_TYPE(bool) _enableEmailAlerts,
NULLABLE_TYPE(bool) _enableSMSAlerts
NULLABLE_TYPE(bool) _enableSMSAlerts,
QString _ssid,
QString _address
)) {
quint64 CurrentUserID = APICALLBOOM_PARAM.getActorID();

Expand All @@ -311,6 +315,8 @@ bool IMPL_REST_UPDATE(User, personalInfo, (
if (NULLABLE_HAS_VALUE(_gender)) ToUpdate.insert(tblUser::Fields::usrGender, *_gender);
if (NULLABLE_HAS_VALUE(_enableEmailAlerts)) ToUpdate.insert(tblUser::Fields::usrEnableEmailAlerts, *_enableEmailAlerts ? 1 : 0);
if (NULLABLE_HAS_VALUE(_enableSMSAlerts)) ToUpdate.insert(tblUser::Fields::usrEnableSMSAlerts, *_enableSMSAlerts ? 1 : 0);
if (_ssid.isNull() == false) ToUpdate.insert(tblUser::Fields::usrSSID, _ssid);
if (_address.isNull() == false) ToUpdate.insert(tblUser::Fields::usrAddress, _address);

if (ToUpdate.size())
this->Update(APICALLBOOM_PARAM,
Expand Down
4 changes: 3 additions & 1 deletion Modules/Account/moduleSrc/ORM/User.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ private slots:
TAPI::ISO639_2_t _language = {},
NULLABLE_TYPE(TAPI::enuGender::Type) _gender = NULLABLE_NULL_VALUE,
NULLABLE_TYPE(bool) _enableEmailAlerts = NULLABLE_NULL_VALUE,
NULLABLE_TYPE(bool) _enableSMSAlerts = NULLABLE_NULL_VALUE
NULLABLE_TYPE(bool) _enableSMSAlerts = NULLABLE_NULL_VALUE,
QString _ssid = {},
QString _address = {}
),
"Update User personal info"
)
Expand Down