1
0
forked from BRT/arc
arc/database/dao/BankProfileDAO.h

67 lines
2.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include "db/BankProfileInfo.h"
class BankProfileDAO {
public:
[[nodiscard]] static bool upsertApplication(const BankProfileInfo &info);
[[nodiscard]] static bool updatePinCode(const QString &appId, const QString &pinCode);
[[nodiscard]] static bool update(
const int &appId,
const QString &pinCode,
const QString &comment,
const QString &status
);
[[nodiscard]] static bool updatePinCodeStatus(
const int &appId,
const QString &pinCodeStatus,
const QString &comment
);
[[nodiscard]] static bool updateComment(int appId, const QString &comment);
[[nodiscard]] static bool updateProfileInfo(
const int &appId,
const QString &fullName,
const QString &phone,
const QString &email = ""
);
[[nodiscard]] static bool updateBankProfileId(int appId, const QString &bankProfileId);
[[nodiscard]] static QList<BankProfileInfo> findAllByBankProfileId(const QString &bankProfileId);
[[nodiscard]] static bool updateAmount(int appId, double amount);
// Атомарно вычитает delta из bank_profiles.amount.
// delta > 0 — расход, delta < 0 — пополнение.
[[nodiscard]] static bool adjustAmount(int appId, double delta);
[[nodiscard]] static bool updateAppVersion(int appId, const QString &appVersion);
[[nodiscard]] static BankProfileInfo getApplication(const QString &deviceId, const QString &appCode);
[[nodiscard]] static QList<BankProfileInfo> getApplicationsByDeviceId(const QString &deviceId);
[[nodiscard]] static QList<BankProfileInfo> getAllApplicationsByDeviceId(const QString &deviceId);
[[nodiscard]] static bool checkInstalledApps(const QString &deviceId, const QSet<QString> &apps);
[[nodiscard]] static QStringList getActiveBankProfileIds();
[[nodiscard]] static bool activateAppsForDevice(const QString &deviceId);
[[nodiscard]] static bool deactivateAppsForDevice(const QString &deviceId);
// Деактивирует ВСЕ установленные профили (status='off'). Используется при
// выключении приложения (graceful shutdown) — гасим профили и локально.
[[nodiscard]] static bool deactivateAllApps();
[[nodiscard]] static bool migrateDeviceId(const QString &oldDeviceId, const QString &newDeviceId);
[[nodiscard]] static bool deleteProfile(const QString &deviceId, const QString &appCode);
};