1 Commits

25 changed files with 257 additions and 53 deletions
@@ -1,4 +1,12 @@
/*
* File: Trenser.Zenvy.cpp
* Description: Zenvy Main
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "UserInterface.h" #include "UserInterface.h"
int main() int main()
{ {
UserInterface userInterFace; UserInterface userInterFace;
@@ -1 +1,8 @@
/*
* File: ApplicationConfig.cpp
* Description: Global Application Config
* Author: Trenser
* Created: 06-Apr-2026
*/
#include "ApplicationConfig.h" #include "ApplicationConfig.h"
@@ -1,3 +1,10 @@
/*
* File: ApplicationConfig.h
* Description: Global Application Config
* Author: Trenser
* Created: 06-Apr-2026
*/
#pragma once #pragma once
namespace Config namespace Config
@@ -1 +1,8 @@
/*
* File: AttendanceManagementService.cpp
* Description: Handles Attendance related operations
* Author: Trenser
* Created: 30-Apr-2026
*/
#include "AttendanceManagementService.h" #include "AttendanceManagementService.h"
@@ -1,3 +1,10 @@
/*
* File: AttendanceManagementService.h
* Description: Handles Attendance related operations
* Author: Trenser
* Created: 30-Apr-2026
*/
#pragma once #pragma once
class AttendanceManagementService class AttendanceManagementService
{ {
@@ -1,65 +1,103 @@
/*
* File: AuthenticationManagementService.cpp
* Description: Handles authentication related operations
* Author: Trenser
* Created: 30-Mar-2026
*/
#include <stdexcept> #include <stdexcept>
#include "AuthenticationManagementService.h" #include "AuthenticationManagementService.h"
#include "ApplicationConfig.h" #include "ApplicationConfig.h"
/*
* Function: login
* Description: Authenticates a user using email and password, determines login status,
* employee type, and designation, and sets the authenticated employee
* in the data store.
* Parameters:
* email - employee email address
* password - employee password
* Returns:
* AuthenticationDTO containing login status, employee type, and employee designation
*/
AuthenticationDTO AuthenticationManagementService::login(const std::string& email, const std::string& password) AuthenticationDTO AuthenticationManagementService::login(const std::string& email, const std::string& password)
{ {
employeeMap& employees = m_dataStore.getEmployees(); employeeMap& employees = m_dataStore.getEmployees();
Enums::LoginStatus loginStatus = Enums::LoginStatus::USER_NOT_FOUND; Enums::LoginStatus loginStatus = Enums::LoginStatus::USER_NOT_FOUND;
Enums::EmployeeType employeeType = Enums::EmployeeType::INVALID; Enums::EmployeeType employeeType = Enums::EmployeeType::INVALID;
Enums::EmployeeDesignation employeeDesignation = Enums::EmployeeDesignation::INVALID; Enums::EmployeeDesignation employeeDesignation = Enums::EmployeeDesignation::INVALID;
for (const auto& employee : employees) for (const auto& employee : employees)
{ {
if (employee.second->getEmployeeEmail() == email) if (employee.second->getEmployeeEmail() == email)
{ {
if (employee.second->getEmployeePassword() == password) if (employee.second->getEmployeePassword() == password)
{ {
if (password == Config::Authentication::DEFAULT_PASSWORD) if (password == Config::Authentication::DEFAULT_PASSWORD)
{ {
loginStatus = Enums::LoginStatus::FIRST_LOGIN; loginStatus = Enums::LoginStatus::FIRST_LOGIN;
} }
else else
{ {
loginStatus = Enums::LoginStatus::SUCCESS; loginStatus = Enums::LoginStatus::SUCCESS;
} }
employeeType = employee.second->getEmployeeType(); employeeType = employee.second->getEmployeeType();
if (employeeType == Enums::EmployeeType::GENERAL) if (employeeType == Enums::EmployeeType::GENERAL)
{ {
std::shared_ptr<GeneralEmployee> generalEmployee = std::dynamic_pointer_cast<GeneralEmployee>(employee.second); std::shared_ptr<GeneralEmployee> generalEmployee = std::dynamic_pointer_cast<GeneralEmployee>(employee.second);
if (generalEmployee) if (generalEmployee)
{ {
employeeDesignation = generalEmployee->getDesignation(); employeeDesignation = generalEmployee->getDesignation();
} }
else else
{ {
throw std::runtime_error("Invalid Employee Type"); throw std::runtime_error("Invalid Employee Type");
} }
} }
m_dataStore.setAuthenticatedEmployee(employee.second); m_dataStore.setAuthenticatedEmployee(employee.second);
} }
else else
{ {
loginStatus = Enums::LoginStatus::INVALID_PASSWORD; loginStatus = Enums::LoginStatus::INVALID_PASSWORD;
} }
break; break;
} }
} }
return std::make_tuple(loginStatus, employeeType, employeeDesignation); return std::make_tuple(loginStatus, employeeType, employeeDesignation);
} }
/*
* Function: changePassword
* Description: Updates the password of the currently authenticated user.
* Parameters:
* password - new password to be set
* Returns:
* None
* Throws:
* runtime_error if no authenticated user is found
*/
void AuthenticationManagementService::changePassword(const std::string& password) void AuthenticationManagementService::changePassword(const std::string& password)
{ {
std::shared_ptr<Employee> authenticatedUser = m_dataStore.getAuthenticatedUser(); std::shared_ptr<Employee> authenticatedUser = m_dataStore.getAuthenticatedUser();
if (authenticatedUser) if (authenticatedUser)
{ {
authenticatedUser->setEmployeePassword(password); authenticatedUser->setEmployeePassword(password);
} }
else else
{ {
throw std::runtime_error("User not found"); throw std::runtime_error("User not found");
} }
} }
/*
* Function: logout
* Description: Logs out the currently authenticated user by clearing authentication data.
* Parameters:
* None
* Returns:
* None
* Throws:
* runtime_error if no user is currently logged in
*/
void AuthenticationManagementService::logout() { void AuthenticationManagementService::logout() {
if (m_dataStore.getAuthenticatedUser()) { if (m_dataStore.getAuthenticatedUser()) {
m_dataStore.getAuthenticatedUser() = nullptr; m_dataStore.getAuthenticatedUser() = nullptr;
@@ -1,3 +1,10 @@
/*
* File: AuthenticationManagementService.h
* Description: Handles authentication related operations
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once #pragma once
#include <string> #include <string>
#include <map> #include <map>
@@ -19,4 +26,3 @@ public:
void logout(); void logout();
void changePassword(const std::string&); void changePassword(const std::string&);
}; };
@@ -1 +1,8 @@
/*
* File: BookingManagementService.cpp
* Description: Handle operations related to booking meetings
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "BookingManagementService.h" #include "BookingManagementService.h"
@@ -1,3 +1,10 @@
/*
* File: BookingManagementService.h
* Description: Handle operations related to booking meetings
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once #pragma once
class BookingManagementService class BookingManagementService
{ {
@@ -1 +1,8 @@
/*
* File: EmployeeManagementService.cpp
* Description: Handle operations related to employees
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "EmployeeManagememtService.h" #include "EmployeeManagememtService.h"
@@ -1,3 +1,10 @@
/*
* File: EmployeeManagementService.h
* Description: Handle operations related to employees
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once #pragma once
class EmployeeManagememtService class EmployeeManagememtService
{ {
@@ -1 +1,8 @@
/*
* File: LeaveManagementService.cpp
* Description: Handle operations related to leaves
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "LeaveManagementService.h" #include "LeaveManagementService.h"
@@ -1,3 +1,10 @@
/*
* File: LeaveManagementService.h
* Description: Handle operations related to leaves
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once #pragma once
class LeaveManagementService class LeaveManagementService
{ {
@@ -1,3 +1,10 @@
/*
* File: Log.cpp
* Description: Handle operations related to logging
* Author: Trenser
* Created: 01-Apr-2026
*/
#include "LogService.h" #include "LogService.h"
#include "Log.h" #include "Log.h"
#include "Factory.h" #include "Factory.h"
@@ -1,3 +1,10 @@
/*
* File: Log.h
* Description: Handle operations related to logging
* Author: Trenser
* Created: 01-Apr-2026
*/
#pragma once #pragma once
#include "Log.h" #include "Log.h"
@@ -1 +1,8 @@
/*
* File: NotificationManagementService.cpp
* Description: Handle operations related to notifications
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "NotificationManagementService.h" #include "NotificationManagementService.h"
@@ -1,5 +1,11 @@
/*
* File: NotificationManagementService.h
* Description: Handle operations related to notifications
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once #pragma once
class NotificationManagementService class NotificationManagementService
{ {
}; };
@@ -1 +1,8 @@
/*
* File: PayslipManagementService.cpp
* Description: Handle operations related to employee payslips
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "PayslipManagementService.h" #include "PayslipManagementService.h"
@@ -1,3 +1,10 @@
/*
* File: PayslipManagementService.h
* Description: Handle operations related to employee payslips
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once #pragma once
class PayslipManagementService class PayslipManagementService
{ {
@@ -1 +1,8 @@
/*
* File: TalentAcquisitionManagementService.cpp
* Description: Handle operations related to Talent Acquisition
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "TalentAcquisitionManagementService.h" #include "TalentAcquisitionManagementService.h"
@@ -1,5 +1,11 @@
/*
* File: TalentAcquisitionManagementService.h
* Description: Handle operations related to Talent Acquisition
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once #pragma once
class TalentAcquisitionManagementService class TalentAcquisitionManagementService
{ {
}; };
@@ -1 +1,8 @@
/*
* File: TeamManagementService.cpp
* Description: Handle operations related to Team Management
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "TeamManagementService.h" #include "TeamManagementService.h"
@@ -1,3 +1,10 @@
/*
* File: TeamManagementService.h
* Description: Handle operations related to Team Management
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once #pragma once
class TeamManagementService class TeamManagementService
{ {
@@ -1 +1,8 @@
/*
* File: TicketManagementService.h
* Description: Handle operations related to Ticket Management
* Author: Trenser
* Created: 30-Mar-2026
*/
#include "TicketManagementService.h" #include "TicketManagementService.h"
@@ -1,3 +1,10 @@
/*
* File: TicketManagementService.h
* Description: Handle operations related to Ticket Management
* Author: Trenser
* Created: 30-Mar-2026
*/
#pragma once #pragma once
class TicketManagementService class TicketManagementService
{ {