Banking_System_Client  1.0.0
Qt-based banking app for user/admin account management, transactions, secure server communication via PostgreSQL/Supabase.
RequestManager Class Reference

Manages the creation and dispatching of requests in the system. More...

#include <RequestManager.h>

Inheritance diagram for RequestManager:
Inheritance graph
Collaboration diagram for RequestManager:
Collaboration graph

Public Types

enum  AvailableRequests {
  Login = 1 , GetAccountnumber , GetBalance , GetTransactionsHistory ,
  MakeTransaction , TransferAmount , GetDatabase , CreateNewUser ,
  DeleteUser , UpdateUser , UserInit , UpdateEmail ,
  UpdatePassword , JsonParseError = -1
}
 Defines the types of requests that can be created. More...
 

Signals

void makeRequest (QJsonObject Data)
 Signal emitted when a request is made. More...
 

Public Member Functions

 RequestManager (const RequestManager &)=delete
 
void operator= (const RequestManager &)=delete
 
void createRequest (AvailableRequests requestType, QVariantMap data)
 Creates a request based on the provided type and data. More...
 

Static Public Member Functions

static RequestManagergetInstance (QObject *parent=nullptr)
 Get the singleton instance of RequestManager. More...
 

Detailed Description

Manages the creation and dispatching of requests in the system.

The RequestManager class follows the Singleton design pattern to ensure that only one instance of the class exists throughout the application. It is responsible for creating various types of requests and emitting a signal to notify when a request is made.

The requests are defined by the AvailableRequests enum and include operations such as user login, account retrieval, balance checking, transaction history, and more. The requests are created in the form of QJsonObject and emitted via the makeRequest signal.

Member Enumeration Documentation

◆ AvailableRequests

Defines the types of requests that can be created.

Enumerator
Login 

User login request.

GetAccountnumber 

Request to get account number.

GetBalance 

Request to get account balance.

GetTransactionsHistory 

Request to get transaction history.

MakeTransaction 

Request to make a transaction.

TransferAmount 

Request to transfer an amount (not used for now)

GetDatabase 

Request to get the database.

CreateNewUser 

Request to create a new user.

DeleteUser 

Request to delete a user.

UpdateUser 

Request to update user information.

UserInit 

Request to initialize user.

UpdateEmail 

Request to update user email.

UpdatePassword 

Request to update user password.

JsonParseError 

Indicates a JSON parse error.

Member Function Documentation

◆ createRequest()

void RequestManager::createRequest ( AvailableRequests  requestType,
QVariantMap  data 
)

Creates a request based on the provided type and data.

Parameters
requestTypeThe type of request to create, defined by AvailableRequests enum.
dataThe data to be included in the request, in the form of QVariantMap.

Referenced by LoginWidget::onSuccessfullRequest().

Here is the caller graph for this function:

◆ getInstance()

RequestManager * RequestManager::getInstance ( QObject *  parent = nullptr)
static

Get the singleton instance of RequestManager.

Parameters
parentThe parent QObject, default is nullptr.
Returns
RequestManager* Pointer to the singleton instance.

◆ makeRequest

void RequestManager::makeRequest ( QJsonObject  Data)
signal

Signal emitted when a request is made.

Parameters
DataThe QJsonObject representing the request data.

Referenced by createRequest().

Here is the caller graph for this function:

The documentation for this class was generated from the following files: