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

The CreateNewUserRequest class handles the creation of new users. More...

#include <CreateNewUserRequest.h>

Inheritance diagram for CreateNewUserRequest:
Inheritance graph
Collaboration diagram for CreateNewUserRequest:
Collaboration graph

Public Member Functions

 CreateNewUserRequest ()
 Constructor for the CreateNewUserRequest class. More...
 
QJsonObject execute (const QJsonObject &jsonObj, QMutex &m) override
 Executes the request to create a new user. More...
 
- Public Member Functions inherited from Request
virtual ~Request ()
 Virtual destructor for the Request class. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Request
bool isDBConnectionValid (DB::DatabaseManager *dbManager)
 Checks if the database connection is valid. More...
 
QJsonObject CreateDBConnectionError (QJsonObject &response, QJsonObject &dataObj)
 Creates a JSON response indicating a database connection error. More...
 
QJsonObject CreateErrorResponse (QJsonObject &response, QJsonObject &dataObj, QString message)
 Creates a generic error JSON response. More...
 

Detailed Description

The CreateNewUserRequest class handles the creation of new users.

This class processes requests to create new users, ensuring that the request originates from an admin and that all required fields are provided. It also handles database operations for adding the new user and their account if applicable.

Constructor & Destructor Documentation

◆ CreateNewUserRequest()

CreateNewUserRequest::CreateNewUserRequest ( )
inline

Constructor for the CreateNewUserRequest class.

Initializes the DatabaseManager instance for handling database operations.

Member Function Documentation

◆ execute()

QJsonObject CreateNewUserRequest::execute ( const QJsonObject &  jsonObj,
QMutex &  m 
)
inlineoverridevirtual

Executes the request to create a new user.

This method processes the JSON request to create a new user. It validates the input data, checks the database connection, and ensures that the request is made by an admin. If all validations pass, it creates a new user and their account in the database.

Parameters
jsonObjA QJsonObject containing the request data.
mA QMutex reference for thread-safe operations.
Returns
A QJsonObject containing the response data.

or using QVariant lastId = dbManager->lastInsertedId();

Implements Request.

Here is the call graph for this function:

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