![]() |
Banking_System_Server
1.0.0
Qt-based banking app for user/admin account management, transactions, secure server communication via PostgreSQL/Supabase.
|
The RequestManager class handles incoming requests and dispatches them to the appropriate request handler. More...
#include <RequestManager.h>
Public Types | |
enum | AvailableRequests { Login = 1 , GetAccountnumber , GetBalance , GetTransactionsHistory , MakeTransaction , TransferAmount , GetDatabase , CreateNewUser , DeleteUser , UpdateUser , UserInit , UpdateEmail , UpdatePassword , JsonParseError = -1 } |
Enum representing the different types of requests handled by the RequestManager. More... | |
Public Member Functions | |
RequestManager (QMutex *Mutex) | |
Constructs a RequestManager with the specified mutex for thread safety. More... | |
QByteArray | makeRequest (QByteArray data) |
Processes an incoming request and generates an appropriate response. More... | |
~RequestManager () | |
Destructor for the RequestManager. More... | |
The RequestManager class handles incoming requests and dispatches them to the appropriate request handler.
The RequestManager class is responsible for managing and processing different types of requests. It maintains a map of request handlers for various request types, processes incoming request data, and generates appropriate responses. The class also includes error handling for JSON parsing issues.
Enum representing the different types of requests handled by the RequestManager.
This enum defines various request types and special requests that the RequestManager can handle.
Enumerator | |
---|---|
Login | Request for user login. |
GetAccountnumber | Request to retrieve account number. |
GetBalance | Request to get account balance. |
GetTransactionsHistory | Request to retrieve transaction history. |
MakeTransaction | Request to make a transaction. |
TransferAmount | Request to transfer amount (not used currently). |
GetDatabase | Request to get database information. |
CreateNewUser | Request to create a new user. |
DeleteUser | Request to delete a user. |
UpdateUser | Request to update user information. |
UserInit | Special request for user initialization. |
UpdateEmail | Special request to update user email. |
UpdatePassword | Special request to update user password. |
JsonParseError | Special error code for JSON parsing errors. |
|
inline |
Constructs a RequestManager with the specified mutex for thread safety.
Mutex | A pointer to a QMutex used to ensure thread-safe operations. |
|
inline |
Destructor for the RequestManager.
Cleans up any resources allocated by the RequestManager.
|
inline |
Processes an incoming request and generates an appropriate response.
data | A QByteArray containing the request data in JSON format. |
This method parses the incoming JSON data, determines the type of request, and delegates the processing to the corresponding request handler. It also handles JSON parsing errors and generates error responses if needed.
Referenced by ServerHandler::readyRead().