From def0f4022b1a00f690a3de62920c5667a3764243 Mon Sep 17 00:00:00 2001 From: Joel Thomas Date: Wed, 8 Apr 2026 17:21:41 +0530 Subject: [PATCH 01/19] Add file and function header documentation across Services and Main files --- Trenser.Zenvy/Trenser.Zenvy/Trenser.Zenvy.cpp | 8 + .../services/ApplicationConfig.cpp | 7 + .../services/ApplicationConfig.h | 7 + .../services/AttendanceManagementService.cpp | 7 + .../services/AttendanceManagementService.h | 7 + .../AuthenticationManagementService.cpp | 138 +++++++++++------- .../AuthenticationManagementService.h | 8 +- .../services/BookingManagementService.cpp | 7 + .../services/BookingManagementService.h | 7 + .../services/EmployeeManagememtService.cpp | 7 + .../services/EmployeeManagememtService.h | 7 + .../services/LeaveManagementService.cpp | 7 + .../services/LeaveManagementService.h | 7 + .../Trenser.Zenvy/services/LogService.cpp | 7 + .../Trenser.Zenvy/services/LogService.h | 7 + .../NotificationManagementService.cpp | 7 + .../services/NotificationManagementService.h | 8 +- .../services/PayslipManagementService.cpp | 7 + .../services/PayslipManagementService.h | 7 + .../TalentAcquisitionManagementService.cpp | 7 + .../TalentAcquisitionManagementService.h | 8 +- .../services/TeamManagementService.cpp | 7 + .../services/TeamManagementService.h | 7 + .../services/TicketManagementService.cpp | 7 + .../services/TicketManagementService.h | 7 + 25 files changed, 257 insertions(+), 53 deletions(-) diff --git a/Trenser.Zenvy/Trenser.Zenvy/Trenser.Zenvy.cpp b/Trenser.Zenvy/Trenser.Zenvy/Trenser.Zenvy.cpp index 4413069..64b1e4b 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/Trenser.Zenvy.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/Trenser.Zenvy.cpp @@ -1,4 +1,12 @@ +/* + * File: Trenser.Zenvy.cpp + * Description: Zenvy Main + * Author: Trenser + * Created: 30-Mar-2026 + */ + #include "UserInterface.h" + int main() { UserInterface userInterFace; diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/ApplicationConfig.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/ApplicationConfig.cpp index cb68b98..e5a0d0e 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/ApplicationConfig.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/ApplicationConfig.cpp @@ -1 +1,8 @@ +/* + * File: ApplicationConfig.cpp + * Description: Global Application Config + * Author: Trenser + * Created: 06-Apr-2026 + */ + #include "ApplicationConfig.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/ApplicationConfig.h b/Trenser.Zenvy/Trenser.Zenvy/services/ApplicationConfig.h index 8e4705e..bbeadd1 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/ApplicationConfig.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/ApplicationConfig.h @@ -1,3 +1,10 @@ +/* + * File: ApplicationConfig.h + * Description: Global Application Config + * Author: Trenser + * Created: 06-Apr-2026 + */ + #pragma once namespace Config diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/AttendanceManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/AttendanceManagementService.cpp index fb3ab62..2ab575a 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/AttendanceManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/AttendanceManagementService.cpp @@ -1 +1,8 @@ +/* + * File: AttendanceManagementService.cpp + * Description: Handles Attendance related operations + * Author: Trenser + * Created: 30-Apr-2026 + */ + #include "AttendanceManagementService.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/AttendanceManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/AttendanceManagementService.h index 64374bf..5f12270 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/AttendanceManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/AttendanceManagementService.h @@ -1,3 +1,10 @@ +/* + * File: AttendanceManagementService.h + * Description: Handles Attendance related operations + * Author: Trenser + * Created: 30-Apr-2026 + */ + #pragma once class AttendanceManagementService { diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.cpp index 9d7fc4f..642c868 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.cpp @@ -1,65 +1,103 @@ +/* + * File: AuthenticationManagementService.cpp + * Description: Handles authentication related operations + * Author: Trenser + * Created: 30-Mar-2026 + */ + #include #include "AuthenticationManagementService.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) { - employeeMap& employees = m_dataStore.getEmployees(); - Enums::LoginStatus loginStatus = Enums::LoginStatus::USER_NOT_FOUND; - Enums::EmployeeType employeeType = Enums::EmployeeType::INVALID; - Enums::EmployeeDesignation employeeDesignation = Enums::EmployeeDesignation::INVALID; - for (const auto& employee : employees) - { - if (employee.second->getEmployeeEmail() == email) - { - if (employee.second->getEmployeePassword() == password) - { - if (password == Config::Authentication::DEFAULT_PASSWORD) - { - loginStatus = Enums::LoginStatus::FIRST_LOGIN; - } - else - { - loginStatus = Enums::LoginStatus::SUCCESS; - } - employeeType = employee.second->getEmployeeType(); - if (employeeType == Enums::EmployeeType::GENERAL) - { - std::shared_ptr generalEmployee = std::dynamic_pointer_cast(employee.second); - if (generalEmployee) - { - employeeDesignation = generalEmployee->getDesignation(); - } - else - { - throw std::runtime_error("Invalid Employee Type"); - } - } - m_dataStore.setAuthenticatedEmployee(employee.second); - } - else - { - loginStatus = Enums::LoginStatus::INVALID_PASSWORD; - } - break; - } - } - return std::make_tuple(loginStatus, employeeType, employeeDesignation); + employeeMap& employees = m_dataStore.getEmployees(); + Enums::LoginStatus loginStatus = Enums::LoginStatus::USER_NOT_FOUND; + Enums::EmployeeType employeeType = Enums::EmployeeType::INVALID; + Enums::EmployeeDesignation employeeDesignation = Enums::EmployeeDesignation::INVALID; + for (const auto& employee : employees) + { + if (employee.second->getEmployeeEmail() == email) + { + if (employee.second->getEmployeePassword() == password) + { + if (password == Config::Authentication::DEFAULT_PASSWORD) + { + loginStatus = Enums::LoginStatus::FIRST_LOGIN; + } + else + { + loginStatus = Enums::LoginStatus::SUCCESS; + } + employeeType = employee.second->getEmployeeType(); + if (employeeType == Enums::EmployeeType::GENERAL) + { + std::shared_ptr generalEmployee = std::dynamic_pointer_cast(employee.second); + if (generalEmployee) + { + employeeDesignation = generalEmployee->getDesignation(); + } + else + { + throw std::runtime_error("Invalid Employee Type"); + } + } + m_dataStore.setAuthenticatedEmployee(employee.second); + } + else + { + loginStatus = Enums::LoginStatus::INVALID_PASSWORD; + } + break; + } + } + 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) { - std::shared_ptr authenticatedUser = m_dataStore.getAuthenticatedUser(); - if (authenticatedUser) - { - authenticatedUser->setEmployeePassword(password); - } - else - { - throw std::runtime_error("User not found"); - } + std::shared_ptr authenticatedUser = m_dataStore.getAuthenticatedUser(); + if (authenticatedUser) + { + authenticatedUser->setEmployeePassword(password); + } + else + { + 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() { if (m_dataStore.getAuthenticatedUser()) { m_dataStore.getAuthenticatedUser() = nullptr; diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.h index f838311..392065b 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.h @@ -1,3 +1,10 @@ +/* + * File: AuthenticationManagementService.h + * Description: Handles authentication related operations + * Author: Trenser + * Created: 30-Mar-2026 + */ + #pragma once #include #include @@ -19,4 +26,3 @@ public: void logout(); void changePassword(const std::string&); }; - diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/BookingManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/BookingManagementService.cpp index db5a4c9..cb032c3 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/BookingManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/BookingManagementService.cpp @@ -1 +1,8 @@ +/* + * File: BookingManagementService.cpp + * Description: Handle operations related to booking meetings + * Author: Trenser + * Created: 30-Mar-2026 + */ + #include "BookingManagementService.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/BookingManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/BookingManagementService.h index 75d7d57..7f343a4 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/BookingManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/BookingManagementService.h @@ -1,3 +1,10 @@ +/* + * File: BookingManagementService.h + * Description: Handle operations related to booking meetings + * Author: Trenser + * Created: 30-Mar-2026 + */ + #pragma once class BookingManagementService { diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagememtService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagememtService.cpp index bf8ad9d..5fdebfe 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagememtService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagememtService.cpp @@ -1 +1,8 @@ +/* + * File: EmployeeManagementService.cpp + * Description: Handle operations related to employees + * Author: Trenser + * Created: 30-Mar-2026 + */ + #include "EmployeeManagememtService.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagememtService.h b/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagememtService.h index 05e6ca7..3bb2294 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagememtService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagememtService.h @@ -1,3 +1,10 @@ +/* + * File: EmployeeManagementService.h + * Description: Handle operations related to employees + * Author: Trenser + * Created: 30-Mar-2026 + */ + #pragma once class EmployeeManagememtService { diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/LeaveManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/LeaveManagementService.cpp index a40f268..733f9eb 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/LeaveManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/LeaveManagementService.cpp @@ -1 +1,8 @@ +/* + * File: LeaveManagementService.cpp + * Description: Handle operations related to leaves + * Author: Trenser + * Created: 30-Mar-2026 + */ + #include "LeaveManagementService.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/LeaveManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/LeaveManagementService.h index 6447f13..1010ec4 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/LeaveManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/LeaveManagementService.h @@ -1,3 +1,10 @@ +/* + * File: LeaveManagementService.h + * Description: Handle operations related to leaves + * Author: Trenser + * Created: 30-Mar-2026 + */ + #pragma once class LeaveManagementService { diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/LogService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/LogService.cpp index 1742a3d..3e77020 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/LogService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/LogService.cpp @@ -1,3 +1,10 @@ +/* + * File: Log.cpp + * Description: Handle operations related to logging + * Author: Trenser + * Created: 01-Apr-2026 + */ + #include "LogService.h" #include "Log.h" #include "Factory.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/LogService.h b/Trenser.Zenvy/Trenser.Zenvy/services/LogService.h index 6918b25..c1cf644 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/LogService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/LogService.h @@ -1,3 +1,10 @@ +/* + * File: Log.h + * Description: Handle operations related to logging + * Author: Trenser + * Created: 01-Apr-2026 + */ + #pragma once #include "Log.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/NotificationManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/NotificationManagementService.cpp index cc23059..7eaa377 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/NotificationManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/NotificationManagementService.cpp @@ -1 +1,8 @@ +/* + * File: NotificationManagementService.cpp + * Description: Handle operations related to notifications + * Author: Trenser + * Created: 30-Mar-2026 + */ + #include "NotificationManagementService.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/NotificationManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/NotificationManagementService.h index f976574..6b4aba1 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/NotificationManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/NotificationManagementService.h @@ -1,5 +1,11 @@ +/* + * File: NotificationManagementService.h + * Description: Handle operations related to notifications + * Author: Trenser + * Created: 30-Mar-2026 + */ + #pragma once class NotificationManagementService { }; - diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.cpp index 154cf1f..57ca929 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.cpp @@ -1 +1,8 @@ +/* + * File: PayslipManagementService.cpp + * Description: Handle operations related to employee payslips + * Author: Trenser + * Created: 30-Mar-2026 + */ + #include "PayslipManagementService.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.h index 04c9805..7f43806 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.h @@ -1,3 +1,10 @@ +/* + * File: PayslipManagementService.h + * Description: Handle operations related to employee payslips + * Author: Trenser + * Created: 30-Mar-2026 + */ + #pragma once class PayslipManagementService { diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/TalentAcquisitionManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/TalentAcquisitionManagementService.cpp index 5fd0d2d..9e0ef96 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/TalentAcquisitionManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/TalentAcquisitionManagementService.cpp @@ -1 +1,8 @@ +/* + * File: TalentAcquisitionManagementService.cpp + * Description: Handle operations related to Talent Acquisition + * Author: Trenser + * Created: 30-Mar-2026 + */ + #include "TalentAcquisitionManagementService.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/TalentAcquisitionManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/TalentAcquisitionManagementService.h index 855dda7..ed0dd32 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/TalentAcquisitionManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/TalentAcquisitionManagementService.h @@ -1,5 +1,11 @@ +/* + * File: TalentAcquisitionManagementService.h + * Description: Handle operations related to Talent Acquisition + * Author: Trenser + * Created: 30-Mar-2026 + */ + #pragma once class TalentAcquisitionManagementService { }; - diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/TeamManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/TeamManagementService.cpp index f78fe48..8b13b81 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/TeamManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/TeamManagementService.cpp @@ -1 +1,8 @@ +/* + * File: TeamManagementService.cpp + * Description: Handle operations related to Team Management + * Author: Trenser + * Created: 30-Mar-2026 + */ + #include "TeamManagementService.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/TeamManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/TeamManagementService.h index 918229d..21275da 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/TeamManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/TeamManagementService.h @@ -1,3 +1,10 @@ +/* + * File: TeamManagementService.h + * Description: Handle operations related to Team Management + * Author: Trenser + * Created: 30-Mar-2026 + */ + #pragma once class TeamManagementService { diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/TicketManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/TicketManagementService.cpp index 4649010..bc995f9 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/TicketManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/TicketManagementService.cpp @@ -1 +1,8 @@ +/* + * File: TicketManagementService.h + * Description: Handle operations related to Ticket Management + * Author: Trenser + * Created: 30-Mar-2026 + */ + #include "TicketManagementService.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/TicketManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/TicketManagementService.h index 1db345b..8a38d98 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/TicketManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/TicketManagementService.h @@ -1,3 +1,10 @@ +/* + * File: TicketManagementService.h + * Description: Handle operations related to Ticket Management + * Author: Trenser + * Created: 30-Mar-2026 + */ + #pragma once class TicketManagementService { From 9a791eadcd26bb237a423dfc70042dd5206065a0 Mon Sep 17 00:00:00 2001 From: Tinu Johnson Date: Wed, 8 Apr 2026 17:23:47 +0530 Subject: [PATCH 02/19] Add file and function header documentation across Model files --- Trenser.Zenvy/Trenser.Zenvy/models/Admin.cpp | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/Admin.h | 7 +++++++ Trenser.Zenvy/Trenser.Zenvy/models/Announcement.cpp | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/Attendance.cpp | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/Attendance.h | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/Booking.cpp | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/Booking.h | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/Candidate.cpp | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/Candidate.h | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/Employee.h | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/FAQ.cpp | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/FAQ.h | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.cpp | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.h | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.h | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/HRManager.cpp | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/HRManager.h | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.cpp | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.h | 6 ++++++ 20 files changed, 121 insertions(+) diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Admin.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Admin.cpp index 0cc2b4c..f63c352 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Admin.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Admin.cpp @@ -1 +1,7 @@ +/* + * File: Admin.cpp + * Description: Admin model class + * Author: Trenser + * Created: 31-Mar-2026 + */ #include "Admin.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Admin.h b/Trenser.Zenvy/Trenser.Zenvy/models/Admin.h index 97f4f4e..f507ccc 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Admin.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Admin.h @@ -1,3 +1,10 @@ +/* + * File: Admin.h + * Description: Admin model class + * Author: Trenser + * Created: 31-Mar-2026 + */ + #pragma once #include "Employee.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Announcement.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Announcement.cpp index 01cec1a..67e0c4e 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Announcement.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Announcement.cpp @@ -1,3 +1,9 @@ +/* + * File: Announcement.cpp + * Description: The Announcement class that stores an announcement’s ID, timestamp, and message with getter and setter functions for controlled access. + * Author: Trenser + * Created: 31-Mar-2026 + */ #include "Announcement.h" const std::string& Announcement::getAnnouncementId() const diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Attendance.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Attendance.cpp index 7565537..bcbf622 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Attendance.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Attendance.cpp @@ -1,3 +1,9 @@ +/* + * File: Attendance.cpp + * Description: The Attendance class manages attendance records by storing login and logout times. + * Author: Trenser + * Created: 31-Mar-2026 + */ #include "Attendance.h" const std::string& Attendance::getAttendanceId() const diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Attendance.h b/Trenser.Zenvy/Trenser.Zenvy/models/Attendance.h index 3b10f5c..89f4ed3 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Attendance.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Attendance.h @@ -1,3 +1,9 @@ +/* + * File: Attendance.h + * Description: The Attendance class represents an attendance record by storing an ID, login and logout timestamps. + * Author: Trenser + * Created: 31-Mar-2026 + */ #pragma once #include #include "Timestamp.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Booking.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Booking.cpp index a40ed2b..6689689 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Booking.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Booking.cpp @@ -1,3 +1,9 @@ +/* + * File: Booking.cpp + * Description: The Booking class stores booking details and calculates the duration between start and end times. + * Author: Trenser + * Created: 31-Mar-2026 + */ #include "Booking.h" const std::string& Booking::getBookingId() const diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Booking.h b/Trenser.Zenvy/Trenser.Zenvy/models/Booking.h index 7e99b4a..f88c084 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Booking.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Booking.h @@ -1,3 +1,9 @@ +/* + * File: Booking.h + * Description: The Booking class represents a time?based booking with employee and team details and supports duration calculation. + * Author: Trenser + * Created: 31-Mar-2026 + */ #pragma once #include #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Candidate.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Candidate.cpp index e4831a4..8394260 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Candidate.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Candidate.cpp @@ -1,3 +1,9 @@ +/* + * File: Candidate.cpp + * Description: The Candidate class manages candidate details and status using getter and setter methods. + * Author: Trenser + * Created: 31-Mar-2026 + */ #include "Candidate.h" const std::string& Candidate::getCandidateId() const diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Candidate.h b/Trenser.Zenvy/Trenser.Zenvy/models/Candidate.h index 257c54d..aefb893 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Candidate.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Candidate.h @@ -1,3 +1,9 @@ +/* + * File: Candidate.h + * Description: The Candidate class stores and manages a candidate’s information. + * Author: Trenser + * Created: 31-Mar-2026 + */ #pragma once #include #include "Enums.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp index 4bd8c3b..68c1963 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp @@ -1,3 +1,9 @@ +/* + * File: Employee.cpp + * Description: The Employee class stores and manages employee details along with related work records. + * Author: Trenser + * Created: 31-Mar-2026 + */ #include "Employee.h" const std::string& Employee::getEmployeeId() const diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Employee.h b/Trenser.Zenvy/Trenser.Zenvy/models/Employee.h index 3509db1..400eebd 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Employee.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Employee.h @@ -1,3 +1,9 @@ +/* + * File: Employee.h + * Description: The Employee class manages employee information and associated work records such as payroll, attendance, leaves, and payslips. + * Author: Trenser + * Created: 31-Mar-2026 + */ #pragma once #include #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/FAQ.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/FAQ.cpp index 63a403f..a5e7b41 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/FAQ.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/FAQ.cpp @@ -1 +1,7 @@ +/* + * File: Faq.h + * Description: Faq model class. + * Author: Trenser + * Created: 02-Apr-2026 + */ #include "Faq.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/FAQ.h b/Trenser.Zenvy/Trenser.Zenvy/models/FAQ.h index b90edff..3788612 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/FAQ.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/FAQ.h @@ -1,3 +1,9 @@ +/* + * File: Faq.h + * Description: Faq model class. + * Author: Trenser + * Created: 02-Apr-2026 + */ #pragma once class Faq diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.cpp index ec96663..93d3b6c 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.cpp @@ -1 +1,7 @@ +/* + * File: FinanceExecutive.h + * Description: FinanceExecutive model class. + * Author: Trenser + * Created: 31-Mar-2026 + */ #include "FinanceExecutive.h" \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.h b/Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.h index 8aafc69..2f529bb 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.h @@ -1,3 +1,9 @@ +/* + * File: FinanceExecutive.h + * Description: FinanceExecutive model class. + * Author: Trenser + * Created: 31-Mar-2026 + */ #pragma once #include "Employee.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.h b/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.h index 6307e28..2c40288 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.h @@ -1,3 +1,9 @@ +/* + * File: GeneralEmployee.h + * Description: The GeneralEmployee class represents a general employee with a specific designation. + * Author: Trenser + * Created: 31-Mar-2026 + */ #pragma once #include "Employee.h" #include "Enums.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.cpp index 4b7ee33..8f9615f 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.cpp @@ -1 +1,7 @@ +/* + * File: HRManager.cpp + * Description: HRManager model class. + * Author: Trenser + * Created: 31-Mar-2026 + */ #include "HRManager.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.h b/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.h index 5e50a74..fda356c 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.h @@ -1,3 +1,9 @@ +/* + * File: HRManager.h + * Description: HRManager model class. + * Author: Trenser + * Created: 31-Mar-2026 + */ #pragma once #include "Employee.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.cpp index 700fcd9..7beaf7d 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.cpp @@ -1 +1,7 @@ +/* + * File: ITExecutive.cpp + * Description: ITExecutive model class. + * Author: Trenser + * Created: 31-Mar-2026 + */ #include "ITExecutive.h" \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.h b/Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.h index 2a61ef8..b839ae4 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.h @@ -1,3 +1,9 @@ +/* + * File: ITExecutive.h + * Description: ITExecutive model class. + * Author: Trenser + * Created: 31-Mar-2026 + */ #pragma once #include "Employee.h" From 21549b4c242bb6d66ee49fb246c1cbbd04ab5705 Mon Sep 17 00:00:00 2001 From: Princy Jerin Date: Wed, 8 Apr 2026 17:25:58 +0530 Subject: [PATCH 03/19] Add file and function header documentation across Model files --- Trenser.Zenvy/Trenser.Zenvy/models/JobListing.cpp | 8 ++++++++ Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h | 7 +++++++ Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp | 8 ++++++++ Trenser.Zenvy/Trenser.Zenvy/models/Leave.h | 7 +++++++ Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp | 8 ++++++++ Trenser.Zenvy/Trenser.Zenvy/models/Log.h | 7 +++++++ Trenser.Zenvy/Trenser.Zenvy/models/Notification.cpp | 8 ++++++++ Trenser.Zenvy/Trenser.Zenvy/models/Notification.h | 7 +++++++ Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp | 8 ++++++++ Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h | 7 +++++++ Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp | 8 ++++++++ Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h | 7 +++++++ Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp | 8 ++++++++ Trenser.Zenvy/Trenser.Zenvy/models/Room.h | 7 +++++++ Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.cpp | 7 +++++++ Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h | 7 +++++++ Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp | 8 ++++++++ Trenser.Zenvy/Trenser.Zenvy/models/Team.h | 7 +++++++ Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.cpp | 7 +++++++ Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h | 7 +++++++ Trenser.Zenvy/Trenser.Zenvy/models/Ticket.cpp | 8 ++++++++ Trenser.Zenvy/Trenser.Zenvy/models/Ticket.h | 7 +++++++ 22 files changed, 163 insertions(+) diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.cpp index ba1267c..0d4b30e 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.cpp @@ -1,5 +1,13 @@ +/* +File: JobListing.cpp +* Description : Represents a job opening along with its details and applied candidates. +* Author : Trenser +* Created : 01 - Apr - 2026 +*/ + #include "JobListing.h" +//Getters and setters const std::string& JobListing::getJobId() const { return m_id; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h b/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h index 3622743..10b6c57 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h @@ -1,3 +1,10 @@ +/* +File: JobListing.h +* Description : Represents a job opening along with its details and applied candidates. +* Author : Trenser +* Created : 01 - Apr - 2026 +*/ + #pragma once #include #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp index 1755bc7..4ac215b 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp @@ -1,5 +1,13 @@ +/* +File: Leave.cpp +* Description : Stores information related to an employee’s leave application. +* Author : Trenser +* Created : 31 - Mar - 2026 +*/ + #include "Leave.h" +//Getters and setters const std::string& Leave::getLeaveId() const { return m_id; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Leave.h b/Trenser.Zenvy/Trenser.Zenvy/models/Leave.h index 0133f4a..a7588e2 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Leave.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Leave.h @@ -1,3 +1,10 @@ +/* +File: Leave.h +* Description : Stores information related to an employee’s leave application. +* Author : Trenser +* Created : 31 - Mar - 2026 +*/ + #pragma once #include #include "Enums.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp index 890cfc5..a022679 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp @@ -1,5 +1,13 @@ +/* +File: Log.cpp +* Description : Represents a log entry containing a timestamp and an associated message. +* Author : Trenser +* Created : 01 - Apr - 2026 +*/ + #include "Log.h" +//Getters and setters const util::Timestamp& Log::getTimestamp() const { return m_timestamp; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Log.h b/Trenser.Zenvy/Trenser.Zenvy/models/Log.h index f2350b2..416d7fb 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Log.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Log.h @@ -1,3 +1,10 @@ +/* +File: Log.h +* Description : Represents a log entry containing a timestamp and an associated message. +* Author : Trenser +* Created : 01 - Apr - 2026 +*/ + #pragma once #include #include "Timestamp.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Notification.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Notification.cpp index f91530a..2bc0c0d 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Notification.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Notification.cpp @@ -1,5 +1,13 @@ +/* +File: Notification.cpp +* Description : Represents an employee notification with message and status details. +* Author : Trenser +* Created : 31 - Mar - 2026 +*/ + #include "Notification.h" +//Getters and setters const std::string& Notification::getNotificationId() const { return m_id; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Notification.h b/Trenser.Zenvy/Trenser.Zenvy/models/Notification.h index 0cd723c..cf76caf 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Notification.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Notification.h @@ -1,3 +1,10 @@ +/* +File: Notification.h +* Description : Represents an employee notification with message and status details. +* Author : Trenser +* Created : 31 - Mar - 2026 +*/ + #pragma once #include #include "Enums.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp index eae13a1..b76ab8d 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp @@ -1,5 +1,13 @@ +/* +File: Payroll.cpp +* Description : Stores payroll and salary breakdown details for an employee. +* Author : Trenser +* Created : 31 - Mar - 2026 +*/ + #include "Payroll.h" +//Getters and setters const std::string& Payroll::getPayrollId() const { return m_id; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h index 498eaf8..3ebe780 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h @@ -1,3 +1,10 @@ +/* +File: Payroll.h +* Description : Stores payroll and salary breakdown details for an employee. +* Author : Trenser +* Created : 31 - Mar - 2026 +*/ + #pragma once #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp index 3daf4b9..70e42e7 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp @@ -1,5 +1,13 @@ +/* +File: Payslip.cpp +* Description : Models a payslip entity that stores salary information. +* Author : Trenser +* Created : 31 - Mar - 2026 +*/ + #include "Payslip.h" +//Getters and setters const std::string& Payslip::getPayslipId() const { return m_id; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h b/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h index 3f48dd2..06d0023 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h @@ -1,3 +1,10 @@ +/* +File: Payslip.h +* Description : Models a payslip entity that stores salary information. +* Author : Trenser +* Created : 31 - Mar - 2026 +*/ + #pragma once #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp index 9fcd521..cb5abbb 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp @@ -1,5 +1,13 @@ +/* +File: Room.cpp +* Description : Models a room entity that maintains room details and manages its bookings. +* Author : Trenser +* Created : 31 - Mar - 2026 +*/ + #include "Room.h" +//Getters and setters const std::string& Room::getRoomId() const { return m_id; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Room.h b/Trenser.Zenvy/Trenser.Zenvy/models/Room.h index 48a4ba1..595ffaa 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Room.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Room.h @@ -1,3 +1,10 @@ +/* +File: Room.h +* Description : Models a room entity that maintains room details and manages its bookings. +* Author : Trenser +* Created : 31 - Mar - 2026 +*/ + #pragma once #include #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.cpp index de7213f..112c3d0 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.cpp @@ -1 +1,8 @@ +/* +File: TalentExecutive.cpp +* Description : Represents information related to a talent executive in the system. +* Author : Trenser +* Created : 31 - Mar - 2026 +*/ + #include "TalentExecutive.h" \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h b/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h index fcbfbcd..a5bfa6e 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h @@ -1,3 +1,10 @@ +/* +File: TalentExecutive.h +* Description : Represents information related to a talent executive in the system. +* Author : Trenser +* Created : 31 - Mar - 2026 +*/ + #pragma once #include "Employee.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp index a6848b3..4a26647 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp @@ -1,5 +1,13 @@ +/* +File: Team.cpp +* Description : Models a team entity that maintains team identity, leadership, employee list, and size limitations. +* Author : Trenser +* Created : 31 - Mar - 2026 +*/ + #include "Team.h" +//Getters and setters const std::string& Team::getTeamId() const { return m_id; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Team.h b/Trenser.Zenvy/Trenser.Zenvy/models/Team.h index edb8f44..e353aa3 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Team.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Team.h @@ -1,3 +1,10 @@ +/* +File: Team.h +* Description : Models a team entity that maintains team identity, leadership, employee list, and size limitations. +* Author : Trenser +* Created : 31 - Mar - 2026 +*/ + #pragma once #include #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.cpp index df14a3f..aac8db4 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.cpp @@ -1 +1,8 @@ +/* +File: TeamExecutive.cpp +* Description : Represents information related to a team executive within the system. +* Author : Trenser +* Created : 31 - Mar - 2026 +*/ + #include "TeamExecutive.h" \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h b/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h index d7db4e9..1bd7def 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h @@ -1,3 +1,10 @@ +/* +File: TeamExecutive.h +* Description : Represents information related to a team executive within the system. +* Author : Trenser +* Created : 31 - Mar - 2026 +*/ + #pragma once #include "Employee.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.cpp index 328421c..af67e08 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.cpp @@ -1,5 +1,13 @@ +/* +File: Ticket.cpp +* Description : Represents a support ticket with its associated details and status. +* Author : Trenser +* Created : 31 - Mar - 2026 +*/ + #include "Ticket.h" +//Getters and setters const std::string& Ticket::getTicketId() const { return m_id; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.h b/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.h index 7d54a6f..88f8ed8 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.h @@ -1,3 +1,10 @@ +/* +File: Ticket.h +* Description : Represents a support ticket with its associated details and status. +* Author : Trenser +* Created : 31 - Mar - 2026 +*/ + #pragma once #include #include "Enums.h" From 2757e5ca98d582d8ddb0c067320cd76d83f3f20c Mon Sep 17 00:00:00 2001 From: Ajmal Jalaludeen Date: Wed, 8 Apr 2026 17:27:22 +0530 Subject: [PATCH 04/19] Add file and function header documentation across Controller, DataStore and Utility files --- .../controllers/ZenvyController.cpp | 39 +++++- .../controllers/ZenvyController.h | 7 + .../Trenser.Zenvy/datastores/DataStore.cpp | 61 ++++++++ .../Trenser.Zenvy/datastores/DataStore.h | 7 + .../Trenser.Zenvy/factories/Factory.h | 18 +++ Trenser.Zenvy/Trenser.Zenvy/utilities/Enums.h | 7 + .../Trenser.Zenvy/utilities/InputHelper.h | 33 ++++- .../Trenser.Zenvy/utilities/OutputHelper.cpp | 15 ++ .../Trenser.Zenvy/utilities/OutputHelper.h | 7 + .../Trenser.Zenvy/utilities/Timestamp.cpp | 131 ++++++++++++++++++ .../Trenser.Zenvy/utilities/Timestamp.h | 9 ++ .../Trenser.Zenvy/utilities/Validator.cpp | 38 +++++ .../Trenser.Zenvy/utilities/Validator.h | 7 + 13 files changed, 377 insertions(+), 2 deletions(-) diff --git a/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp b/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp index 3d97204..162bdd2 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp @@ -1,16 +1,53 @@ +/* + * File: ZenvyController.cpp + * Description : Controls data flow between UI and Service Layers. + * Author: Trenser + * Created : 01-04-2026 + */ + #include "ZenvyController.h" -//Authentication +/* + * Function: login + * Description: authenticates the employee based on email and password + * Parameters: + * email - email of the employee + * password - password of the employee + * Returns: + * Tuple - login status, employee type, employee designation + * login status - success or failed + * employee type - type of the employee logged in + * employee designation - designation if employee type is GENERAL. + */ + AuthenticationDTO ZenvyController::login(const std::string& email, const std::string& password) { return m_authenticationManagementService->login(email, password); } +/* + * Function: changePassword + * Description: updates the password of the currently authenticated employee. + * Parameters: + * password - the new password to be set for the employee + * Returns: + * void - no return value + */ + void ZenvyController::logout() { m_authenticationManagementService->logout(); } +/* + * Function: changePassword + * Description: updates the password of the currently authenticated employee. + * Parameters: + * password - the new password to be set for the employee + * Returns: + * void - no return value + */ + void ZenvyController::changePassword(const std::string& password) { m_authenticationManagementService->changePassword(password); diff --git a/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.h b/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.h index 1a5c77b..364ec49 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.h +++ b/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.h @@ -1,3 +1,10 @@ +/* + * File: ZenvyController.h + * Description : Controls data flow between UI and Service Layers. + * Author: Trenser + * Created : 01-04-2026 + */ + #pragma once #include #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp index 16ddca1..64694df 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp @@ -1,31 +1,92 @@ +/* + * File: DataStore.cpp + * Description: Central Storage for all the System Data. + * Author: Trenser + * Created: 01-04-2026 + */ + #include "DataStore.h" +/* + * Function: getInstance + * Description: provides a singleton instance of the DataStore. + * Parameters: + * None + * Returns: + * DataStore& - reference to the single DataStore object. + */ + DataStore& DataStore::getInstance() { static DataStore dataStore; return dataStore; } +/* + * Function: getLogs + * Description: retrieves the log map containing system logs. + * Parameters: + * None + * Returns: + * logMap& - reference to the log map. + */ + logMap& DataStore::getLogs() { return m_logs; } +/* + * Function: getAuthenticatedEmployee + * Description: returns the currently authenticated employee. + * Parameters: + * None + * Returns: + * std::shared_ptr& - reference to the authenticated employee object. + */ + std::shared_ptr& DataStore::getAuthenticatedEmployee() { return m_authenticatedEmployee; } +/* + * Function: setAuthenticatedEmployee + * Description: sets the currently authenticated employee. + * Parameters: + * authenticatedEmployee - shared pointer to the employee object to be set as authenticated. + * Returns: + * void - no return value. + */ + void DataStore::setAuthenticatedEmployee(std::shared_ptr authenticatedEmployee) { m_authenticatedEmployee = authenticatedEmployee; } +/* + * Function: getEmployees + * Description: retrieves the employee map containing all employees. + * Parameters: + * None + * Returns: + * employeeMap& - reference to the employee map. + */ + employeeMap& DataStore::getEmployees() { return m_employees; } +/* + * Function: getAuthenticatedUser + * Description: alias for getAuthenticatedEmployee, returns the currently authenticated employee. + * Parameters: + * None + * Returns: + * std::shared_ptr& - reference to the authenticated employee object. + */ + std::shared_ptr& DataStore::getAuthenticatedUser() { return m_authenticatedEmployee; diff --git a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h index 5ecfb70..603d49c 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h +++ b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h @@ -1,3 +1,10 @@ +/* + * File: DataStore.h + * Description: Central Storage for all the System Data. + * Author: Trenser + * Created: 01-04-2026 + */ + #pragma once #include #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h b/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h index 0c54b81..f65c267 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h +++ b/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h @@ -1,3 +1,10 @@ +/* + * File: Factory.h + * Description: Provides a generic factory utility to create shared_ptr instances of objects. + * Author: Ajmal J S + * Created: 01-04-2026 + */ + #pragma once #include #include @@ -5,6 +12,17 @@ class Factory { public: + + /* + * Function: getObject + * Description: Creates and returns a shared_ptr to an object of type T. + * Parameters: + * T - the type of object to be created + * Args - constructor arguments forwarded to T's constructor + * Returns: + * std::shared_ptr - a shared pointer managing the newly created object + */ + template static std::shared_ptr getObject(Args&&... args) { diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/Enums.h b/Trenser.Zenvy/Trenser.Zenvy/utilities/Enums.h index ace8792..0d5111b 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/Enums.h +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/Enums.h @@ -1,3 +1,10 @@ +/* + * File: Enums.h + * Description: Defines strongly typed enumerations for statuses, types, and designations used across the HRMS system. + * Author: Smitha + * Created: 01-04-2026 + */ + #pragma once namespace Enums { diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/InputHelper.h b/Trenser.Zenvy/Trenser.Zenvy/utilities/InputHelper.h index 559acda..5de0e35 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/InputHelper.h +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/InputHelper.h @@ -1,5 +1,11 @@ -#pragma once +/* + * File: InputHelper.h + * Description: Handles input validation and error handling + * Author: Smitha + * Created: 08-Apr-2026 + */ +#pragma once #include #include #include @@ -7,6 +13,15 @@ namespace util { + /* + * Function: read + * Description: Reads input from console into a variable of type T. + * Parameters: + * value - reference to a variable of type T where the input will be stored + * Returns: + * void - throws runtime_error if input is invalid + */ + template inline void read(T& value) { @@ -18,11 +33,27 @@ namespace util } } + /* + * Function: read + * Description: Reads a line of text input from console into a string. + * Parameters: + * value - reference to a string where the input will be stored + * Returns: + * void - no return value + */ + inline void read(std::string& value) { std::getline(std::cin >> std::ws, value); } + /* + * Function: pressEnter + * Description: Pauses execution until the user presses Enter. + * Parameters: None + * Returns: void - no return value + */ + inline void pressEnter() { system("pause"); diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/OutputHelper.cpp b/Trenser.Zenvy/Trenser.Zenvy/utilities/OutputHelper.cpp index a8e0f7c..ce37ac4 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/OutputHelper.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/OutputHelper.cpp @@ -1,5 +1,20 @@ +/* + * File: OutputHelper.cpp + * Description: Provides functions to help with console output. + * Author: Trenser + * Created: 01-04-2026 +*/ + #include "outputHelper.h" +/* +* Function: clear +* Description: Clears the console screen output. +* Parameters: None +* Returns: +* void - no return value +*/ + void util::clear() { std::cout << "\x1B[2J\x1B[H" << std::flush; diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/OutputHelper.h b/Trenser.Zenvy/Trenser.Zenvy/utilities/OutputHelper.h index a40dbaf..08a5b5f 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/OutputHelper.h +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/OutputHelper.h @@ -1,3 +1,10 @@ +/* + * File: OutputHelper.h + * Description: Provides functions to help with console output. + * Author: Trenser + * Created: 01-04-2026 +*/ + #pragma once #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/Timestamp.cpp b/Trenser.Zenvy/Trenser.Zenvy/utilities/Timestamp.cpp index 42d4758..3a51132 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/Timestamp.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/Timestamp.cpp @@ -1,18 +1,56 @@ +/* + * File: Timestamp.cpp + * Description: Provides a utility class for representing and manipulating time values. + * Supports conversion between string and time formats, duration calculations + * (hours, minutes, seconds), date extraction, and comparison operators. + * Author: Trenser + * Created: 01-Apr-2026 + */ + #include #include #include #include "Timestamp.h" +/* +* Function: Timestamp +* Description: Default constructor that initializes the timestamp to the current system time. +* Parameters: +* None +* Returns: +* Timestamp object +*/ + util::Timestamp::Timestamp() { m_time = std::time(nullptr); } +/* +* Function: Timestamp (overloaded) +* Description: Constructor that initializes the timestamp with a given time value. +* Parameters: +* timeValue - time_t value representing a specific time +* Returns: +* Timestamp object +*/ + util::Timestamp::Timestamp(std::time_t timeValue) { m_time = timeValue; } +/* +* Function: fromString +* Description: Creates a Timestamp object from a formatted string. +* Parameters: +* timeString - string in the format "YYYY-MM-DD HH:MM:SS" +* Returns: +* Timestamp object representing the parsed time +* Throws: +* runtime_error if the string format is invalid +*/ + util::Timestamp util::Timestamp::fromString(const std::string& timeString) { std::tm timeStruct = {}; @@ -26,6 +64,15 @@ util::Timestamp util::Timestamp::fromString(const std::string& timeString) return Timestamp(parsedTimestamp); } +/* +* Function: toString +* Description: Converts the Timestamp object into a formatted string. +* Parameters: +* None +* Returns: +* string - formatted as "YYYY-MM-DD HH:MM:SS" +*/ + std::string util::Timestamp::toString() const { std::tm timeStruct = {}; @@ -35,11 +82,30 @@ std::string util::Timestamp::toString() const return outputStream.str(); } +/* +* Function: getDurationInSeconds +* Description: Calculates the duration between two timestamps in seconds. +* Parameters: +* startTimestamp - starting time +* endTimestamp - ending time +* Returns: +* double - duration in seconds +*/ + double util::Timestamp::getDurationInSeconds(const Timestamp& startTimestamp, const Timestamp& endTimestamp) { return std::difftime(endTimestamp.m_time, startTimestamp.m_time); } +/* +* Function: getDateAsInt +* Description: Returns the date portion of the timestamp as an integer in YYYYMMDD format. +* Parameters: +* None +* Returns: +* int - date as YYYYMMDD +*/ + int util::Timestamp::getDateAsInt() const { std::tm timeStruct{}; @@ -50,36 +116,101 @@ int util::Timestamp::getDateAsInt() const return year * 10000 + month * 100 + day; } +/* +* Function: getDurationInMinutes +* Description: Calculates the duration between two timestamps in minutes. +* Parameters: +* startTimestamp - starting time +* endTimestamp - ending time +* Returns: +* double - duration in minutes +*/ + double util::Timestamp::getDurationInMinutes(const Timestamp& startTimestamp, const Timestamp& endTimestamp) { return getDurationInSeconds(startTimestamp, endTimestamp) / 60.0; } +/* +* Function: getDurationInHours +* Description: Calculates the duration between two timestamps in hours. +* Parameters: +* startTimestamp - starting time +* endTimestamp - ending time +* Returns: +* double - duration in hours +*/ + double util::Timestamp::getDurationInHours(const Timestamp& startTimestamp, const Timestamp& endTimestamp) { return getDurationInSeconds(startTimestamp, endTimestamp) / 3600.0; } +/* +* Function: operator< +* Description: Compares two timestamps to check if one is earlier than the other. +* Parameters: +* other - Timestamp to compare against +* Returns: +* bool - true if current timestamp is earlier +*/ + bool util::Timestamp::operator<(const Timestamp& other) const { return m_time < other.m_time; } +/* +* Function: operator> +* Description: Compares two timestamps to check if one is later than the other. +* Parameters: +* other - Timestamp to compare against +* Returns: +* bool - true if current timestamp is later +*/ + bool util::Timestamp::operator>(const Timestamp& other) const { return m_time > other.m_time; } +/* +* Function: operator<= +* Description: Compares two timestamps to check if one is earlier or equal. +* Parameters: +* other - Timestamp to compare against +* Returns: +* bool - true if current timestamp is earlier or equal +*/ + bool util::Timestamp::operator<=(const Timestamp& other) const { return m_time <= other.m_time; } +/* +* Function: operator>= +* Description: Compares two timestamps to check if one is later or equal. +* Parameters: +* other - Timestamp to compare against +* Returns: +* bool - true if current timestamp is later or equal +*/ + bool util::Timestamp::operator>=(const Timestamp& other) const { return m_time >= other.m_time; } +/* +* Function: operator== +* Description: Compares two timestamps for equality. +* Parameters: +* other - Timestamp to compare against +* Returns: +* bool - true if both timestamps are equal +*/ + bool util::Timestamp::operator==(const Timestamp& other) const { return m_time == other.m_time; diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/Timestamp.h b/Trenser.Zenvy/Trenser.Zenvy/utilities/Timestamp.h index abbc58f..ace001a 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/Timestamp.h +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/Timestamp.h @@ -1,3 +1,12 @@ +/* + * File: Timestamp.h + * Description: Provides a utility class for representing and manipulating time values. + * Supports conversion between string and time formats, duration calculations + * (hours, minutes, seconds), date extraction, and comparison operators. + * Author: Trenser + * Created: 01-Apr-2026 + */ + #pragma once #include #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.cpp b/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.cpp index 9d14b40..8510bdf 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.cpp @@ -1,8 +1,24 @@ +/* + * File: Validator.cpp + * Description: Validates inputs like phone number, email, password + * Author: Trenser + * Created: 01-Apr-2026 + */ + #include #include #include "Validator.h" #include "ApplicationConfig.h" + /* + * Function: isPhoneNumberValid + * Description: Validates whether the given string is a valid phone number. + * Parameters: + * phoneNumber - string containing the phone number to validate + * Returns: + * bool - true if the phone number is valid (10 digits, all numeric), false otherwise + */ + bool util::isPhoneNumberValid(const std::string& phoneNumber) { if (phoneNumber.size() != 10) { @@ -16,6 +32,15 @@ bool util::isPhoneNumberValid(const std::string& phoneNumber) { ); } +/* + * Function: isEmailValid + * Description: Validates whether the given string is a properly formatted email address. + * Parameters: + * email - string containing the email address to validate + * Returns: + * bool - true if the email contains exactly one '@' character and is not at the start or end, false otherwise + */ + bool util::isEmailValid(const std::string& email) { size_t index = email.find('@'); if (index == std::string::npos) return false; @@ -30,6 +55,19 @@ bool util::isEmailValid(const std::string& email) { return true; } +/* + * Function: isPasswordValid + * Description: Validates whether the given string meets password requirements. + * Parameters: + * password - string containing the password to validate + * Returns: + * bool - true if the password is valid, false otherwise + * Notes: + * - Must not equal the default password + * - Must be at least 8 characters long + * - Must contain at least one uppercase letter, one lowercase letter, one digit, and one special character + * - Must not contain whitespace + */ bool util::isPasswordValid(const std::string& password) { diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.h b/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.h index fbdf962..3710604 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.h +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.h @@ -1,3 +1,10 @@ +/* + * File: Validator.h + * Description: Validates inputs like phone number, email, password + * Author: Trenser + * Created: 01-Apr-2026 + */ + #pragma once #include #include From 6c05d2b35271c12c7015122f67674168ac172c33 Mon Sep 17 00:00:00 2001 From: Jissin Sam Mathew Date: Wed, 8 Apr 2026 17:29:01 +0530 Subject: [PATCH 05/19] Add files and function header documentation across Views --- .../Trenser.Zenvy/views/AdminMenu.cpp | 25 +++++++++++++++ Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h | 7 ++++ .../Trenser.Zenvy/views/EmployeeMenu.cpp | 24 ++++++++++++++ .../Trenser.Zenvy/views/EmployeeMenu.h | 7 ++++ .../views/FinanceExecutiveMenu.cpp | 24 ++++++++++++++ .../views/FinanceExecutiveMenu.h | 7 ++++ .../Trenser.Zenvy/views/HRManagerMenu.cpp | 24 ++++++++++++++ .../Trenser.Zenvy/views/HRManagerMenu.h | 7 ++++ .../Trenser.Zenvy/views/ITExecutiveMenu.cpp | 24 ++++++++++++++ .../Trenser.Zenvy/views/ITExecutiveMenu.h | 7 ++++ .../views/TalentExecutiveMenu.cpp | 24 ++++++++++++++ .../Trenser.Zenvy/views/TalentExecutiveMenu.h | 7 ++++ .../Trenser.Zenvy/views/TeamExecutiveMenu.cpp | 24 ++++++++++++++ .../Trenser.Zenvy/views/TeamExecutiveMenu.h | 7 ++++ .../Trenser.Zenvy/views/TeamLeadMenu.cpp | 24 ++++++++++++++ .../Trenser.Zenvy/views/TeamLeadMenu.h | 7 ++++ .../Trenser.Zenvy/views/UserInterface.cpp | 32 +++++++++++++++++++ .../Trenser.Zenvy/views/UserInterface.h | 7 ++++ 18 files changed, 288 insertions(+) diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.cpp index ecad349..91a2445 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.cpp @@ -1,8 +1,24 @@ +/* + * File: AdminMenu.cpp + * Description: Handles user-related operations such as creation, authentication, and validation. + * Author: Trenser + * Created: 02-Apr-2026 + */ + #include #include "AdminMenu.h" #include"InputHelper.h" #include"OutputHelper.h" + /* + * Function: AdminMenu::run + * Description: Starts and manages the administrator menu loop. Continuously displays + * options to the administrator until logout is selected or an exception occurs. + * Parameters: + * None + * Returns: + * None + */ void AdminMenu::run() { bool isMenuActive = true; @@ -27,6 +43,15 @@ void AdminMenu::run() } } +/* + * Function: AdminMenu::handleOperation + * Description: Processes the administrator’s menu choice and executes the corresponding action. + * Parameters: + * choice - integer representing the selected menu option + * Returns: + * true - if the menu should remain active + * false - if the administrator chooses to logout + */ bool AdminMenu::handleOperation(int choice) { switch (choice) diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h index dab23c5..ed6a48b 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h @@ -1,3 +1,10 @@ +/* + * File: AdminMenu.h + * Description: Declaration of the AdminMenu class and related functions. + * Author: Trenser + * Created: 02-Apr-2026 + */ + #pragma once #include #include"ZenvyController.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.cpp index 99e3bc0..4a0dd07 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.cpp @@ -1,8 +1,23 @@ +/* + * File: EmployeeMenu.cpp + * Description: Implements the EmployeeMenu class functions including menu loop and operation handling. + * Author: Trenser + * Created: 02-Apr-2026 + */ + #include #include "EmployeeMenu.h" #include"InputHelper.h" #include"OutputHelper.h" + /* + * Function: EmployeeMenu::run + * Description: Starts the employee menu loop and displays available options until logout is selected + * Parameters: + * None + * Returns: + * None + */ void EmployeeMenu::run() { bool isMenuActive = true; @@ -27,6 +42,15 @@ void EmployeeMenu::run() } } +/* + * Function: EmployeeMenu::handleOperation + * Description: Handles the employee’s menu choice and executes the corresponding action + * Parameters: + * choice - integer representing the selected menu option + * Returns: + * true - if the menu should remain active + * false - if the employee chooses to logout + */ bool EmployeeMenu::handleOperation(int choice) { switch (choice) diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.h index f082b66..8611935 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.h @@ -1,3 +1,10 @@ +/* + * File: EmployeeMenu.h + * Description: Declaration of the EmployeeMenu class and related functions. + * Author: Trenser + * Created: 02-Apr-2026 + */ + #pragma once #include #include"ZenvyController.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.cpp index 081d281..4503969 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.cpp @@ -1,8 +1,23 @@ +/* + * File: FinanceExecutiveMenu.cpp + * Description: Implements the FinanceExecutiveMenu class functions including menu loop and operation handling. + * Author: Trenser + * Created: 02-Apr-2026 + */ + #include #include "FinanceExecutiveMenu.h" #include"InputHelper.h" #include"OutputHelper.h" +/* + * Function: FinanceExecutiveMenu::run + * Description: Starts the finance executive menu loop and displays available options until logout is selected + * Parameters: + * None + * Returns: + * None + */ void FinanceExecutiveMenu::run() { bool isMenuActive = true; @@ -27,6 +42,15 @@ void FinanceExecutiveMenu::run() } } +/* + * Function: FinanceExecutiveMenu::handleOperation + * Description: Handles the finance executive’s menu choice and executes the corresponding action + * Parameters: + * choice - integer representing the selected menu option + * Returns: + * true - if the menu should remain active + * false - if the finance executive chooses to logout + */ bool FinanceExecutiveMenu::handleOperation(int choice) { switch (choice) diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.h index 825322f..d1c4d77 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.h @@ -1,3 +1,10 @@ +/* + * File: FinanceExecutiveMenu.h + * Description: Declaration of the FinanceExecutiveMenu class and related functions. + * Author: Trenser + * Created: 02-Apr-2026 + */ + #pragma once #include #include"ZenvyController.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.cpp index 7bf812c..dff562a 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.cpp @@ -1,8 +1,23 @@ +/* + * File: HRManagerMenu.cpp + * Description: Implements the HRManagerMenu class functions including menu loop and operation handling. + * Author: Trenser + * Created: 02-Apr-2026 + */ + #include #include "HRManagerMenu.h" #include"InputHelper.h" #include"OutputHelper.h" +/* + * Function: HRManagerMenu::run + * Description: Starts the HR manager menu loop and displays available options until logout is selected + * Parameters: + * None + * Returns: + * None + */ void HRManagerMenu::run() { bool isMenuActive = true; @@ -27,6 +42,15 @@ void HRManagerMenu::run() } } +/* + * Function: HRManagerMenu::handleOperation + * Description: Handles the HR manager’s menu choice and executes the corresponding action + * Parameters: + * choice - integer representing the selected menu option + * Returns: + * true - if the menu should remain active + * false - if the HR manager chooses to logout + */ bool HRManagerMenu::handleOperation(int choice) { switch (choice) diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.h index 05e1f41..a3c1ff1 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.h @@ -1,3 +1,10 @@ +/* + * File: HRManagerMenu.h + * Description: Declaration of the EmployeeMenu class and related functions. + * Author: Trenser + * Created: 02-Apr-2026 + */ + #pragma once #include #include"ZenvyController.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.cpp index 836ca39..b415d57 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.cpp @@ -1,8 +1,23 @@ +/* + * File: ITExecutiveMenu.cpp + * Description: Implements the ITExecutiveMenu class functions including menu loop and operation handling. + * Author: Trenser + * Created: 02-Apr-2026 + */ + #include #include "ITExecutiveMenu.h" #include"InputHelper.h" #include"OutputHelper.h" +/* + * Function: ITExecutiveMenu::run + * Description: Starts the IT executive menu loop and displays available options until logout is selected + * Parameters: + * None + * Returns: + * None + */ void ITExecutiveMenu::run() { bool isMenuActive = true; @@ -27,6 +42,15 @@ void ITExecutiveMenu::run() } } +/* + * Function: ITExecutiveMenu::handleOperation + * Description: Handles the IT executive’s menu choice and executes the corresponding action + * Parameters: + * choice - integer representing the selected menu option + * Returns: + * true - if the menu should remain active + * false - if the IT executive chooses to logout + */ bool ITExecutiveMenu::handleOperation(int choice) { switch (choice) diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.h index 1c5f060..7447643 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.h @@ -1,3 +1,10 @@ +/* + * File: ITExecutiveMenu.h + * Description: Declaration of the ITExecutiveMenu class and related functions. + * Author: Trenser + * Created: 02-Apr-2026 + */ + #pragma once #include #include"ZenvyController.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.cpp index 45fbfba..250da5a 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.cpp @@ -1,8 +1,23 @@ +/* + * File: TalentExecutiveMenu.cpp + * Description: Implements the TalentExecutiveMenu class functions including menu loop and operation handling. + * Author: Trenser + * Created: 02-Apr-2026 + */ + #include #include "TalentExecutiveMenu.h" #include"InputHelper.h" #include"OutputHelper.h" +/* + * Function: TalentExecutiveMenu::run + * Description: Starts the talent executive menu loop and displays available options until logout is selected + * Parameters: + * None + * Returns: + * None + */ void TalentExecutiveMenu::run() { bool isMenuActive = true; @@ -27,6 +42,15 @@ void TalentExecutiveMenu::run() } } +/* + * Function: TalentExecutiveMenu::handleOperation + * Description: Handles the talent executive’s menu choice and executes the corresponding action + * Parameters: + * choice - integer representing the selected menu option + * Returns: + * true - if the menu should remain active + * false - if the talent executive chooses to logout + */ bool TalentExecutiveMenu::handleOperation(int choice) { switch (choice) diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.h index a258eaf..7cbee73 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.h @@ -1,3 +1,10 @@ +/* + * File: TalentExecutiveMenu.h + * Description: Declaration of the TalentExecutiveMenu class and related functions. + * Author: Trenser + * Created: 02-Apr-2026 + */ + #pragma once #include #include"ZenvyController.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.cpp index 12c300b..97401b2 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.cpp @@ -1,8 +1,23 @@ +/* + * File: TeamExecutiveMenu.cpp + * Description: Implements the TeamExecutiveMenu class functions including menu loop and operation handling. + * Author: Trenser + * Created: 02-Apr-2026 + */ + #include #include "TeamExecutiveMenu.h" #include"InputHelper.h" #include"OutputHelper.h" +/* + * Function: TeamExecutiveMenu::run + * Description: Starts the team executive menu loop and displays available options until logout is selected + * Parameters: + * None + * Returns: + * None + */ void TeamExecutiveMenu::run() { bool isMenuActive = true; @@ -27,6 +42,15 @@ void TeamExecutiveMenu::run() } } +/* + * Function: TeamExecutiveMenu::handleOperation + * Description: Handles the team executive’s menu choice and executes the corresponding action + * Parameters: + * choice - integer representing the selected menu option + * Returns: + * true - if the menu should remain active + * false - if the team executive chooses to logout + */ bool TeamExecutiveMenu::handleOperation(int choice) { switch (choice) diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.h index 4b5181d..3f6d5f3 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.h @@ -1,3 +1,10 @@ +/* + * File: TeamExecutiveMenu.h + * Description: Declaration of the TeamExecutiveMenu and related functions. + * Author: Trenser + * Created: 02-Apr-2026 + */ + #pragma once #include #include"ZenvyController.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.cpp index 4204fb7..31143d1 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.cpp @@ -1,8 +1,23 @@ +/* + * File: TeamLeadMenu.cpp + * Description: Implements the TeamLeadMenu class functions including menu loop and operation handling. + * Author: Trenser + * Created: 02-Apr-2026 + */ + #include #include "TeamLeadMenu.h" #include"InputHelper.h" #include"OutputHelper.h" +/* + * Function: TeamLeadMenu::run + * Description: Starts the team lead menu loop and displays available options until logout is selected + * Parameters: + * None + * Returns: + * None + */ void TeamLeadMenu::run() { bool isMenuActive = true; @@ -27,6 +42,15 @@ void TeamLeadMenu::run() } } +/* + * Function: TeamLeadMenu::handleOperation + * Description: Handles the team lead’s menu choice and executes the corresponding action + * Parameters: + * choice - integer representing the selected menu option + * Returns: + * true - if the menu should remain active + * false - if the team lead chooses to logout + */ bool TeamLeadMenu::handleOperation(int choice) { switch (choice) diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.h index e1bd45b..d2057aa 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.h @@ -1,3 +1,10 @@ +/* + * File: TeamLeadMenu.h + * Description: Declaration of the TeamLeadMenu class and related functions. + * Author: Trenser + * Created: 02-Apr-2026 + */ + #pragma once #include #include"ZenvyController.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.cpp index adea852..1f08092 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.cpp @@ -1,3 +1,10 @@ +/* + * File: UserInterface.cpp + * Description: Implements the UserInterface class functions including menu loop, login handling, and routing to appropriate role-based menus. + * Author: Trenser + * Created: 02-Apr-2026 + */ + #include #include #include @@ -16,6 +23,14 @@ #include "OutputHelper.h" #include "Validator.h" +/* + * Function: UserInterface::run + * Description: Starts the user interface loop and displays login/exit options until exit is selected + * Parameters: + * None + * Returns: + * None + */ void UserInterface::run() { bool isMenuActive = true; @@ -40,6 +55,15 @@ void UserInterface::run() } } +/* + * Function: UserInterface::handleOperation + * Description: Handles the user’s menu choice and executes the corresponding action + * Parameters: + * choice - integer representing the selected menu option + * Returns: + * true - if the interface should remain active + * false - if the user chooses to exit + */ bool UserInterface::handleOperation(int choice) { switch (choice) @@ -57,6 +81,14 @@ bool UserInterface::handleOperation(int choice) return true; } +/* + * Function: UserInterface::login + * Description: Authenticates the user by email and password, validates login status, and routes to the appropriate menu + * Parameters: + * None + * Returns: + * None + */ void UserInterface::login() { std::string email, password; diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.h b/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.h index c346301..cf9c924 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.h @@ -1,3 +1,10 @@ +/* + * File: UserInterface.h + * Description: Declaration of the UserInterface class and related functions. + * Author: Trenser + * Created: 02-Apr-2026 + */ + #pragma once #include #include From 75b69f8c11d25052dcdb163b282fadbb9c017e3f Mon Sep 17 00:00:00 2001 From: Tinu Johnson Date: Fri, 10 Apr 2026 15:00:31 +0530 Subject: [PATCH 06/19] Convert shared pointer to raw pointer --- .../controllers/ZenvyController.cpp | 14 +++++ .../controllers/ZenvyController.h | 52 +++++++++---------- .../Trenser.Zenvy/datastores/DataStore.cpp | 6 +-- .../Trenser.Zenvy/datastores/DataStore.h | 13 +++-- .../Trenser.Zenvy/factories/Factory.h | 5 +- .../Trenser.Zenvy/models/Booking.cpp | 4 +- Trenser.Zenvy/Trenser.Zenvy/models/Booking.h | 12 ++--- .../Trenser.Zenvy/models/Employee.cpp | 10 ++-- Trenser.Zenvy/Trenser.Zenvy/models/Employee.h | 21 ++++---- .../Trenser.Zenvy/models/GeneralEmployee.h | 2 +- .../Trenser.Zenvy/models/JobListing.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Room.h | 4 +- Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp | 4 +- Trenser.Zenvy/Trenser.Zenvy/models/Team.h | 10 ++-- .../AuthenticationManagementService.cpp | 12 +++-- .../Trenser.Zenvy/services/LogService.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h | 5 +- .../Trenser.Zenvy/views/EmployeeMenu.h | 5 +- .../views/FinanceExecutiveMenu.h | 5 +- .../Trenser.Zenvy/views/HRManagerMenu.h | 5 +- .../Trenser.Zenvy/views/ITExecutiveMenu.h | 5 +- .../Trenser.Zenvy/views/TalentExecutiveMenu.h | 5 +- .../Trenser.Zenvy/views/TeamExecutiveMenu.h | 5 +- .../Trenser.Zenvy/views/TeamLeadMenu.h | 5 +- .../Trenser.Zenvy/views/UserInterface.cpp | 15 +++++- .../Trenser.Zenvy/views/UserInterface.h | 48 ++++++++--------- 27 files changed, 145 insertions(+), 133 deletions(-) diff --git a/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp b/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp index 162bdd2..ec69829 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp @@ -52,3 +52,17 @@ void ZenvyController::changePassword(const std::string& password) { m_authenticationManagementService->changePassword(password); } + +ZenvyController::~ZenvyController() +{ + delete m_authenticationManagementService; + delete m_attendanceManagementService; + delete m_bookingManagementService; + delete m_employeeManagememtService; + delete m_leaveManagementService; + delete m_notificationManagementService; + delete m_payslipManagementService; + delete m_talentAcquisitionManagementService; + delete m_teamManagementService; + delete m_ticketManagementService; +} diff --git a/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.h b/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.h index 364ec49..e456409 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.h +++ b/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.h @@ -6,7 +6,6 @@ */ #pragma once -#include #include #include "AuthenticationManagementService.h" #include "AttendanceManagementService.h" @@ -23,31 +22,30 @@ class ZenvyController { private: - std::shared_ptr m_authenticationManagementService; - std::shared_ptr m_attendanceManagementService; - std::shared_ptr m_bookingManagementService; - std::shared_ptr m_employeeManagememtService; - std::shared_ptr m_leaveManagementService; - std::shared_ptr m_notificationManagementService; - std::shared_ptr m_payslipManagementService; - std::shared_ptr m_talentAcquisitionManagementService; - std::shared_ptr m_teamManagementService; - std::shared_ptr m_ticketManagementService; + AuthenticationManagementService* m_authenticationManagementService; + AttendanceManagementService* m_attendanceManagementService; + BookingManagementService* m_bookingManagementService; + EmployeeManagememtService* m_employeeManagememtService; + LeaveManagementService* m_leaveManagementService; + NotificationManagementService* m_notificationManagementService; + PayslipManagementService* m_payslipManagementService; + TalentAcquisitionManagementService* m_talentAcquisitionManagementService; + TeamManagementService* m_teamManagementService; + TicketManagementService* m_ticketManagementService; public: - ZenvyController() : - m_authenticationManagementService(std::make_shared()), - m_attendanceManagementService(std::make_shared()), - m_bookingManagementService(std::make_shared()), - m_employeeManagememtService(std::make_shared()), - m_leaveManagementService(std::make_shared()), - m_notificationManagementService(std::make_shared()), - m_payslipManagementService(std::make_shared()), - m_talentAcquisitionManagementService(std::make_shared()), - m_teamManagementService(std::make_shared()), - m_ticketManagementService(std::make_shared()) {}; - - //Authentication - AuthenticationDTO login(const std::string& email, const std::string& password); - void logout(); - void changePassword(const std::string&); + ZenvyController() : + m_authenticationManagementService(new AuthenticationManagementService()), + m_attendanceManagementService(new AttendanceManagementService()), + m_bookingManagementService(new BookingManagementService()), + m_employeeManagememtService(new EmployeeManagememtService()), + m_leaveManagementService(new LeaveManagementService()), + m_notificationManagementService(new NotificationManagementService()), + m_payslipManagementService(new PayslipManagementService()), + m_talentAcquisitionManagementService(new TalentAcquisitionManagementService()), + m_teamManagementService(new TeamManagementService()), + m_ticketManagementService(new TicketManagementService()) {}; + AuthenticationDTO login(const std::string& email, const std::string& password); + void logout(); + void changePassword(const std::string&); + ~ZenvyController(); }; diff --git a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp index 64694df..eb2a3b5 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp @@ -45,7 +45,7 @@ logMap& DataStore::getLogs() * std::shared_ptr& - reference to the authenticated employee object. */ -std::shared_ptr& DataStore::getAuthenticatedEmployee() +Employee*& DataStore::getAuthenticatedEmployee() { return m_authenticatedEmployee; } @@ -59,7 +59,7 @@ std::shared_ptr& DataStore::getAuthenticatedEmployee() * void - no return value. */ -void DataStore::setAuthenticatedEmployee(std::shared_ptr authenticatedEmployee) +void DataStore::setAuthenticatedEmployee(Employee* authenticatedEmployee) { m_authenticatedEmployee = authenticatedEmployee; } @@ -87,7 +87,7 @@ employeeMap& DataStore::getEmployees() * std::shared_ptr& - reference to the authenticated employee object. */ -std::shared_ptr& DataStore::getAuthenticatedUser() +Employee* DataStore::getAuthenticatedUser() { return m_authenticatedEmployee; } diff --git a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h index 603d49c..86e304e 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h +++ b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h @@ -6,7 +6,6 @@ */ #pragma once -#include #include #include "Employee.h" #include "Log.h" @@ -26,13 +25,13 @@ #include "Announcement.h" #include "Faq.h" -using employeeMap = std::map>; -using logMap = std::map>; +using employeeMap = std::map; +using logMap = std::map; class DataStore { private: - std::shared_ptr m_authenticatedEmployee; + Employee* m_authenticatedEmployee; employeeMap m_employees; logMap m_logs; DataStore() = default; @@ -43,8 +42,8 @@ public: DataStore(DataStore&&) = delete; DataStore& operator=(DataStore&&) = delete; employeeMap& getEmployees(); - std::shared_ptr& getAuthenticatedUser(); + Employee* getAuthenticatedUser(); logMap& getLogs(); - std::shared_ptr& getAuthenticatedEmployee(); - void setAuthenticatedEmployee(std::shared_ptr < Employee>); + Employee*& getAuthenticatedEmployee(); + void setAuthenticatedEmployee(Employee*); }; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h b/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h index f65c267..604a3f0 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h +++ b/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h @@ -6,7 +6,6 @@ */ #pragma once -#include #include class Factory @@ -24,8 +23,8 @@ public: */ template - static std::shared_ptr getObject(Args&&... args) + static T* getObject(Args&&... args) { - return std::make_shared(std::forward(args)...); + return T*(std::forward(args)...); } }; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Booking.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Booking.cpp index 6689689..5ac6682 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Booking.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Booking.cpp @@ -26,7 +26,7 @@ const std::string& Booking::getEmployeeId() const return m_employeeId; } -std::shared_ptr Booking::getTeam() const +Team* Booking::getTeam() const { return m_team; } @@ -51,7 +51,7 @@ void Booking::setEmployeeId(const std::string& employeeId) m_employeeId = employeeId; } -void Booking::setTeam(std::shared_ptr team) +void Booking::setTeam(Team* team) { m_team = team; } diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Booking.h b/Trenser.Zenvy/Trenser.Zenvy/models/Booking.h index f88c084..d99a5f3 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Booking.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Booking.h @@ -6,7 +6,6 @@ */ #pragma once #include -#include #include "Team.h" #include "Timestamp.h" @@ -17,25 +16,24 @@ private: util::Timestamp m_startTime; util::Timestamp m_endTime; std::string m_employeeId; - std::shared_ptr m_team; + Team* m_team; public: - Booking() : m_id(""), m_startTime(), m_endTime(), m_employeeId(""), m_team(nullptr) {} + Booking() : m_id(""), m_startTime(), m_endTime(), m_employeeId(""), m_team(nullptr) {}; Booking(const std::string& id, const util::Timestamp& startTime, const util::Timestamp& endTime, const std::string& employeeId, - std::shared_ptr team) - : m_id(id), m_startTime(startTime), m_endTime(endTime), m_employeeId(employeeId), m_team(team) {} + Team* team) : m_id(id), m_startTime(startTime), m_endTime(endTime), m_employeeId(employeeId), m_team(team) {}; const std::string& getBookingId() const; const util::Timestamp& getStartTime() const; const util::Timestamp& getEndTime() const; const std::string& getEmployeeId() const; - std::shared_ptr getTeam() const; + Team* getTeam() const; void setBookingId(const std::string& id); void setStartTime(const util::Timestamp& startTime); void setEndTime(const util::Timestamp& endTime); void setEmployeeId(const std::string& employeeId); - void setTeam(std::shared_ptr team); + void setTeam(Team* team); double getDurationInHours() const; double getDurationInMinutes() const; }; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp index 68c1963..a2b426e 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp @@ -46,7 +46,7 @@ const std::string& Employee::getEmployeeTeamId() const return m_teamId; } -std::shared_ptr Employee::getPayroll() const +Payroll* Employee::getPayroll() const { return m_payroll; } @@ -101,12 +101,12 @@ void Employee::setEmployeeTeamId(const std::string& teamId) m_teamId = teamId; } -void Employee::setEmployeePayroll(std::shared_ptr payroll) +void Employee::setEmployeePayroll(Payroll* payroll) { m_payroll = payroll; } -void Employee::addPayslip(std::shared_ptr payslip) +void Employee::addPayslip(Payslip* payslip) { if (payslip) { @@ -114,7 +114,7 @@ void Employee::addPayslip(std::shared_ptr payslip) } } -void Employee::addAttendance(std::shared_ptr attendance) +void Employee::addAttendance(Attendance* attendance) { if (attendance) { @@ -122,7 +122,7 @@ void Employee::addAttendance(std::shared_ptr attendance) } } -void Employee::addLeave(std::shared_ptr leave) +void Employee::addLeave(Leave* leave) { if (leave) { diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Employee.h b/Trenser.Zenvy/Trenser.Zenvy/models/Employee.h index 400eebd..e7ce4c7 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Employee.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Employee.h @@ -6,16 +6,15 @@ */ #pragma once #include -#include #include #include "Payslip.h" #include "Attendance.h" #include "Leave.h" #include "Payroll.h" #include "Enums.h" -using payslipMap = std::map>; -using attendanceMap = std::map>>; -using leaveMap = std::map>; +using payslipMap = std::map; +using attendanceMap = std::map>; +using leaveMap = std::map; class Employee { @@ -28,7 +27,7 @@ private: Enums::AccountStatus m_accountStatus; Enums::TeamStatus m_teamStatus; std::string m_teamId; - std::shared_ptr m_payroll; + Payroll* m_payroll; payslipMap m_payslips; attendanceMap m_attendances; leaveMap m_leaves; @@ -42,7 +41,7 @@ public: const std::string& email, const std::string& teamId, Enums::EmployeeType employeeType, - std::shared_ptr payroll) + Payroll* payroll) : m_id(id), m_password(password), m_name(name), m_phone(phone), m_email(email), m_accountStatus(Enums::AccountStatus::ACTIVE), m_teamStatus(Enums::TeamStatus::NOT_IN_TEAM), m_teamId(teamId), m_employeeType(employeeType), m_payroll(payroll) { } const std::string& getEmployeeId() const; const std::string& getEmployeePassword() const; @@ -52,7 +51,7 @@ public: Enums::AccountStatus getEmployeeAccountStatus() const; Enums::TeamStatus getEmployeeTeamStatus() const; const std::string& getEmployeeTeamId() const; - std::shared_ptr getPayroll() const; + Payroll* getPayroll() const; const payslipMap& getEmployeePayslips() const; const attendanceMap& getEmployeeAttendances() const; const leaveMap& getEmployeeLeaves() const; @@ -63,10 +62,10 @@ public: void setEmployeeAccountStatus(Enums::AccountStatus status); void setEmployeeTeamStatus(Enums::TeamStatus status); void setEmployeeTeamId(const std::string& teamId); - void setEmployeePayroll(std::shared_ptr payroll); - void addPayslip(std::shared_ptr payslip); - void addAttendance(std::shared_ptr attendance); - void addLeave(std::shared_ptr leave); + void setEmployeePayroll(Payroll* payroll); + void addPayslip(Payslip* payslip); + void addAttendance(Attendance* attendance); + void addLeave(Leave* leave); Enums::EmployeeType getEmployeeType() const; virtual ~Employee() = default; }; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.h b/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.h index 2c40288..93a7d06 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.h @@ -20,7 +20,7 @@ public: const std::string& phone, const std::string& email, const std::string& teamId, - std::shared_ptr payroll, + Payroll* payroll, Enums::EmployeeDesignation designation) : Employee(id, password, name, phone, email, teamId,Enums::EmployeeType::GENERAL, payroll), m_designation(designation) {} Enums::EmployeeDesignation getDesignation() const; void setDesignation(Enums::EmployeeDesignation designation); diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h b/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h index 10b6c57..db016a0 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h @@ -11,7 +11,7 @@ File: JobListing.h #include #include "Candidate.h" #include "Enums.h" -using candidateMap = std::map>; +using candidateMap = std::map; class JobListing { diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp index cb5abbb..0d697ed 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp @@ -33,7 +33,7 @@ void Room::setRoomName(const std::string& name) m_name = name; } -void Room::addBooking(std::shared_ptr booking) +void Room::addBooking(Booking* booking) { if (booking) { diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Room.h b/Trenser.Zenvy/Trenser.Zenvy/models/Room.h index 595ffaa..c412b58 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Room.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Room.h @@ -10,7 +10,7 @@ File: Room.h #include #include #include "Booking.h" -using bookingMap = std::map>; +using bookingMap = std::map; class Room { @@ -26,5 +26,5 @@ public: const bookingMap& getBookings() const; void setRoomId(const std::string& id); void setRoomName(const std::string& name); - void addBooking(std::shared_ptr booking); + void addBooking(Booking* booking); }; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp index 4a26647..7ce86c2 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp @@ -18,7 +18,7 @@ const std::string& Team::getTeamName() const return m_name; } -std::shared_ptr Team::getTeamLead() const +Employee* Team::getTeamLead() const { return m_lead; } @@ -43,7 +43,7 @@ void Team::setTeamName(const std::string& name) m_name = name; } -void Team::setTeamLead(std::shared_ptr lead) +void Team::setTeamLead(Employee* lead) { m_lead = lead; } diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Team.h b/Trenser.Zenvy/Trenser.Zenvy/models/Team.h index e353aa3..7e3d818 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Team.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Team.h @@ -10,32 +10,32 @@ File: Team.h #include #include #include "Employee.h" -using employeeMap = std::map>; +using employeeMap = std::map; class Team { private: std::string m_id; std::string m_name; - std::shared_ptr m_lead; + Employee* m_lead; employeeMap m_employees; int m_maximumNumberOfEmployees; public: Team() : m_id(""), m_name(""), m_lead(nullptr), m_maximumNumberOfEmployees(0) {} Team(const std::string& id, const std::string& name, - std::shared_ptr lead, + Employee* lead, int maximumNumberOfEmployees) : m_id(id), m_name(name), m_lead(lead), m_maximumNumberOfEmployees(maximumNumberOfEmployees) { } const std::string& getTeamId() const; const std::string& getTeamName() const; - std::shared_ptr getTeamLead() const; + Employee* getTeamLead() const; const employeeMap& getEmployeesInTeam() const; int getMaximumNumberOfEmployeesInTeam() const; void setTeamId(const std::string& id); void setTeamName(const std::string& name); - void setTeamLead(std::shared_ptr lead); + void setTeamLead(Employee* lead); void setEmployeesInTeam(const employeeMap& employees); void setMaximumNumberOfEmployeesInTeam(int maximumNumberOfEmployees); }; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.cpp index 642c868..294c3b8 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.cpp @@ -43,7 +43,7 @@ AuthenticationDTO AuthenticationManagementService::login(const std::string& emai employeeType = employee.second->getEmployeeType(); if (employeeType == Enums::EmployeeType::GENERAL) { - std::shared_ptr generalEmployee = std::dynamic_pointer_cast(employee.second); + GeneralEmployee* generalEmployee = dynamic_cast(employee.second); if (generalEmployee) { employeeDesignation = generalEmployee->getDesignation(); @@ -77,7 +77,7 @@ AuthenticationDTO AuthenticationManagementService::login(const std::string& emai */ void AuthenticationManagementService::changePassword(const std::string& password) { - std::shared_ptr authenticatedUser = m_dataStore.getAuthenticatedUser(); + Employee* authenticatedUser = m_dataStore.getAuthenticatedUser(); if (authenticatedUser) { authenticatedUser->setEmployeePassword(password); @@ -99,10 +99,12 @@ void AuthenticationManagementService::changePassword(const std::string& password * runtime_error if no user is currently logged in */ void AuthenticationManagementService::logout() { - if (m_dataStore.getAuthenticatedUser()) { - m_dataStore.getAuthenticatedUser() = nullptr; + if (m_dataStore.getAuthenticatedEmployee()) + { + m_dataStore.getAuthenticatedEmployee() = nullptr; } - else { + else + { throw std::runtime_error("No user currently logged In..."); } } \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/LogService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/LogService.cpp index 3e77020..6917cda 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/LogService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/LogService.cpp @@ -14,6 +14,6 @@ void LogService::log(const std::string& message) { DataStore& dataStore = DataStore::getInstance(); logMap& logs = dataStore.getLogs(); - std::shared_ptr log = Factory::getObject(message); + Log* log = Factory::getObject(message); logs.emplace(std::make_pair(log->getTimestamp(), log)); } diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h index ed6a48b..6144d4e 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h @@ -6,15 +6,14 @@ */ #pragma once -#include #include"ZenvyController.h" class AdminMenu { private: - std::shared_ptr m_zenvyController; + ZenvyController* m_zenvyController; public: - AdminMenu() :m_zenvyController(std::make_shared()) {}; + AdminMenu() :m_zenvyController(new ZenvyController()) {}; void run(); bool handleOperation(int); }; diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.h index 8611935..907ab82 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.h @@ -6,15 +6,14 @@ */ #pragma once -#include #include"ZenvyController.h" class EmployeeMenu { private: - std::shared_ptr m_zenvyController; + ZenvyController m_zenvyController; public: - EmployeeMenu() : m_zenvyController(std::make_shared()) {}; + EmployeeMenu() : m_zenvyController(new ZenvyController()) {}; void run(); bool handleOperation(int); }; diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.h index d1c4d77..98dd6c8 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.h @@ -6,15 +6,14 @@ */ #pragma once -#include #include"ZenvyController.h" class FinanceExecutiveMenu { private: - std::shared_ptr m_zenvyController; + ZenvyController* m_zenvyController; public: - FinanceExecutiveMenu() : m_zenvyController(std::make_shared()) {}; + FinanceExecutiveMenu() : m_zenvyController(new ZenvyController()) {}; void run(); bool handleOperation(int); }; diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.h index a3c1ff1..ed7c5fa 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.h @@ -6,15 +6,14 @@ */ #pragma once -#include #include"ZenvyController.h" class HRManagerMenu { private: - std::shared_ptr m_zenvyController; + ZenvyController* m_zenvyController; public: - HRManagerMenu() : m_zenvyController(std::make_shared()) {}; + HRManagerMenu() : m_zenvyController(new ZenvyController()) {}; void run(); bool handleOperation(int); }; diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.h index 7447643..5d32d37 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.h @@ -6,15 +6,14 @@ */ #pragma once -#include #include"ZenvyController.h" class ITExecutiveMenu { private: - std::shared_ptr m_zenvyController; + ZenvyController* m_zenvyController; public: - ITExecutiveMenu() : m_zenvyController(std::make_shared()) {}; + ITExecutiveMenu() : m_zenvyController(new ZenvyController()) {}; void run(); bool handleOperation(int); }; diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.h index 7cbee73..93946ae 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.h @@ -6,15 +6,14 @@ */ #pragma once -#include #include"ZenvyController.h" class TalentExecutiveMenu { private: - std::shared_ptr m_zenvyController; + ZenvyController* m_zenvyController; public: - TalentExecutiveMenu() : m_zenvyController(std::make_shared < ZenvyController>()) {}; + TalentExecutiveMenu() : m_zenvyController(new ZenvyController()) {}; void run(); bool handleOperation(int); }; diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.h index 3f6d5f3..747b5d4 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.h @@ -6,15 +6,14 @@ */ #pragma once -#include #include"ZenvyController.h" class TeamExecutiveMenu { private: - std::shared_ptr m_zenvyController; + ZenvyController* m_zenvyController; public: - TeamExecutiveMenu() : m_zenvyController(std::make_shared()) {}; + TeamExecutiveMenu() : m_zenvyController(new ZenvyController()) {}; void run(); bool handleOperation(int); }; diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.h index d2057aa..159f485 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.h @@ -6,15 +6,14 @@ */ #pragma once -#include #include"ZenvyController.h" class TeamLeadMenu { private: - std::shared_ptr m_zenvyController; + ZenvyController* m_zenvyController; public: - TeamLeadMenu() : m_zenvyController(std::make_shared()) {}; + TeamLeadMenu() : m_zenvyController(new ZenvyController()) {}; void run(); bool handleOperation(int); }; diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.cpp index 1f08092..cefe64a 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.cpp @@ -7,7 +7,6 @@ #include #include -#include #include #include "UserInterface.h" #include "AdminMenu.h" @@ -132,7 +131,6 @@ void UserInterface::login() } } util::clear(); - // Route to appropriate menu switch (employeeType) { case Enums::EmployeeType::ADMIN: @@ -191,4 +189,17 @@ void UserInterface::login() break; } m_controller->logout(); +} + +UserInterface::~UserInterface() +{ + delete m_controller; + delete m_employeeMenu; + delete m_adminMenu; + delete m_financeExecutiveMenu; + delete m_hrManagerMenu; + delete m_itExecutiveMenu; + delete m_talentExecutiveMenu; + delete m_teamExecutiveMenu; + delete m_teamLeadMenu; } \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.h b/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.h index cf9c924..e400ba6 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.h @@ -6,7 +6,6 @@ */ #pragma once -#include #include #include "AdminMenu.h" #include "EmployeeMenu.h" @@ -21,27 +20,28 @@ class UserInterface { private: - std::shared_ptr m_controller; - std::shared_ptr m_employeeMenu; - std::shared_ptr m_adminMenu; - std::shared_ptr m_financeExecutiveMenu; - std::shared_ptr m_hrManagerMenu; - std::shared_ptr m_itExecutiveMenu; - std::shared_ptr m_talentExecutiveMenu; - std::shared_ptr m_teamExecutiveMenu; - std::shared_ptr m_teamLeadMenu; + ZenvyController* m_controller; + EmployeeMenu* m_employeeMenu; + AdminMenu* m_adminMenu; + FinanceExecutiveMenu* m_financeExecutiveMenu; + HRManagerMenu* m_hrManagerMenu; + ITExecutiveMenu* m_itExecutiveMenu; + TalentExecutiveMenu* m_talentExecutiveMenu; + TeamExecutiveMenu* m_teamExecutiveMenu; + TeamLeadMenu* m_teamLeadMenu; public: - UserInterface() : m_controller(std::make_shared()), - m_employeeMenu(std::make_shared()), - m_adminMenu(std::make_shared()), - m_financeExecutiveMenu(std::make_shared()), - m_hrManagerMenu(std::make_shared()), - m_itExecutiveMenu(std::make_shared()), - m_talentExecutiveMenu(std::make_shared()), - m_teamExecutiveMenu(std::make_shared()), - m_teamLeadMenu(std::make_shared()) {}; - void run(); - bool handleOperation(int choice); - void login(); -}; - + UserInterface() : + m_controller(new ZenvyController()), + m_employeeMenu(new EmployeeMenu()), + m_adminMenu(new AdminMenu()), + m_financeExecutiveMenu(new FinanceExecutiveMenu()), + m_hrManagerMenu(new HRManagerMenu()), + m_itExecutiveMenu(new ITExecutiveMenu()), + m_talentExecutiveMenu(new TalentExecutiveMenu()), + m_teamExecutiveMenu(new TeamExecutiveMenu()), + m_teamLeadMenu(new TeamLeadMenu()) {}; + void run(); + bool handleOperation(int choice); + void login(); + ~UserInterface(); +}; \ No newline at end of file From 83f1c4183c8421d0d4bbe2664483d59cbc7dc7bf Mon Sep 17 00:00:00 2001 From: Tinu Johnson Date: Fri, 10 Apr 2026 15:23:27 +0530 Subject: [PATCH 07/19] Add destructor in datastore --- .../Trenser.Zenvy/datastores/DataStore.cpp | 18 ++++++++++++++++++ .../Trenser.Zenvy/datastores/DataStore.h | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp index eb2a3b5..c8e6e0d 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp @@ -91,4 +91,22 @@ Employee* DataStore::getAuthenticatedUser() { return m_authenticatedEmployee; } +DataStore::~DataStore() +{ + for (auto& pair : m_employees) + { + delete pair.second; + } + m_employees.clear(); + for (auto& pair : m_logs) + { + delete pair.second; + } + m_logs.clear(); + if (m_authenticatedEmployee) + { + delete m_authenticatedEmployee; + m_authenticatedEmployee = nullptr; + } +} diff --git a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h index 86e304e..fc16308 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h +++ b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h @@ -34,7 +34,7 @@ private: Employee* m_authenticatedEmployee; employeeMap m_employees; logMap m_logs; - DataStore() = default; + DataStore() : m_authenticatedEmployee(nullptr) {}; public: static DataStore& getInstance(); DataStore(const DataStore&) = delete; @@ -46,4 +46,5 @@ public: logMap& getLogs(); Employee*& getAuthenticatedEmployee(); void setAuthenticatedEmployee(Employee*); + ~DataStore(); }; \ No newline at end of file From 85f97f30f95e39e2dcf99cc6f27de9c0e0b83fb4 Mon Sep 17 00:00:00 2001 From: Tinu Johnson Date: Mon, 13 Apr 2026 09:56:41 +0530 Subject: [PATCH 08/19] Add missing header --- Trenser.Zenvy/Trenser.Zenvy/models/Announcement.cpp | 3 ++- Trenser.Zenvy/Trenser.Zenvy/models/Announcement.h | 6 ++++++ Trenser.Zenvy/Trenser.Zenvy/models/Attendance.cpp | 3 ++- Trenser.Zenvy/Trenser.Zenvy/models/Booking.cpp | 5 +++-- Trenser.Zenvy/Trenser.Zenvy/models/Candidate.cpp | 3 ++- Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp | 3 ++- Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.cpp | 7 +++++++ 7 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Announcement.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Announcement.cpp index 67e0c4e..8cdada4 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Announcement.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Announcement.cpp @@ -1,11 +1,12 @@ /* * File: Announcement.cpp - * Description: The Announcement class that stores an announcement’s ID, timestamp, and message with getter and setter functions for controlled access. + * Description: The Announcement class defines a simple object for managing announcement details. * Author: Trenser * Created: 31-Mar-2026 */ #include "Announcement.h" +//Getters and Setters const std::string& Announcement::getAnnouncementId() const { return m_id; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Announcement.h b/Trenser.Zenvy/Trenser.Zenvy/models/Announcement.h index 23e333c..3006d0f 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Announcement.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Announcement.h @@ -1,3 +1,9 @@ +/* + * File: Announcement.h + * Description: The Announcement class defines a simple object for managing announcement details. + * Author: Trenser + * Created: 31-Mar-2026 + */ #pragma once #include #include "Timestamp.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Attendance.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Attendance.cpp index bcbf622..399fccd 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Attendance.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Attendance.cpp @@ -1,11 +1,12 @@ /* * File: Attendance.cpp - * Description: The Attendance class manages attendance records by storing login and logout times. + * Description: The Attendance class represents an attendance record by storing an ID, login and logout timestamps. * Author: Trenser * Created: 31-Mar-2026 */ #include "Attendance.h" + //Getters and Setters const std::string& Attendance::getAttendanceId() const { return m_id; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Booking.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Booking.cpp index 5ac6682..a069f96 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Booking.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Booking.cpp @@ -1,11 +1,12 @@ -/* +/* * File: Booking.cpp - * Description: The Booking class stores booking details and calculates the duration between start and end times. + * Description: The Booking class represents a time‑based booking with employee and team details and supports duration calculation. * Author: Trenser * Created: 31-Mar-2026 */ #include "Booking.h" + //Getters and Setters const std::string& Booking::getBookingId() const { return m_id; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Candidate.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Candidate.cpp index 8394260..182fedc 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Candidate.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Candidate.cpp @@ -1,11 +1,12 @@ /* * File: Candidate.cpp - * Description: The Candidate class manages candidate details and status using getter and setter methods. + * Description: The Candidate class stores and manages a candidate’s information. * Author: Trenser * Created: 31-Mar-2026 */ #include "Candidate.h" + //Getters and Setters const std::string& Candidate::getCandidateId() const { return m_id; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp index a2b426e..83a1ca2 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp @@ -1,11 +1,12 @@ /* * File: Employee.cpp - * Description: The Employee class stores and manages employee details along with related work records. + * Description: The Employee class manages employee information and associated work records such as payroll, attendance, leaves, and payslips. * Author: Trenser * Created: 31-Mar-2026 */ #include "Employee.h" + //Getters and Setters const std::string& Employee::getEmployeeId() const { return m_id; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.cpp index 46f9e61..2fd78e5 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.cpp @@ -1,5 +1,12 @@ +/* + * File: GeneralEmployee.h + * Description: The GeneralEmployee class represents a general employee with a specific designation. + * Author: Trenser + * Created: 31-Mar-2026 + */ #include "GeneralEmployee.h" + //Getters and Setters Enums::EmployeeDesignation GeneralEmployee::getDesignation() const { return m_designation; From 853ed05e8d629241580b5137fb1703abbc1ad678 Mon Sep 17 00:00:00 2001 From: Ajmal Jalaludeen Date: Mon, 13 Apr 2026 10:05:29 +0530 Subject: [PATCH 09/19] Corrected date format and removed unwanted spaces across all files. --- Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.h | 4 ++-- Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/JobListing.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Leave.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Log.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Notification.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Notification.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Room.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Team.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Ticket.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Ticket.h | 2 +- 27 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp b/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp index ec69829..cdc3a08 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp @@ -2,7 +2,7 @@ * File: ZenvyController.cpp * Description : Controls data flow between UI and Service Layers. * Author: Trenser - * Created : 01-04-2026 + * Created : 01-Apr-2026 */ #include "ZenvyController.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.h b/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.h index e456409..965a5d1 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.h +++ b/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.h @@ -2,7 +2,7 @@ * File: ZenvyController.h * Description : Controls data flow between UI and Service Layers. * Author: Trenser - * Created : 01-04-2026 + * Created : 01-Apr-2026 */ #pragma once @@ -48,4 +48,4 @@ public: void logout(); void changePassword(const std::string&); ~ZenvyController(); -}; +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp index c8e6e0d..75e9f43 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp @@ -2,7 +2,7 @@ * File: DataStore.cpp * Description: Central Storage for all the System Data. * Author: Trenser - * Created: 01-04-2026 + * Created: 01-Apr-2026 */ #include "DataStore.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h index fc16308..6cd9518 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h +++ b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h @@ -2,7 +2,7 @@ * File: DataStore.h * Description: Central Storage for all the System Data. * Author: Trenser - * Created: 01-04-2026 + * Created: 01-Apr-2026 */ #pragma once diff --git a/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h b/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h index 604a3f0..216a823 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h +++ b/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h @@ -2,7 +2,7 @@ * File: Factory.h * Description: Provides a generic factory utility to create shared_ptr instances of objects. * Author: Ajmal J S - * Created: 01-04-2026 + * Created: 01-Apr-2026 */ #pragma once diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.cpp index 0d4b30e..910c0e8 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.cpp @@ -2,7 +2,7 @@ File: JobListing.cpp * Description : Represents a job opening along with its details and applied candidates. * Author : Trenser -* Created : 01 - Apr - 2026 +* Created : 01-Apr-2026 */ #include "JobListing.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h b/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h index db016a0..a269cff 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h @@ -2,7 +2,7 @@ File: JobListing.h * Description : Represents a job opening along with its details and applied candidates. * Author : Trenser -* Created : 01 - Apr - 2026 +* Created : 01-Apr-2026 */ #pragma once diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp index 4ac215b..c8496c6 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp @@ -2,7 +2,7 @@ File: Leave.cpp * Description : Stores information related to an employee’s leave application. * Author : Trenser -* Created : 31 - Mar - 2026 +* Created : 31-Mar-2026 */ #include "Leave.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Leave.h b/Trenser.Zenvy/Trenser.Zenvy/models/Leave.h index a7588e2..4aa0473 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Leave.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Leave.h @@ -2,7 +2,7 @@ File: Leave.h * Description : Stores information related to an employee’s leave application. * Author : Trenser -* Created : 31 - Mar - 2026 +* Created : 31-Mar-2026 */ #pragma once diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp index a022679..af1e9e2 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp @@ -2,7 +2,7 @@ File: Log.cpp * Description : Represents a log entry containing a timestamp and an associated message. * Author : Trenser -* Created : 01 - Apr - 2026 +* Created : 01-Apr-2026 */ #include "Log.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Log.h b/Trenser.Zenvy/Trenser.Zenvy/models/Log.h index 416d7fb..f258643 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Log.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Log.h @@ -2,7 +2,7 @@ File: Log.h * Description : Represents a log entry containing a timestamp and an associated message. * Author : Trenser -* Created : 01 - Apr - 2026 +* Created : 01-Apr-2026 */ #pragma once diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Notification.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Notification.cpp index 2bc0c0d..0a7456e 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Notification.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Notification.cpp @@ -2,7 +2,7 @@ File: Notification.cpp * Description : Represents an employee notification with message and status details. * Author : Trenser -* Created : 31 - Mar - 2026 +* Created : 31-Mar-2026 */ #include "Notification.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Notification.h b/Trenser.Zenvy/Trenser.Zenvy/models/Notification.h index cf76caf..28f2cad 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Notification.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Notification.h @@ -2,7 +2,7 @@ File: Notification.h * Description : Represents an employee notification with message and status details. * Author : Trenser -* Created : 31 - Mar - 2026 +* Created : 31-Mar-2026 */ #pragma once diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp index b76ab8d..a4659ce 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp @@ -2,7 +2,7 @@ File: Payroll.cpp * Description : Stores payroll and salary breakdown details for an employee. * Author : Trenser -* Created : 31 - Mar - 2026 +* Created : 31-Mar-2026 */ #include "Payroll.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h index 3ebe780..dcbaeab 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h @@ -2,7 +2,7 @@ File: Payroll.h * Description : Stores payroll and salary breakdown details for an employee. * Author : Trenser -* Created : 31 - Mar - 2026 +* Created : 31-Mar-2026 */ #pragma once diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp index 70e42e7..cdbef42 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp @@ -2,7 +2,7 @@ File: Payslip.cpp * Description : Models a payslip entity that stores salary information. * Author : Trenser -* Created : 31 - Mar - 2026 +* Created : 31-Mar-2026 */ #include "Payslip.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h b/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h index 06d0023..b9b7aa1 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h @@ -2,7 +2,7 @@ File: Payslip.h * Description : Models a payslip entity that stores salary information. * Author : Trenser -* Created : 31 - Mar - 2026 +* Created : 31-Mar-2026 */ #pragma once diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp index 0d697ed..8b32aea 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp @@ -2,7 +2,7 @@ File: Room.cpp * Description : Models a room entity that maintains room details and manages its bookings. * Author : Trenser -* Created : 31 - Mar - 2026 +* Created : 31-Mar-2026 */ #include "Room.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Room.h b/Trenser.Zenvy/Trenser.Zenvy/models/Room.h index c412b58..3f1811b 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Room.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Room.h @@ -2,7 +2,7 @@ File: Room.h * Description : Models a room entity that maintains room details and manages its bookings. * Author : Trenser -* Created : 31 - Mar - 2026 +* Created : 31-Mar-2026 */ #pragma once diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.cpp index 112c3d0..5c44816 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.cpp @@ -2,7 +2,7 @@ File: TalentExecutive.cpp * Description : Represents information related to a talent executive in the system. * Author : Trenser -* Created : 31 - Mar - 2026 +* Created : 31-Mar-2026 */ #include "TalentExecutive.h" \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h b/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h index a5bfa6e..54382d4 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h @@ -2,7 +2,7 @@ File: TalentExecutive.h * Description : Represents information related to a talent executive in the system. * Author : Trenser -* Created : 31 - Mar - 2026 +* Created : 31-Mar-2026 */ #pragma once diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp index 7ce86c2..e345eb8 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp @@ -2,7 +2,7 @@ File: Team.cpp * Description : Models a team entity that maintains team identity, leadership, employee list, and size limitations. * Author : Trenser -* Created : 31 - Mar - 2026 +* Created : 31-Mar-2026 */ #include "Team.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Team.h b/Trenser.Zenvy/Trenser.Zenvy/models/Team.h index 7e3d818..9ef386f 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Team.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Team.h @@ -2,7 +2,7 @@ File: Team.h * Description : Models a team entity that maintains team identity, leadership, employee list, and size limitations. * Author : Trenser -* Created : 31 - Mar - 2026 +* Created : 31-Mar-2026 */ #pragma once diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.cpp index aac8db4..c780ad7 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.cpp @@ -2,7 +2,7 @@ File: TeamExecutive.cpp * Description : Represents information related to a team executive within the system. * Author : Trenser -* Created : 31 - Mar - 2026 +* Created : 31-Mar-2026 */ #include "TeamExecutive.h" \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h b/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h index 1bd7def..ee45b0a 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h @@ -2,7 +2,7 @@ File: TeamExecutive.h * Description : Represents information related to a team executive within the system. * Author : Trenser -* Created : 31 - Mar - 2026 +* Created : 31-Mar-2026 */ #pragma once diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.cpp index af67e08..ba7227d 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.cpp @@ -2,7 +2,7 @@ File: Ticket.cpp * Description : Represents a support ticket with its associated details and status. * Author : Trenser -* Created : 31 - Mar - 2026 +* Created : 31-Mar-2026 */ #include "Ticket.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.h b/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.h index 88f8ed8..e8657e6 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.h @@ -2,7 +2,7 @@ File: Ticket.h * Description : Represents a support ticket with its associated details and status. * Author : Trenser -* Created : 31 - Mar - 2026 +* Created : 31-Mar-2026 */ #pragma once From 6a373b48dff5e4f6e29641347a6adeb4754f5fa9 Mon Sep 17 00:00:00 2001 From: Tinu Johnson Date: Thu, 16 Apr 2026 18:02:07 +0530 Subject: [PATCH 10/19] Change shared pointer to raw pointer in views --- .../Trenser.Zenvy/views/AdminMenu.cpp | 1 - Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h | 1 - .../Trenser.Zenvy/views/EmployeeMenu.cpp | 1 - .../Trenser.Zenvy/views/EmployeeMenu.h | 3 +- .../views/FinanceExecutiveMenu.cpp | 10 ++++- .../views/FinanceExecutiveMenu.h | 1 - .../Trenser.Zenvy/views/HRManagerMenu.cpp | 1 - .../Trenser.Zenvy/views/HRManagerMenu.h | 1 - .../Trenser.Zenvy/views/ITExecutiveMenu.cpp | 1 - .../Trenser.Zenvy/views/ITExecutiveMenu.h | 1 - .../Trenser.Zenvy/views/MenuHelper.cpp | 20 ++++----- .../Trenser.Zenvy/views/MenuHelper.h | 45 +++++++++---------- .../views/TalentExecutiveMenu.cpp | 1 - .../Trenser.Zenvy/views/TalentExecutiveMenu.h | 1 - .../Trenser.Zenvy/views/TeamExecutiveMenu.cpp | 1 - .../Trenser.Zenvy/views/TeamExecutiveMenu.h | 1 - .../Trenser.Zenvy/views/TeamLeadMenu.cpp | 1 - .../Trenser.Zenvy/views/TeamLeadMenu.h | 1 - .../Trenser.Zenvy/views/UserInterface.cpp | 1 - .../Trenser.Zenvy/views/UserInterface.h | 1 - 20 files changed, 42 insertions(+), 52 deletions(-) diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.cpp index 0b6535a..8338cd9 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.cpp @@ -4,7 +4,6 @@ * Author: Trenser * Created: 02-Apr-2026 */ - #include #include "AdminMenu.h" #include"InputHelper.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h index 6144d4e..88ca794 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 02-Apr-2026 */ - #pragma once #include"ZenvyController.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.cpp index a833dd4..33978b9 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.cpp @@ -4,7 +4,6 @@ * Author: Trenser * Created: 02-Apr-2026 */ - #include #include #include "EmployeeMenu.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.h index 907ab82..d29f301 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.h @@ -4,14 +4,13 @@ * Author: Trenser * Created: 02-Apr-2026 */ - #pragma once #include"ZenvyController.h" class EmployeeMenu { private: - ZenvyController m_zenvyController; + ZenvyController* m_zenvyController; public: EmployeeMenu() : m_zenvyController(new ZenvyController()) {}; void run(); diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.cpp index c19318f..68a5d26 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.cpp @@ -4,7 +4,6 @@ * Author: Trenser * Created: 02-Apr-2026 */ - #include #include "FinanceExecutiveMenu.h" #include "InputHelper.h" @@ -67,6 +66,15 @@ void FinanceExecutiveMenu::updatePayroll() } } +void FinanceExecutiveMenu::generatePayslips() +{ + util::Timestamp currentTimestamp; + util::clear(); + m_zenvyController->generatePayslips(); + std::cout << "Generated payslips for the month of " << currentTimestamp.getMonth() << "-" << currentTimestamp.getYear() << " successfully."; + util::pressEnter(); +} + /* * Function: FinanceExecutiveMenu::handleOperation * Description: Handles the finance executive’s menu choice and executes the corresponding action diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.h index 664aa49..038658f 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 02-Apr-2026 */ - #pragma once #include #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.cpp index ac108dd..3875de5 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.cpp @@ -4,7 +4,6 @@ * Author: Trenser * Created: 02-Apr-2026 */ - #include #include "HRManagerMenu.h" #include "InputHelper.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.h index ed7c5fa..158deaf 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 02-Apr-2026 */ - #pragma once #include"ZenvyController.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.cpp index f491dd4..6ae71ea 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.cpp @@ -4,7 +4,6 @@ * Author: Trenser * Created: 02-Apr-2026 */ - #include #include "ITExecutiveMenu.h" #include "InputHelper.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.h index 5d32d37..e6cf86e 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 02-Apr-2026 */ - #pragma once #include"ZenvyController.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.cpp index bba68d0..cfcc4c4 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.cpp @@ -70,9 +70,9 @@ static Enums::EmployeeDesignation getEmployeeDesignation() } } -void createEmployee(std::shared_ptr controller) +void createEmployee(ZenvyController* m_zenvyController) { - auto currentEmployee = controller->getCurrentEmployee(); + auto currentEmployee = m_zenvyController->getCurrentEmployee(); Enums::EmployeeType employeeType = getEmployeeType(currentEmployee->getEmployeeType()); Enums::EmployeeDesignation employeeDesignation = Enums::EmployeeDesignation::INVALID; std::string name, email, phone; @@ -98,12 +98,12 @@ void createEmployee(std::shared_ptr controller) util::read(email); std::cout << "Enter Phone: "; util::read(phone); - controller->createEmployee(employeeType, employeeDesignation, email, name, phone); + m_zenvyController->createEmployee(employeeType, employeeDesignation, email, name, phone); std::cout << "\nCreated Employee Successfully."; util::pressEnter(); } - void updateDesignation(std::shared_ptr m_zenvyController) + void updateDesignation(ZenvyController* m_zenvyController) { std::string selectedEmployeeId = selectEmployeeId(m_zenvyController->getEmployees(Enums::EmployeeType::GENERAL)); if (selectedEmployeeId.empty()) @@ -123,7 +123,7 @@ void createEmployee(std::shared_ptr controller) } } -void displayCandidateDetails(const std::vector>& shorlistedCandidates) +void displayCandidateDetails(const std::vector shorlistedCandidates) { util::clear(); std::cout << std::left @@ -148,12 +148,12 @@ void displayCandidateDetails(const std::vector>& shor } } -void addShortlistedCandidateAsEmployee(const std::shared_ptr& controller) +void addShortlistedCandidateAsEmployee(const ZenvyController* m_zenvyController) { int index; std::string name, email, phone; util::clear(); - std::vector> shortlistedCandidates = controller->getShorlistedCandidates(); + std::vector shortlistedCandidates = m_zenvyController->getShorlistedCandidates(); if (shortlistedCandidates.empty()) { std::cout << "No candidates Found!"; @@ -163,13 +163,13 @@ void addShortlistedCandidateAsEmployee(const std::shared_ptr& c displayCandidateDetails(shortlistedCandidates); std::cout << "Enter the Index: "; util::read(index); - auto currentEmployee = controller->getCurrentEmployee(); + auto currentEmployee = m_zenvyController->getCurrentEmployee(); Enums::EmployeeType employeeType; Enums::EmployeeDesignation employeeDesignation = Enums::EmployeeDesignation::INVALID; if (index > 0 && index <= shortlistedCandidates.size()) { employeeType = getEmployeeType(currentEmployee->getEmployeeType()); - std::shared_ptr candidate = shortlistedCandidates[index - 1]; + Candidate* candidate = shortlistedCandidates[index - 1]; switch (employeeType) { case Enums::EmployeeType::INVALID: @@ -190,7 +190,7 @@ void addShortlistedCandidateAsEmployee(const std::shared_ptr& c util::read(email); name = candidate->getCandidateName(); phone = candidate->getCandidatePhone(); - controller->createEmployee(employeeType, employeeDesignation, email, name, phone); + m_zenvyController->createEmployee(employeeType, employeeDesignation, email, name, phone); candidate->setCandidateStatus(Enums::CandidateStatus::HIRED); std::cout << "\nCreated Employee Successfully."; util::pressEnter(); diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.h b/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.h index cd82082..7cee5cb 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.h @@ -15,12 +15,14 @@ #include "MenuHelper.h" #include "Validator.h" -void createEmployee(std::shared_ptr controller); -void updateDesignation(std::shared_ptr m_zenvyController); +void createEmployee(ZenvyController* m_zenvyController); +void updateDesignation(ZenvyController* m_zenvyController); +void displayCandidateDetails(const std::vector shorlistedCandidates); +void addShortlistedCandidateAsEmployee(const ZenvyController* m_zenvyController); -inline void viewPayslipHistory(std::shared_ptr controller) +inline void viewPayslipHistory(ZenvyController* m_zenvyController) { - auto employeePayslips = controller->getCurrentEmployee()->getEmployeePayslips(); + auto employeePayslips = m_zenvyController->getCurrentEmployee()->getEmployeePayslips(); util::clear(); if (employeePayslips.empty()) { @@ -51,10 +53,10 @@ inline void viewPayslipHistory(std::shared_ptr controller) util::pressEnter(); } -inline void viewProfile(std::shared_ptr controller) +inline void viewProfile(ZenvyController* m_zenvyController) { util::clear(); - std::shared_ptr currentEmployee = controller->getCurrentEmployee(); + const Employee* currentEmployee = m_zenvyController->getCurrentEmployee(); if (currentEmployee) { std::cout << std::left @@ -64,7 +66,7 @@ inline void viewProfile(std::shared_ptr controller) << "Email: " << currentEmployee->getEmployeeEmail() << std::endl << "Phone: " << currentEmployee->getEmployeePhone() << std::endl; if (currentEmployee->getEmployeeType() == Enums::EmployeeType::GENERAL) { - if (auto generalEmployee = std::dynamic_pointer_cast(currentEmployee)) + if (auto generalEmployee = dynamic_cast(currentEmployee)) { std::cout << "Designation: " << Enums::getEmployeeDesignationString(generalEmployee->getDesignation()) << std::endl; } @@ -94,10 +96,7 @@ inline void viewProfile(std::shared_ptr controller) } } -void displayCandidateDetails(const std::vector>& shorlistedCandidates); -void addShortlistedCandidateAsEmployee(const std::shared_ptr& controller); - -inline void updateProfile(std::shared_ptr m_zenvyController) +inline void updateProfile(ZenvyController* m_zenvyController) { int choice; std::string name, phone; @@ -148,10 +147,10 @@ inline void updateProfile(std::shared_ptr m_zenvyController) } } -inline std::string selectEmployeeId(std::vector> allEmployees) +inline std::string selectEmployeeId(std::vector& allEmployees) { int choice; - std::map> employeeList; + std::map employeeList; int index = 0; util::clear(); if (allEmployees.empty()) @@ -177,7 +176,7 @@ inline std::string selectEmployeeId(std::vector> << std::setw(20) << "Employee Designation" << std::endl; for (const auto& employee : employeeList) { - auto generalEmployee = std::dynamic_pointer_cast(employee.second); + auto generalEmployee = dynamic_cast(employee.second); std::cout << std::left << std::setw(10) << employee.first << std::setw(15) << employee.second->getId() @@ -209,14 +208,14 @@ inline std::string selectEmployeeId(std::vector> } } -inline void deactivateEmployee(const std::shared_ptr& controller) +inline void deactivateEmployee(const ZenvyController* m_zenvyController) { - std::string selectedEmployeeId = selectEmployeeId(controller->getEmployees()); + std::string selectedEmployeeId = selectEmployeeId(m_zenvyController->getEmployees()); if (selectedEmployeeId.empty()) { return; } - if (controller->deactivateEmployee(selectedEmployeeId)) + if (m_zenvyController->deactivateEmployee(selectedEmployeeId)) { std::cout << "Employee deactivated successfully\n"; util::pressEnter(); @@ -228,7 +227,7 @@ inline void deactivateEmployee(const std::shared_ptr& controlle } } -inline void viewEmployees(std::shared_ptr m_zenvyController) +inline void viewEmployees(ZenvyController* m_zenvyController) { util::clear(); std::cout << "Employee List\n"; @@ -261,13 +260,13 @@ inline void viewEmployees(std::shared_ptr m_zenvyController) util::pressEnter(); } -inline void searchEmployee(std::shared_ptr m_zenvyController) +inline void searchEmployee(ZenvyController* m_zenvyController) { std::string name; util::clear(); std::cout << "Enter Employee Name: "; util::read(name); - std::pair>> searchResults = m_zenvyController->searchEmployee(name); + std::pair> searchResults = m_zenvyController->searchEmployee(name); if (!(searchResults.second).empty()) { std::cout << std::left @@ -333,7 +332,7 @@ inline void searchEmployee(std::shared_ptr m_zenvyController) util::pressEnter(); } -inline void viewPayslip(std::shared_ptr controller) +inline void viewPayslip(ZenvyController* m_zenvyController) { int year, month; util::clear(); @@ -341,14 +340,14 @@ inline void viewPayslip(std::shared_ptr controller) util::read(year); std::cout << "Enter the month: "; util::read(month); - auto employee = controller->getCurrentEmployee(); + auto employee = m_zenvyController->getCurrentEmployee(); if (!employee) { std::cout << "No authenticated employee.\n"; util::pressEnter(); return; } - auto result = controller->getPayslipForMonth(employee->getId(), year, month); + auto result = m_zenvyController->getPayslipForMonth(employee->getId(), year, month); auto payroll = result.first; auto payslip = result.second; if (payroll && payslip) diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.cpp index c16f65a..69e6cbd 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.cpp @@ -4,7 +4,6 @@ * Author: Trenser * Created: 02-Apr-2026 */ - #include #include "TalentExecutiveMenu.h" #include "InputHelper.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.h index 93946ae..92e5a23 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 02-Apr-2026 */ - #pragma once #include"ZenvyController.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.cpp index ed22416..9cfacf6 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.cpp @@ -4,7 +4,6 @@ * Author: Trenser * Created: 02-Apr-2026 */ - #include #include "TeamExecutiveMenu.h" #include "InputHelper.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.h index 747b5d4..307d26e 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 02-Apr-2026 */ - #pragma once #include"ZenvyController.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.cpp index bb44739..6ead718 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.cpp @@ -4,7 +4,6 @@ * Author: Trenser * Created: 02-Apr-2026 */ - #include #include "TeamLeadMenu.h" #include "InputHelper.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.h index 159f485..e34eee3 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 02-Apr-2026 */ - #pragma once #include"ZenvyController.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.cpp index 2e619c4..50acbe5 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.cpp @@ -4,7 +4,6 @@ * Author: Trenser * Created: 02-Apr-2026 */ - #include #include #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.h b/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.h index e400ba6..6952830 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/UserInterface.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 02-Apr-2026 */ - #pragma once #include #include "AdminMenu.h" From 138901b8e9a517517cabf1a3fc3fbaa8d3722c86 Mon Sep 17 00:00:00 2001 From: Jissin Sam Mathew Date: Thu, 16 Apr 2026 18:05:11 +0530 Subject: [PATCH 11/19] Changed Shared Pointers to raw pointers in the service classes --- .../services/ApplicationConfig.cpp | 1 - .../services/ApplicationConfig.h | 1 - .../services/AttendanceManagementService.cpp | 1 - .../services/AttendanceManagementService.h | 1 - .../AuthenticationManagementService.cpp | 3 +- .../AuthenticationManagementService.h | 1 - .../services/BookingManagementService.cpp | 1 - .../services/BookingManagementService.h | 1 - .../services/EmployeeManagementService.cpp | 28 +++++++++---------- .../services/LeaveManagementService.cpp | 1 - .../services/LeaveManagementService.h | 1 - .../Trenser.Zenvy/services/LogService.cpp | 1 - .../Trenser.Zenvy/services/LogService.h | 1 - .../NotificationManagementService.cpp | 1 - .../services/NotificationManagementService.h | 1 - .../services/PayslipManagementService.cpp | 1 - .../services/PayslipManagementService.h | 1 - .../TalentAcquisitionManagementService.cpp | 1 - .../TalentAcquisitionManagementService.h | 1 - .../services/TeamManagementService.cpp | 1 - .../services/TeamManagementService.h | 1 - .../services/TicketManagementService.cpp | 1 - .../services/TicketManagementService.h | 1 - 23 files changed, 15 insertions(+), 37 deletions(-) diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/ApplicationConfig.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/ApplicationConfig.cpp index e5a0d0e..e612cbc 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/ApplicationConfig.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/ApplicationConfig.cpp @@ -4,5 +4,4 @@ * Author: Trenser * Created: 06-Apr-2026 */ - #include "ApplicationConfig.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/ApplicationConfig.h b/Trenser.Zenvy/Trenser.Zenvy/services/ApplicationConfig.h index 63b2dec..2658b8e 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/ApplicationConfig.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/ApplicationConfig.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 06-Apr-2026 */ - #pragma once namespace Config diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/AttendanceManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/AttendanceManagementService.cpp index 2ab575a..35ae237 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/AttendanceManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/AttendanceManagementService.cpp @@ -4,5 +4,4 @@ * Author: Trenser * Created: 30-Apr-2026 */ - #include "AttendanceManagementService.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/AttendanceManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/AttendanceManagementService.h index 5f12270..a97103e 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/AttendanceManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/AttendanceManagementService.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 30-Apr-2026 */ - #pragma once class AttendanceManagementService { diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.cpp index 4d4766c..4abd1ea 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.cpp @@ -4,7 +4,6 @@ * Author: Trenser * Created: 30-Mar-2026 */ - #include #include "AuthenticationManagementService.h" #include "ApplicationConfig.h" @@ -81,7 +80,7 @@ AuthenticationDTO AuthenticationManagementService::login(const std::string& emai */ void AuthenticationManagementService::changePassword(const std::string& password) { - Employee* authenticatedUser = m_dataStore.getAuthenticatedUser(); + Employee* authenticatedUser = m_dataStore.getAuthenticatedEmployee(); if (authenticatedUser) { authenticatedUser->setEmployeePassword(password); diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.h index 392065b..b7a5768 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 30-Mar-2026 */ - #pragma once #include #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/BookingManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/BookingManagementService.cpp index cb032c3..2545535 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/BookingManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/BookingManagementService.cpp @@ -4,5 +4,4 @@ * Author: Trenser * Created: 30-Mar-2026 */ - #include "BookingManagementService.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/BookingManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/BookingManagementService.h index 7f343a4..258ad18 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/BookingManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/BookingManagementService.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 30-Mar-2026 */ - #pragma once class BookingManagementService { diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.cpp index 855e445..ecd60d9 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.cpp @@ -18,14 +18,14 @@ void EmployeeManagementService::createEmployee(Enums::EmployeeType employeeType, Enums::EmployeeDesignation employeeDesignation, const std::string& email, const std::string& name, const std::string& phone) { auto& employees = m_dataStore.getEmployees(); - std::shared_ptr authenticatedEmployee = m_dataStore.getAuthenticatedEmployee(); + Employee* authenticatedEmployee = m_dataStore.getAuthenticatedEmployee(); if (!authenticatedEmployee) { throw std::runtime_error("No authenticated user"); } Enums::EmployeeType authenticatedEmployeeType = authenticatedEmployee->getEmployeeType(); - std::shared_ptr employee; - std::shared_ptr payroll; + Employee* employee; + Payroll* payroll; if (employeeType != Enums::EmployeeType::GENERAL && util::hasActiveEmployeeOfType(employeeType, employees)) { throw std::runtime_error("Cannot create more than one employee of type " + Enums::getEmployeeTypeString(employeeType)); @@ -135,13 +135,13 @@ bool EmployeeManagementService::updateDesignation(const std::string& id, Enums:: { auto& authenticatedEmployee = m_dataStore.getAuthenticatedEmployee(); util::enforceAuthorization(authenticatedEmployee->getEmployeeType(), Enums::EmployeeType::ADMIN, Enums::EmployeeType::HR); - std::map> employees = m_dataStore.getEmployees(); + std::map employees = m_dataStore.getEmployees(); auto employeeIterator = employees.find(id); if (employeeIterator == employees.end()) { return false; } - auto generalEmployee = std::dynamic_pointer_cast((*employeeIterator).second); + auto generalEmployee = dynamic_cast((*employeeIterator).second); if (generalEmployee) { generalEmployee->setDesignation(designation); @@ -149,24 +149,24 @@ bool EmployeeManagementService::updateDesignation(const std::string& id, Enums:: return true; } -std::shared_ptr EmployeeManagementService::getCurrentEmployee() +const Employee* EmployeeManagementService::getCurrentEmployee() { return m_dataStore.getAuthenticatedEmployee(); } void EmployeeManagementService::updateProfile(const std::string& name,const std::string& phone) { - std::shared_ptr employee = m_dataStore.getAuthenticatedEmployee(); + Employee* employee = m_dataStore.getAuthenticatedEmployee(); employee->setEmployeeName(name); employee->setEmployeePhone(phone); } -std::pair>> EmployeeManagementService::searchEmployee(const std::string& name) +std::pair> EmployeeManagementService::searchEmployee(const std::string& name) { - std::shared_ptr currentUser = m_dataStore.getAuthenticatedEmployee(); + Employee* currentUser = m_dataStore.getAuthenticatedEmployee(); Enums::EmployeeType employeeType = currentUser->getEmployeeType(); employeeMap& employees = m_dataStore.getEmployees(); - std::vector> employeeList; + std::vector employeeList; if (employees.empty()) { return std::make_pair(employeeType, employeeList); @@ -220,12 +220,12 @@ void EmployeeManagementService::saveEmployees() FileManager generalEmployeeFileManager(Config::File::GENERAL_EMPLOYEES_FILE); const auto& allEmployees = m_dataStore.getEmployees(); employeeMap employees; - std::map> generalEmployees; + std::map generalEmployees; for (auto& employeePair : allEmployees) { if (employeePair.second->getEmployeeType() == Enums::EmployeeType::GENERAL) { - generalEmployees.emplace(employeePair.first, std::static_pointer_cast(employeePair.second)); + generalEmployees.emplace(employeePair.first, static_cast(employeePair.second)); } else { @@ -236,10 +236,10 @@ void EmployeeManagementService::saveEmployees() generalEmployeeFileManager.save(generalEmployees); } -std::vector> EmployeeManagementService::getShorlistedCandidates() +std::vector EmployeeManagementService::getShorlistedCandidates() { candidateMap candidates = m_dataStore.getCandidates(); - std::vector> shortlistedCandidates; + std::vector shortlistedCandidates; for (auto& candidate : candidates) { if (candidate.second->getCandidateStatus() == Enums::CandidateStatus::SHORTLISTED) diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/LeaveManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/LeaveManagementService.cpp index 733f9eb..647154e 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/LeaveManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/LeaveManagementService.cpp @@ -4,5 +4,4 @@ * Author: Trenser * Created: 30-Mar-2026 */ - #include "LeaveManagementService.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/LeaveManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/LeaveManagementService.h index 1010ec4..40b2c4b 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/LeaveManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/LeaveManagementService.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 30-Mar-2026 */ - #pragma once class LeaveManagementService { diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/LogService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/LogService.cpp index 6917cda..535fb0b 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/LogService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/LogService.cpp @@ -4,7 +4,6 @@ * Author: Trenser * Created: 01-Apr-2026 */ - #include "LogService.h" #include "Log.h" #include "Factory.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/LogService.h b/Trenser.Zenvy/Trenser.Zenvy/services/LogService.h index c1cf644..93ff404 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/LogService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/LogService.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 01-Apr-2026 */ - #pragma once #include "Log.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/NotificationManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/NotificationManagementService.cpp index 7eaa377..f7f94a7 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/NotificationManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/NotificationManagementService.cpp @@ -4,5 +4,4 @@ * Author: Trenser * Created: 30-Mar-2026 */ - #include "NotificationManagementService.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/NotificationManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/NotificationManagementService.h index 6b4aba1..cef9bfc 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/NotificationManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/NotificationManagementService.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 30-Mar-2026 */ - #pragma once class NotificationManagementService { diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.cpp index 6029d08..d6d18ed 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.cpp @@ -4,7 +4,6 @@ * Author: Trenser * Created: 30-Mar-2026 */ - #include #include #include "PayslipManagementService.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.h index fc71191..5a79ec8 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 30-Mar-2026 */ - #pragma once #include #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/TalentAcquisitionManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/TalentAcquisitionManagementService.cpp index 9e0ef96..3fb9113 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/TalentAcquisitionManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/TalentAcquisitionManagementService.cpp @@ -4,5 +4,4 @@ * Author: Trenser * Created: 30-Mar-2026 */ - #include "TalentAcquisitionManagementService.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/TalentAcquisitionManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/TalentAcquisitionManagementService.h index ed0dd32..c120c72 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/TalentAcquisitionManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/TalentAcquisitionManagementService.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 30-Mar-2026 */ - #pragma once class TalentAcquisitionManagementService { diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/TeamManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/TeamManagementService.cpp index 8b13b81..5db2995 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/TeamManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/TeamManagementService.cpp @@ -4,5 +4,4 @@ * Author: Trenser * Created: 30-Mar-2026 */ - #include "TeamManagementService.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/TeamManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/TeamManagementService.h index 21275da..eabb859 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/TeamManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/TeamManagementService.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 30-Mar-2026 */ - #pragma once class TeamManagementService { diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/TicketManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/TicketManagementService.cpp index bc995f9..0325609 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/TicketManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/TicketManagementService.cpp @@ -4,5 +4,4 @@ * Author: Trenser * Created: 30-Mar-2026 */ - #include "TicketManagementService.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/TicketManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/TicketManagementService.h index 8a38d98..caa6338 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/TicketManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/TicketManagementService.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 30-Mar-2026 */ - #pragma once class TicketManagementService { From c7b9d7bcd5a8b630015ebacbdabc7494448380ce Mon Sep 17 00:00:00 2001 From: Ajmal Jalaludeen Date: Thu, 16 Apr 2026 18:05:18 +0530 Subject: [PATCH 12/19] Changed shared pointers to raw pointers in PayslipManagementService.h and PayslipManagementService.cpp --- Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h | 8 ++++---- .../Trenser.Zenvy/services/PayslipManagementService.cpp | 4 ++-- .../Trenser.Zenvy/services/PayslipManagementService.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h index 8ab60b7..957ea04 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h +++ b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h @@ -27,11 +27,11 @@ #include "Payroll.h" #include "Payslip.h" -using employeeMap = std::map; -using payrollMap = std::map>; -using payslipMap = std::map>; +using employeeMap = std::map; +using payrollMap = std::map; +using payslipMap = std::map; using logMap = std::map; -using candidateMap = std::map>; +using candidateMap = std::map; class DataStore { diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.cpp index d6d18ed..313a35d 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.cpp @@ -61,7 +61,7 @@ void PayslipManagementService::generatePayslips() auto payroll = employee->getPayroll(); double salary; salary = payroll->getBasicSalary() + payroll->getFoodAllowance() + payroll->getHouseRentAllowance() - payroll->getEmployeePFContribution() - payroll->getEmployerPFContribution(); - std::shared_ptr payslip = Factory::getObject(salary, employee->getId()); + Payslip* payslip = Factory::getObject(salary, employee->getId()); employee->addPayslip(payslip); payslips.emplace(payslip->getId(), payslip); } @@ -93,7 +93,7 @@ void PayslipManagementService::savePayrolls() payrollFileManager.save(payrolls); } -std::pair, std::shared_ptr> PayslipManagementService::getPayslipForMonth(const std::string& employeeId, int year, int month) +std::pair PayslipManagementService::getPayslipForMonth(const std::string& employeeId, int year, int month) { auto& employees = m_dataStore.getEmployees(); auto employeeIterator = employees.find(employeeId); diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.h index 5a79ec8..6d1e5cc 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.h @@ -9,7 +9,7 @@ #include #include"DataStore.h" -using payslipMap = std::map>; +using payslipMap = std::map; class PayslipManagementService { @@ -19,7 +19,7 @@ public: PayslipManagementService() : m_dataStore(DataStore::getInstance()) {}; void updateSalary(const std::string&, double, double, double, double, double); void generatePayslips(); - std::pair, std::shared_ptr>getPayslipForMonth(const std::string&, int, int); + std::pairgetPayslipForMonth(const std::string&, int, int); void loadPayrolls(); void savePayrolls(); void loadPayslips(); From 703cea447eef439fe9497d6cf26c8059a92cb245 Mon Sep 17 00:00:00 2001 From: Princy Jerin Date: Thu, 16 Apr 2026 18:08:56 +0530 Subject: [PATCH 13/19] Change shared pointers to raw pointers in model classes --- Trenser.Zenvy/Trenser.Zenvy/models/Admin.h | 5 ++--- Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Employee.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/HRManager.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/JobListing.cpp | 1 - Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h | 1 - Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp | 1 - Trenser.Zenvy/Trenser.Zenvy/models/Leave.h | 1 - Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp | 1 - Trenser.Zenvy/Trenser.Zenvy/models/Log.h | 1 - Trenser.Zenvy/Trenser.Zenvy/models/Notification.cpp | 1 - Trenser.Zenvy/Trenser.Zenvy/models/Notification.h | 1 - Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp | 3 +-- Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h | 3 +-- Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp | 3 +-- Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h | 3 +-- Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp | 1 - Trenser.Zenvy/Trenser.Zenvy/models/Room.h | 1 - Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.cpp | 1 - Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h | 3 +-- Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp | 1 - Trenser.Zenvy/Trenser.Zenvy/models/Team.h | 1 - Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.cpp | 1 - Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h | 3 +-- Trenser.Zenvy/Trenser.Zenvy/models/Ticket.cpp | 1 - Trenser.Zenvy/Trenser.Zenvy/models/Ticket.h | 1 - 30 files changed, 15 insertions(+), 38 deletions(-) diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Admin.h b/Trenser.Zenvy/Trenser.Zenvy/models/Admin.h index b729750..fdd5daa 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Admin.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Admin.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 31-Mar-2026 */ - #pragma once #include "Employee.h" @@ -16,7 +15,7 @@ public: const std::string& name, const std::string& phone, const std::string& email, - std::shared_ptr payroll + Payroll* payroll ) :Employee(name, phone, email, Enums::EmployeeType::ADMIN, payroll) {}; Admin(const std::string& id, const std::string& name, @@ -36,4 +35,4 @@ public: Enums::EmployeeType::ADMIN, accountStatus) {} ~Admin() = default; -}; +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp index 45b9d79..f34534f 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp @@ -189,7 +189,7 @@ std::string Employee::serialize() const return serializedEmployee.str(); } -std::shared_ptr Employee::deserialize(const std::string& record) +Employee* Employee::deserialize(const std::string& record) { std::string id, name, phone, password, email; std::string teamId, teamStatusString, accountStatusString, employeeTypeString; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Employee.h b/Trenser.Zenvy/Trenser.Zenvy/models/Employee.h index b10f86e..640a9be 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Employee.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Employee.h @@ -94,7 +94,7 @@ public: void addLeave(Leave* leave); Enums::EmployeeType getEmployeeType() const; virtual std::string serialize() const; - static std::shared_ptr deserialize(const std::string&); + static Employee* deserialize(const std::string&); static std::string getHeaders(); virtual ~Employee() = default; }; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.h b/Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.h index fa69c08..3a899d9 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.h @@ -15,7 +15,7 @@ public: const std::string& name, const std::string& phone, const std::string& email, - std::shared_ptr payroll + Payroll* payroll ) :Employee(name, phone, email, Enums::EmployeeType::FINANCE, payroll) {}; FinanceExecutive(const std::string& id, const std::string& name, diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.cpp index 5005753..8ce81ba 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.cpp @@ -34,7 +34,7 @@ std::string GeneralEmployee::serialize() const return serializedEmployee.str(); } -std::shared_ptr GeneralEmployee::deserialize(const std::string& record) +GeneralEmployee* GeneralEmployee::deserialize(const std::string& record) { std::string id, name, phone, password, email; std::string teamId, teamStatusString, accountStatusString, employeeTypeString, employeeDesignationString; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.h b/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.h index 3947f12..885349c 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.h @@ -48,7 +48,7 @@ public: Enums::EmployeeDesignation getDesignation() const; void setDesignation(Enums::EmployeeDesignation designation); std::string serialize() const override; - static std::shared_ptr deserialize(const std::string&); + static GeneralEmployee* deserialize(const std::string&); static std::string getHeaders(); ~GeneralEmployee() = default; }; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.h b/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.h index a912b3f..41fa740 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.h @@ -15,7 +15,7 @@ public: const std::string& name, const std::string& phone, const std::string& email, - std::shared_ptr payroll + Payroll* payroll ) :Employee(name, phone, email, Enums::EmployeeType::HR, payroll) {}; HRManager(const std::string& id, const std::string& name, diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.h b/Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.h index 4a48b5e..9d02cd1 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.h @@ -15,7 +15,7 @@ public: const std::string& name, const std::string& phone, const std::string& email, - std::shared_ptr payroll + Payroll* payroll ) :Employee(name, phone, email, Enums::EmployeeType::IT, payroll) {}; ITExecutive(const std::string& id, const std::string& name, diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.cpp index 33c85e0..ecb91d4 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.cpp @@ -4,7 +4,6 @@ File: JobListing.cpp * Author : Trenser * Created : 01-Apr-2026 */ - #include "JobListing.h" int JobListing::m_uid = 0; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h b/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h index 48f3ee7..3332b08 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h @@ -4,7 +4,6 @@ File: JobListing.h * Author : Trenser * Created : 01-Apr-2026 */ - #pragma once #include #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp index e7d4577..3519d1e 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp @@ -4,7 +4,6 @@ File: Leave.cpp * Author : Trenser * Created : 31-Mar-2026 */ - #include "Leave.h" int Leave::m_uid = 0; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Leave.h b/Trenser.Zenvy/Trenser.Zenvy/models/Leave.h index a7cad19..1da66ca 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Leave.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Leave.h @@ -4,7 +4,6 @@ File: Leave.h * Author : Trenser * Created : 31-Mar-2026 */ - #pragma once #include #include "Enums.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp index af1e9e2..15ff4ce 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp @@ -4,7 +4,6 @@ File: Log.cpp * Author : Trenser * Created : 01-Apr-2026 */ - #include "Log.h" //Getters and setters diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Log.h b/Trenser.Zenvy/Trenser.Zenvy/models/Log.h index f258643..cfb830d 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Log.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Log.h @@ -4,7 +4,6 @@ File: Log.h * Author : Trenser * Created : 01-Apr-2026 */ - #pragma once #include #include "Timestamp.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Notification.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Notification.cpp index 4527e2e..3da5d9b 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Notification.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Notification.cpp @@ -4,7 +4,6 @@ File: Notification.cpp * Author : Trenser * Created : 31-Mar-2026 */ - #include "Notification.h" int Notification::m_uid = 0; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Notification.h b/Trenser.Zenvy/Trenser.Zenvy/models/Notification.h index fa3e5a0..196078a 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Notification.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Notification.h @@ -4,7 +4,6 @@ File: Notification.h * Author : Trenser * Created : 31-Mar-2026 */ - #pragma once #include #include "Enums.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp index 99a0e90..7ed278b 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp @@ -4,7 +4,6 @@ File: Payroll.cpp * Author : Trenser * Created : 31-Mar-2026 */ - #include "Payroll.h" #include "StringHelper.h" #include "Factory.h" @@ -111,7 +110,7 @@ std::string Payroll::serialize() const return serializedPayroll.str(); } -std::shared_ptr Payroll::deserialize(const std::string& record) +Payroll* Payroll::deserialize(const std::string& record) { std::string id, employeeId; std::string basicSalaryString, houseRentAllowanceString, foodAllowanceString, employeePFString, employerPFString; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h index fbb360d..cb5e74b 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h @@ -4,7 +4,6 @@ File: Payroll.h * Author : Trenser * Created : 31-Mar-2026 */ - #pragma once #include #include @@ -62,6 +61,6 @@ public: void setEmployeePFContribution(double); void setEmployerPFContribution(double); std::string serialize() const; - static std::shared_ptr deserialize(const std::string&); + static Payroll* deserialize(const std::string&); static std::string getHeaders(); }; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp index 1c20103..e0198f2 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp @@ -4,7 +4,6 @@ File: Payslip.cpp * Author : Trenser * Created : 31-Mar-2026 */ - #include #include "Payslip.h" #include "StringHelper.h" @@ -68,7 +67,7 @@ std::string Payslip::serialize() const return serializedPayslip.str(); } -std::shared_ptr Payslip::deserialize(const std::string& record) +Payslip* Payslip::deserialize(const std::string& record) { std::string id, employeeId, timestampString; std::string salaryString; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h b/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h index 1b27587..7144570 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h @@ -4,7 +4,6 @@ File: Payslip.h * Author : Trenser * Created : 31-Mar-2026 */ - #pragma once #include #include @@ -32,6 +31,6 @@ public: const util::Timestamp& getTimestamp() const; const std::string& getEmployeeId() const; std::string serialize() const; - static std::shared_ptr deserialize(const std::string&); + static Payslip* deserialize(const std::string&); static std::string getHeaders(); }; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp index 364bd69..b760a32 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp @@ -4,7 +4,6 @@ File: Room.cpp * Author : Trenser * Created : 31-Mar-2026 */ - #include "Room.h" int Room::m_uid = 0; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Room.h b/Trenser.Zenvy/Trenser.Zenvy/models/Room.h index 23e3f95..3eb6934 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Room.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Room.h @@ -4,7 +4,6 @@ File: Room.h * Author : Trenser * Created : 31-Mar-2026 */ - #pragma once #include #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.cpp index 5c44816..7023cd6 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.cpp @@ -4,5 +4,4 @@ File: TalentExecutive.cpp * Author : Trenser * Created : 31-Mar-2026 */ - #include "TalentExecutive.h" \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h b/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h index 6f7c9ca..06b31a4 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h @@ -4,7 +4,6 @@ File: TalentExecutive.h * Author : Trenser * Created : 31-Mar-2026 */ - #pragma once #include "Employee.h" @@ -16,7 +15,7 @@ public: const std::string& name, const std::string& phone, const std::string& email, - std::shared_ptr payroll + Payroll* payroll ) :Employee(name, phone, email, Enums::EmployeeType::TALENT_ACQUISITION, payroll) {}; TalentExecutive(const std::string& id, const std::string& name, diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp index 7aa1c97..5168acb 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Team.cpp @@ -4,7 +4,6 @@ File: Team.cpp * Author : Trenser * Created : 31-Mar-2026 */ - #include "Team.h" int Team::m_uid = 0; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Team.h b/Trenser.Zenvy/Trenser.Zenvy/models/Team.h index 25937a5..9296243 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Team.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Team.h @@ -4,7 +4,6 @@ File: Team.h * Author : Trenser * Created : 31-Mar-2026 */ - #pragma once #include #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.cpp index c780ad7..91d1691 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.cpp @@ -4,5 +4,4 @@ File: TeamExecutive.cpp * Author : Trenser * Created : 31-Mar-2026 */ - #include "TeamExecutive.h" \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h b/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h index 2fc41f1..84e1b3f 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h @@ -4,7 +4,6 @@ File: TeamExecutive.h * Author : Trenser * Created : 31-Mar-2026 */ - #pragma once #include "Employee.h" @@ -16,7 +15,7 @@ public: const std::string& name, const std::string& phone, const std::string& email, - std::shared_ptr payroll + Payroll* payroll ) :Employee(name, phone, email, Enums::EmployeeType::TEAM, payroll) {}; TeamExecutive(const std::string& id, const std::string& name, diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.cpp index 58fc5b7..a07174e 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.cpp @@ -4,7 +4,6 @@ File: Ticket.cpp * Author : Trenser * Created : 31-Mar-2026 */ - #include "Ticket.h" int Ticket::m_uid = 0; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.h b/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.h index a4ec474..ba5f25e 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Ticket.h @@ -4,7 +4,6 @@ File: Ticket.h * Author : Trenser * Created : 31-Mar-2026 */ - #pragma once #include #include "Enums.h" From 133785dd3f7264630c939f26342d22e27375d8d3 Mon Sep 17 00:00:00 2001 From: Joel Mathew Thomas Date: Fri, 17 Apr 2026 09:33:37 +0530 Subject: [PATCH 14/19] refactor: change memory management and fix related code - Switched shared_ptr to raw pointers - Added cleanup logic in DataStore - Fixed Factory object creation - Updated function signatures to match changes - Small refactors and formatting fixes --- .../Trenser.FileManager/FileManager.h | 2 +- .../controllers/ZenvyController.cpp | 57 ++++++----- .../controllers/ZenvyController.h | 95 ++++++++++--------- .../Trenser.Zenvy/datastores/DataStore.cpp | 62 +++++++----- .../Trenser.Zenvy/datastores/DataStore.h | 2 +- .../Trenser.Zenvy/factories/Factory.h | 15 ++- Trenser.Zenvy/Trenser.Zenvy/models/Employee.h | 1 + .../Trenser.Zenvy/models/JobListing.h | 1 - .../Trenser.Zenvy/models/Payroll.cpp | 1 + Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h | 1 - Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h | 1 - Trenser.Zenvy/Trenser.Zenvy/models/Room.h | 1 - Trenser.Zenvy/Trenser.Zenvy/models/Team.h | 1 - .../services/EmployeeManagementService.cpp | 4 +- .../services/EmployeeManagementService.h | 30 +++--- .../Trenser.Zenvy/utilities/Validator.cpp | 8 +- .../Trenser.Zenvy/utilities/Validator.h | 9 +- .../Trenser.Zenvy/views/MenuHelper.h | 7 +- 18 files changed, 154 insertions(+), 144 deletions(-) diff --git a/Trenser.FileManager/Trenser.FileManager/FileManager.h b/Trenser.FileManager/Trenser.FileManager/FileManager.h index 1c9f3b2..198934d 100644 --- a/Trenser.FileManager/Trenser.FileManager/FileManager.h +++ b/Trenser.FileManager/Trenser.FileManager/FileManager.h @@ -2,7 +2,7 @@ #include #include "FileIO.h" -template using objects = std::map>; +template using objects = std::map; template class FileManager diff --git a/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp b/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp index 9584cce..e4d91bb 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp @@ -15,14 +15,13 @@ * password - password of the employee * Returns: * Tuple - login status, employee type, employee designation - * login status - success or failed + * login status - success or failed * employee type - type of the employee logged in * employee designation - designation if employee type is GENERAL. */ - AuthenticationDTO ZenvyController::login(const std::string& email, const std::string& password) { - return m_authenticationManagementService->login(email, password); + return m_authenticationManagementService->login(email, password); } /* @@ -36,7 +35,7 @@ AuthenticationDTO ZenvyController::login(const std::string& email, const std::st void ZenvyController::logout() { - m_authenticationManagementService->logout(); + m_authenticationManagementService->logout(); } /* @@ -50,73 +49,73 @@ void ZenvyController::logout() void ZenvyController::changePassword(const std::string& password) { - m_authenticationManagementService->changePassword(password); + m_authenticationManagementService->changePassword(password); } //Employee Management -void ZenvyController::createEmployee(Enums::EmployeeType employeeType, Enums::EmployeeDesignation employeeDesignation, const std::string& email, const std::string& name, const std::string& phone) +void ZenvyController::createEmployee(Enums::EmployeeType employeeType, Enums::EmployeeDesignation employeeDesignation, const std::string& email, const std::string& name, const std::string& phone) const { - m_employeeManagementService->createEmployee(employeeType, employeeDesignation, email, name, phone); + m_employeeManagementService->createEmployee(employeeType, employeeDesignation, email, name, phone); } -bool ZenvyController::deactivateEmployee(const std::string& id) +bool ZenvyController::deactivateEmployee(const std::string& id) const { - return m_employeeManagementService->deactivateEmployee(id); + return m_employeeManagementService->deactivateEmployee(id); } void ZenvyController::updateProfile(const std::string& name, const std::string& phone) { - m_employeeManagementService->updateProfile(name,phone); + m_employeeManagementService->updateProfile(name, phone); } -std::pair>> ZenvyController::searchEmployee(const std::string& name) +std::pair> ZenvyController::searchEmployee(const std::string& name) { - return m_employeeManagementService->searchEmployee(name); + return m_employeeManagementService->searchEmployee(name); } -std::shared_ptr ZenvyController::getCurrentEmployee() +const Employee* ZenvyController::getCurrentEmployee() const { - return m_employeeManagementService->getCurrentEmployee(); + return m_employeeManagementService->getCurrentEmployee(); } -bool ZenvyController::updateDesignation(const std::string& id,Enums::EmployeeDesignation designation) +bool ZenvyController::updateDesignation(const std::string& id, Enums::EmployeeDesignation designation) { - return m_employeeManagementService->updateDesignation(id,designation); + return m_employeeManagementService->updateDesignation(id, designation); } -std::vector> ZenvyController::getShorlistedCandidates() +std::vector ZenvyController::getShorlistedCandidates() const { - return m_employeeManagementService->getShorlistedCandidates(); + return m_employeeManagementService->getShorlistedCandidates(); } //Payslip Management void ZenvyController::updateSalary(const std::string& employeeId, double basicSalary, double houseRentAllowance, double foodAllowance, double employeePFContribution, double employerPFContribution) { - m_payslipManagementService->updateSalary(employeeId, basicSalary, houseRentAllowance, foodAllowance, employeePFContribution, employerPFContribution); + m_payslipManagementService->updateSalary(employeeId, basicSalary, houseRentAllowance, foodAllowance, employeePFContribution, employerPFContribution); } void ZenvyController::generatePayslips() { - m_payslipManagementService->generatePayslips(); + m_payslipManagementService->generatePayslips(); } void ZenvyController::loadStates() { - m_employeeManagementService->loadEmployees(); - m_payslipManagementService->loadPayrolls(); - m_payslipManagementService->loadPayslips(); + m_employeeManagementService->loadEmployees(); + m_payslipManagementService->loadPayrolls(); + m_payslipManagementService->loadPayslips(); } void ZenvyController::persistStates() { - m_employeeManagementService->saveEmployees(); - m_payslipManagementService->savePayrolls(); - m_payslipManagementService->savePayslips(); + m_employeeManagementService->saveEmployees(); + m_payslipManagementService->savePayrolls(); + m_payslipManagementService->savePayslips(); } -std::pair, std::shared_ptr> ZenvyController::getPayslipForMonth(const std::string& employeeId, int year, int month) +std::pair ZenvyController::getPayslipForMonth(const std::string& employeeId, int year, int month) { - return m_payslipManagementService->getPayslipForMonth(employeeId, year, month); + return m_payslipManagementService->getPayslipForMonth(employeeId, year, month); } ZenvyController::~ZenvyController() @@ -131,4 +130,4 @@ ZenvyController::~ZenvyController() delete m_talentAcquisitionManagementService; delete m_teamManagementService; delete m_ticketManagementService; -} +} \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.h b/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.h index c6151eb..3f503d4 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.h +++ b/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.h @@ -22,55 +22,56 @@ class ZenvyController { private: - AuthenticationManagementService* m_authenticationManagementService; - AttendanceManagementService* m_attendanceManagementService; - BookingManagementService* m_bookingManagementService; - EmployeeManagementService* m_employeeManagementService; - LeaveManagementService* m_leaveManagementService; - NotificationManagementService* m_notificationManagementService; - PayslipManagementService* m_payslipManagementService; - TalentAcquisitionManagementService* m_talentAcquisitionManagementService; - TeamManagementService* m_teamManagementService; - TicketManagementService* m_ticketManagementService; + AuthenticationManagementService* m_authenticationManagementService; + AttendanceManagementService* m_attendanceManagementService; + BookingManagementService* m_bookingManagementService; + EmployeeManagementService* m_employeeManagementService; + LeaveManagementService* m_leaveManagementService; + NotificationManagementService* m_notificationManagementService; + PayslipManagementService* m_payslipManagementService; + TalentAcquisitionManagementService* m_talentAcquisitionManagementService; + TeamManagementService* m_teamManagementService; + TicketManagementService* m_ticketManagementService; public: - ZenvyController() : - m_authenticationManagementService(new AuthenticationManagementService()), - m_attendanceManagementService(new AttendanceManagementService()), - m_bookingManagementService(new BookingManagementService()), - m_employeeManagementService(new EmployeeManagementService()), - m_leaveManagementService(new LeaveManagementService()), - m_notificationManagementService(new NotificationManagementService()), - m_payslipManagementService(new PayslipManagementService()), - m_talentAcquisitionManagementService(new TalentAcquisitionManagementService()), - m_teamManagementService(new TeamManagementService()), - m_ticketManagementService(new TicketManagementService()) {}; - - //Authentication - AuthenticationDTO login(const std::string& email, const std::string& password); - void logout(); - void changePassword(const std::string&); + ZenvyController() : + m_authenticationManagementService(new AuthenticationManagementService()), + m_attendanceManagementService(new AttendanceManagementService()), + m_bookingManagementService(new BookingManagementService()), + m_employeeManagementService(new EmployeeManagementService()), + m_leaveManagementService(new LeaveManagementService()), + m_notificationManagementService(new NotificationManagementService()), + m_payslipManagementService(new PayslipManagementService()), + m_talentAcquisitionManagementService(new TalentAcquisitionManagementService()), + m_teamManagementService(new TeamManagementService()), + m_ticketManagementService(new TicketManagementService()) {}; + ~ZenvyController(); - //Employee Management - void createEmployee(Enums::EmployeeType, Enums::EmployeeDesignation, const std::string&, const std::string&, const std::string&); - bool deactivateEmployee(const std::string&); - std::shared_ptr getCurrentEmployee(); - void updateProfile(const std::string&,const std::string&); - std::pair>> searchEmployee(const std::string&); - bool updateDesignation(const std::string&,Enums::EmployeeDesignation); - std::vector> getShorlistedCandidates(); + //Authentication + AuthenticationDTO login(const std::string& email, const std::string& password); + void logout(); + void changePassword(const std::string&); - template - Employees getEmployees(Types ...types) - { - return m_employeeManagementService->getEmployees(types...); - } + //Employee Management + void createEmployee(Enums::EmployeeType, Enums::EmployeeDesignation, const std::string&, const std::string&, const std::string&) const; + bool deactivateEmployee(const std::string&) const; + const Employee* getCurrentEmployee() const; + void updateProfile(const std::string&, const std::string&); + std::pair> searchEmployee(const std::string&); + bool updateDesignation(const std::string&, Enums::EmployeeDesignation); + std::vector getShorlistedCandidates() const; - //Payslip management - void updateSalary(const std::string&, double, double, double, double, double); - void generatePayslips(); - std::pair, std::shared_ptr>getPayslipForMonth(const std::string&, int, int); + template + Employees getEmployees(Types ...types) const + { + return m_employeeManagementService->getEmployees(types...); + } - //File Management - void loadStates(); - void persistStates(); -}; + //Payslip management + void updateSalary(const std::string&, double, double, double, double, double); + void generatePayslips(); + std::pairgetPayslipForMonth(const std::string&, int, int); + + //File Management + void loadStates(); + void persistStates(); +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp index a8a23a7..4495e9d 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp @@ -8,19 +8,19 @@ #include "DataStore.h" #include "EmployeeManagementService.h" -/* - * Function: getInstance - * Description: provides a singleton instance of the DataStore. - * Parameters: - * None - * Returns: - * DataStore& - reference to the single DataStore object. - */ + /* + * Function: getInstance + * Description: provides a singleton instance of the DataStore. + * Parameters: + * None + * Returns: + * DataStore& - reference to the single DataStore object. + */ DataStore& DataStore::getInstance() { - static DataStore dataStore; - return dataStore; + static DataStore dataStore; + return dataStore; } /* @@ -34,7 +34,7 @@ DataStore& DataStore::getInstance() logMap& DataStore::getLogs() { - return m_logs; + return m_logs; } /* @@ -48,7 +48,7 @@ logMap& DataStore::getLogs() Employee*& DataStore::getAuthenticatedEmployee() { - return m_authenticatedEmployee; + return m_authenticatedEmployee; } /* @@ -62,7 +62,7 @@ Employee*& DataStore::getAuthenticatedEmployee() void DataStore::setAuthenticatedEmployee(Employee* authenticatedEmployee) { - m_authenticatedEmployee = authenticatedEmployee; + m_authenticatedEmployee = authenticatedEmployee; } /* @@ -76,12 +76,22 @@ void DataStore::setAuthenticatedEmployee(Employee* authenticatedEmployee) employeeMap& DataStore::getEmployees() { - return m_employees; + return m_employees; } payrollMap& DataStore::getPayrolls() { - return m_payrolls; + return m_payrolls; +} + +payslipMap& DataStore::getPayslips() +{ + return m_payslips; +} + +candidateMap& DataStore::getCandidates() +{ + return m_candidates; } DataStore::~DataStore() @@ -91,19 +101,25 @@ DataStore::~DataStore() delete pair.second; } m_employees.clear(); + for (auto& pair : m_payrolls) + { + delete pair.second; + } + m_payrolls.clear(); + for (auto& pair : m_payslips) + { + delete pair.second; + } + m_payslips.clear(); for (auto& pair : m_logs) { delete pair.second; } m_logs.clear(); - if (m_authenticatedEmployee) + for (auto& pair : m_candidates) { - delete m_authenticatedEmployee; - m_authenticatedEmployee = nullptr; + delete pair.second; } -} - -payslipMap& DataStore::getPayslips() -{ - return m_payslips; + m_candidates.clear(); + m_authenticatedEmployee = nullptr; } diff --git a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h index 957ea04..3fe7ed6 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h +++ b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.h @@ -49,7 +49,7 @@ public: DataStore& operator=(const DataStore&) = delete; DataStore(DataStore&&) = delete; DataStore& operator=(DataStore&&) = delete; - employeeMap& getEmployees(); + employeeMap& getEmployees(); payrollMap& getPayrolls(); payslipMap& getPayslips(); logMap& getLogs(); diff --git a/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h b/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h index 216a823..15b829d 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h +++ b/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h @@ -20,11 +20,10 @@ public: * Args - constructor arguments forwarded to T's constructor * Returns: * std::shared_ptr - a shared pointer managing the newly created object - */ - - template - static T* getObject(Args&&... args) - { - return T*(std::forward(args)...); - } -}; + */; + template + static T* getObject(Args&&... args) + { + return new T(std::forward(args)...); + } +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Employee.h b/Trenser.Zenvy/Trenser.Zenvy/models/Employee.h index 640a9be..214e89c 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Employee.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Employee.h @@ -44,6 +44,7 @@ public: m_accountStatus(Enums::AccountStatus::ACTIVE), m_teamStatus(Enums::TeamStatus::NOT_IN_TEAM), m_teamId(""), + m_payroll(nullptr), m_employeeType(Enums::EmployeeType::GENERAL) {} Employee(const std::string& name, const std::string& phone, diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h b/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h index 3332b08..ddbf58d 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/JobListing.h @@ -7,7 +7,6 @@ File: JobListing.h #pragma once #include #include -#include #include "Candidate.h" #include "Enums.h" using candidateMap = std::map; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp index 7ed278b..d5afbdb 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp @@ -4,6 +4,7 @@ File: Payroll.cpp * Author : Trenser * Created : 31-Mar-2026 */ +#include #include "Payroll.h" #include "StringHelper.h" #include "Factory.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h index cb5e74b..ebf13ed 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h @@ -6,7 +6,6 @@ File: Payroll.h */ #pragma once #include -#include #include "Timestamp.h" class Payroll diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h b/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h index 7144570..e5e617f 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h @@ -5,7 +5,6 @@ File: Payslip.h * Created : 31-Mar-2026 */ #pragma once -#include #include #include "Timestamp.h" diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Room.h b/Trenser.Zenvy/Trenser.Zenvy/models/Room.h index 3eb6934..63a52a8 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Room.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Room.h @@ -7,7 +7,6 @@ File: Room.h #pragma once #include #include -#include #include "Booking.h" using bookingMap = std::map; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Team.h b/Trenser.Zenvy/Trenser.Zenvy/models/Team.h index 9296243..7afcaae 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Team.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Team.h @@ -7,7 +7,6 @@ File: Team.h #pragma once #include #include -#include #include "Employee.h" using employeeMap = std::map; diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.cpp index ecd60d9..f0c9045 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.cpp @@ -24,8 +24,8 @@ void EmployeeManagementService::createEmployee(Enums::EmployeeType employeeType, throw std::runtime_error("No authenticated user"); } Enums::EmployeeType authenticatedEmployeeType = authenticatedEmployee->getEmployeeType(); - Employee* employee; - Payroll* payroll; + Employee* employee = nullptr; + Payroll* payroll = nullptr; if (employeeType != Enums::EmployeeType::GENERAL && util::hasActiveEmployeeOfType(employeeType, employees)) { throw std::runtime_error("Cannot create more than one employee of type " + Enums::getEmployeeTypeString(employeeType)); diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.h index a292c31..d8ea1bc 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.h @@ -7,23 +7,23 @@ #include "Enums.h" #include "StringHelper.h" -using Employees = std::vector>; +using Employees = std::vector; class EmployeeManagementService { private: - DataStore& m_dataStore; + DataStore& m_dataStore; public: - EmployeeManagementService() : m_dataStore(DataStore::getInstance()) {}; - void createEmployee(Enums::EmployeeType, Enums::EmployeeDesignation, const std::string&, const std::string&, const std::string&); - bool deactivateEmployee(const std::string&); - bool updateDesignation(const std::string&,Enums::EmployeeDesignation); - void updateProfile(const std::string&,const std::string&); - std::pair>> searchEmployee(const std::string&); - std::shared_ptr getCurrentEmployee(); - std::vector> getShorlistedCandidates(); - void loadEmployees(); - void saveEmployees(); + EmployeeManagementService() : m_dataStore(DataStore::getInstance()) {}; + void createEmployee(Enums::EmployeeType, Enums::EmployeeDesignation, const std::string&, const std::string&, const std::string&); + bool deactivateEmployee(const std::string&); + bool updateDesignation(const std::string&, Enums::EmployeeDesignation); + void updateProfile(const std::string&, const std::string&); + std::pair> searchEmployee(const std::string&); + const Employee* getCurrentEmployee(); + std::vector getShorlistedCandidates(); + void loadEmployees(); + void saveEmployees(); template Employees getEmployees(Types... types) @@ -52,8 +52,8 @@ public: std::sort( filteredEmployees.begin(), filteredEmployees.end(), - [](const std::shared_ptr& employeeOne, - const std::shared_ptr& employeeTwo) + [](const Employee* employeeOne, + const Employee* employeeTwo) { return util::extractNumber(employeeOne->getId()) < util::extractNumber(employeeTwo->getId()); @@ -61,4 +61,4 @@ public: ); return filteredEmployees; } -}; +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.cpp b/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.cpp index 2996d71..f06a860 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.cpp @@ -112,7 +112,7 @@ bool util::isPasswordValid(const std::string& password) return hasUpper && hasLower && hasDigit && hasSpecial; } -bool util::hasActiveEmployeeOfType(Enums::EmployeeType employeeType, const std::map> & employees) +bool util::hasActiveEmployeeOfType(Enums::EmployeeType employeeType, const std::map & employees) { for (const auto& employeePair : employees) { @@ -125,7 +125,7 @@ bool util::hasActiveEmployeeOfType(Enums::EmployeeType employeeType, const std:: return false; } -bool util::isEmailDuplicate(const std::string& email, const std::map>& employees) +bool util::isEmailDuplicate(const std::string& email, const std::map& employees) { for (const auto& employeePair : employees) { @@ -138,7 +138,7 @@ bool util::isEmailDuplicate(const std::string& email, const std::map>& employees) +bool util::isPhoneDuplicate(const std::string& phone, const std::map& employees) { for (const auto& employeePair : employees) { @@ -151,7 +151,7 @@ bool util::isPhoneDuplicate(const std::string& phone, const std::map>& employees) +bool util::isPhoneDuplicate(const std::string& phone, const std::vector& employees) { for (const auto& employee : employees) { diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.h b/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.h index c7d2b60..eaef165 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.h +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 01-Apr-2026 */ - #pragma once #include #include @@ -21,8 +20,8 @@ namespace util bool isPhoneNumberValid(const std::string&); bool isEmailValid(const std::string&); bool isPasswordValid(const std::string&); - bool hasActiveEmployeeOfType(Enums::EmployeeType, const std::map>&); - bool isEmailDuplicate(const std::string&, const std::map>&); - bool isPhoneDuplicate(const std::string&, const std::map>&); - bool isPhoneDuplicate(const std::string&, const std::vector>&); + bool hasActiveEmployeeOfType(Enums::EmployeeType, const std::map&); + bool isEmailDuplicate(const std::string&, const std::map&); + bool isPhoneDuplicate(const std::string&, const std::map&); + bool isPhoneDuplicate(const std::string&, const std::vector&); } \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.h b/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.h index 7cee5cb..d7517f1 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.h @@ -1,6 +1,5 @@ #pragma once #include -#include #include #include #include @@ -22,7 +21,7 @@ void addShortlistedCandidateAsEmployee(const ZenvyController* m_zenvyController) inline void viewPayslipHistory(ZenvyController* m_zenvyController) { - auto employeePayslips = m_zenvyController->getCurrentEmployee()->getEmployeePayslips(); + auto& employeePayslips = m_zenvyController->getCurrentEmployee()->getEmployeePayslips(); util::clear(); if (employeePayslips.empty()) { @@ -147,7 +146,7 @@ inline void updateProfile(ZenvyController* m_zenvyController) } } -inline std::string selectEmployeeId(std::vector& allEmployees) +inline std::string selectEmployeeId(const std::vector& allEmployees) { int choice; std::map employeeList; @@ -353,7 +352,7 @@ inline void viewPayslip(ZenvyController* m_zenvyController) if (payroll && payslip) { util::clear(); - std::cout << "Payslip for " << employee->getEmployeeName() << " (" << year << "-" << std::setw(2) << std::setfill('0') << month << ")\n\n"; + std::cout << "Payslip for " << employee->getEmployeeName() << " (" << year << "-" << std::setw(2) << month << ")\n\n"; std::cout << "Basic Salary : " << payroll->getBasicSalary() << "\n"; std::cout << "House Rent Allowance : " << payroll->getHouseRentAllowance() << "\n"; std::cout << "Food Allowance : " << payroll->getFoodAllowance() << "\n"; From a0c499d78fdf34fb844ddc9a3a30b15c6400d051 Mon Sep 17 00:00:00 2001 From: Tinu Johnson Date: Fri, 17 Apr 2026 10:26:33 +0530 Subject: [PATCH 15/19] Add function headers in models --- .../Trenser.Zenvy/models/Employee.cpp | 62 +++++++++++++++---- Trenser.Zenvy/Trenser.Zenvy/models/FAQ.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/FAQ.h | 3 +- .../Trenser.Zenvy/models/FinanceExecutive.h | 3 +- .../Trenser.Zenvy/models/GeneralEmployee.cpp | 26 ++++++-- .../Trenser.Zenvy/models/HRManager.cpp | 2 +- .../Trenser.Zenvy/models/HRManager.h | 3 +- .../Trenser.Zenvy/models/ITExecutive.h | 3 +- Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp | 8 +-- 9 files changed, 79 insertions(+), 33 deletions(-) diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp index f34534f..7795d56 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Employee.cpp @@ -105,6 +105,16 @@ const leaveMap& Employee::getEmployeeLeaves() const return m_leaves; } +Enums::EmployeeType Employee::getEmployeeType() const +{ + return m_employeeType; +} + +std::string Employee::getHeaders() +{ + return "EmployeeId,Email,Name,Phone,Password,TeamID,TeamStatus,AccountStatus,EmployeeType"; +} + void Employee::setEmployeeId(const std::string& id) { m_id = id; @@ -145,6 +155,14 @@ void Employee::setEmployeePayroll(Payroll* payroll) m_payroll = payroll; } +/* +* Function: addPayslip +* Description : Adds a payslip to the employee's payslip records +* Parameters : + payslip - Pointer to the Payslip object to be added +* Returns : + void + */ void Employee::addPayslip(Payslip* payslip) { if (payslip) @@ -153,6 +171,14 @@ void Employee::addPayslip(Payslip* payslip) } } +/* + * Function: addAttendance + * Description: Adds an attendance record to the employee's attendance history + * Parameters: + * attendance - Pointer to the Attendance object containing login information + * Returns: + * void + */ void Employee::addAttendance(Attendance* attendance) { if (attendance) @@ -161,6 +187,14 @@ void Employee::addAttendance(Attendance* attendance) } } +/* + * Function: addLeave + * Description: Adds a leave record to the employee's leave history + * Parameters: + * leave - Pointer to the Leave object to be added + * Returns: + * void + */ void Employee::addLeave(Leave* leave) { if (leave) @@ -169,11 +203,14 @@ void Employee::addLeave(Leave* leave) } } -Enums::EmployeeType Employee::getEmployeeType() const -{ - return m_employeeType; -} - +/* + * Function: serialize + * Description: Serializes the employee object's core details into a comma-separated string + * Parameters: + None + * Returns: + A string containing serialized employee data in CSV format + */ std::string Employee::serialize() const { std::ostringstream serializedEmployee; @@ -189,6 +226,14 @@ std::string Employee::serialize() const return serializedEmployee.str(); } +/* + * Function: deserialize + * Description: Creates and returns an Employee object from a serialized comma-separated record string + * Parameters: + record - A string containing serialized employee data in CSV format + * Returns: + Pointer to a newly created Employee object based on the employee type + */ Employee* Employee::deserialize(const std::string& record) { std::string id, name, phone, password, email; @@ -279,9 +324,4 @@ Employee* Employee::deserialize(const std::string& record) default: return nullptr; } -} - -std::string Employee::getHeaders() -{ - return "EmployeeId,Email,Name,Phone,Password,TeamID,TeamStatus,AccountStatus,EmployeeType"; -} +} \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/FAQ.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/FAQ.cpp index a5e7b41..4badf93 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/FAQ.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/FAQ.cpp @@ -4,4 +4,4 @@ * Author: Trenser * Created: 02-Apr-2026 */ -#include "Faq.h" +#include "Faq.h" \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/FAQ.h b/Trenser.Zenvy/Trenser.Zenvy/models/FAQ.h index 3788612..a2ba8bf 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/FAQ.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/FAQ.h @@ -8,5 +8,4 @@ class Faq { -}; - +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.h b/Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.h index 3a899d9..1a58dfe 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/FinanceExecutive.h @@ -35,5 +35,4 @@ public: Enums::EmployeeType::FINANCE, accountStatus) {} ~FinanceExecutive() = default; -}; - +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.cpp index 8ce81ba..fcf784c 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/GeneralEmployee.cpp @@ -13,11 +13,24 @@ Enums::EmployeeDesignation GeneralEmployee::getDesignation() const return m_designation; } +std::string GeneralEmployee::getHeaders() +{ + return "EmployeeId,Email,Name,Phone,Password,TeamID,TeamStatus,AccountStatus,EmployeeType,EmployeeDesignation"; +} + void GeneralEmployee::setDesignation(Enums::EmployeeDesignation designation) { m_designation = designation; } +/* + * Function: serialize + * Description: Serializes the general employee's details, including designation, into a comma-separated string + * Parameters: + None + * Returns: + A string containing serialized general employee data in CSV format + */ std::string GeneralEmployee::serialize() const { std::ostringstream serializedEmployee; @@ -34,6 +47,14 @@ std::string GeneralEmployee::serialize() const return serializedEmployee.str(); } +/* + * Function: deserialize + * Description: Creates and returns a GeneralEmployee object from a serialized comma-separated record string + * Parameters: + record - A string containing serialized general employee data in CSV format + * Returns: + Pointer to a newly created GeneralEmployee object + */ GeneralEmployee* GeneralEmployee::deserialize(const std::string& record) { std::string id, name, phone, password, email; @@ -64,9 +85,4 @@ GeneralEmployee* GeneralEmployee::deserialize(const std::string& record) employeeDesignation, accountStatus ); -} - -std::string GeneralEmployee::getHeaders() -{ - return "EmployeeId,Email,Name,Phone,Password,TeamID,TeamStatus,AccountStatus,EmployeeType,EmployeeDesignation"; } \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.cpp index 8f9615f..3a3733b 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.cpp @@ -4,4 +4,4 @@ * Author: Trenser * Created: 31-Mar-2026 */ -#include "HRManager.h" +#include "HRManager.h" \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.h b/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.h index 41fa740..6a08f03 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/HRManager.h @@ -35,5 +35,4 @@ public: Enums::EmployeeType::HR, accountStatus) {} ~HRManager() = default; -}; - +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.h b/Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.h index 9d02cd1..ab807e8 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/ITExecutive.h @@ -35,5 +35,4 @@ public: Enums::EmployeeType::IT, accountStatus) {} ~ITExecutive() = default; -}; - +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp index 3519d1e..e33e319 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp @@ -86,10 +86,4 @@ void Leave::setNumberOfMedicalLeave(int value) void Leave::setLeaveType(Enums::LeaveType type) { m_leaveType = type; -} - -int Leave::m_numberOfGeneralLeave = 12; - -int Leave::m_numberOfRestrictedLeave = 2; - -int Leave::m_numberOfMedicalLeave = 6; \ No newline at end of file +} \ No newline at end of file From a8d50c29f8d29a4fdb2eec28959d674fbd9ce82f Mon Sep 17 00:00:00 2001 From: Joel Mathew Thomas Date: Fri, 17 Apr 2026 10:27:27 +0530 Subject: [PATCH 16/19] Add function headers in Controller, DataStore, and Utilities --- .../controllers/ZenvyController.cpp | 130 ++++++++++++++- .../Trenser.Zenvy/datastores/DataStore.cpp | 47 ++++-- .../Trenser.Zenvy/factories/Factory.h | 22 +-- Trenser.Zenvy/Trenser.Zenvy/utilities/Enums.h | 157 ++++++++++++++---- .../Trenser.Zenvy/utilities/InputHelper.h | 4 - .../Trenser.Zenvy/utilities/OutputHelper.cpp | 2 - .../Trenser.Zenvy/utilities/OutputHelper.h | 1 - .../Trenser.Zenvy/utilities/StringHelper.cpp | 16 +- .../Trenser.Zenvy/utilities/StringHelper.h | 6 + .../Trenser.Zenvy/utilities/Timestamp.cpp | 56 ++++--- .../Trenser.Zenvy/utilities/Timestamp.h | 1 - .../Trenser.Zenvy/utilities/Validator.cpp | 57 +++++-- 12 files changed, 390 insertions(+), 109 deletions(-) diff --git a/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp b/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp index e4d91bb..26e3df4 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/controllers/ZenvyController.cpp @@ -4,7 +4,6 @@ * Author: Trenser * Created : 01-Apr-2026 */ - #include "ZenvyController.h" /* @@ -25,14 +24,13 @@ AuthenticationDTO ZenvyController::login(const std::string& email, const std::st } /* - * Function: changePassword - * Description: updates the password of the currently authenticated employee. + * Function: logout + * Description: logs out the currently authenticated employee * Parameters: - * password - the new password to be set for the employee + * None * Returns: * void - no return value */ - void ZenvyController::logout() { m_authenticationManagementService->logout(); @@ -40,65 +38,153 @@ void ZenvyController::logout() /* * Function: changePassword - * Description: updates the password of the currently authenticated employee. + * Description: updates the password of the currently authenticated employee * Parameters: * password - the new password to be set for the employee * Returns: * void - no return value */ - void ZenvyController::changePassword(const std::string& password) { m_authenticationManagementService->changePassword(password); } -//Employee Management +/* + * Function: createEmployee + * Description: creates a new employee with the given details + * Parameters: + * employeeType - type of employee to be created + * employeeDesignation - designation of the employee + * email - email address of the employee + * name - name of the employee + * phone - phone number of the employee + * Returns: + * void - no return value + */ void ZenvyController::createEmployee(Enums::EmployeeType employeeType, Enums::EmployeeDesignation employeeDesignation, const std::string& email, const std::string& name, const std::string& phone) const { m_employeeManagementService->createEmployee(employeeType, employeeDesignation, email, name, phone); } +/* + * Function: deactivateEmployee + * Description: deactivates an employee based on employee ID + * Parameters: + * id - unique employee ID + * Returns: + * bool - true if deactivated successfully, false otherwise + */ bool ZenvyController::deactivateEmployee(const std::string& id) const { return m_employeeManagementService->deactivateEmployee(id); } +/* + * Function: updateProfile + * Description: updates the profile of the currently authenticated employee + * Parameters: + * name - updated name of the employee + * phone - updated phone number + * Returns: + * void - no return value + */ void ZenvyController::updateProfile(const std::string& name, const std::string& phone) { m_employeeManagementService->updateProfile(name, phone); } +/* + * Function: searchEmployee + * Description: searches employees based on name + * Parameters: + * name - name or partial name of the employee + * Returns: + * Pair of employee type and list of matching employees + */ std::pair> ZenvyController::searchEmployee(const std::string& name) { return m_employeeManagementService->searchEmployee(name); } +/* + * Function: getCurrentEmployee + * Description: retrieves the currently authenticated employee + * Parameters: + * None + * Returns: + * Pointer to the authenticated employee + */ const Employee* ZenvyController::getCurrentEmployee() const { return m_employeeManagementService->getCurrentEmployee(); } +/* + * Function: updateDesignation + * Description: updates the designation of an employee + * Parameters: + * id - unique employee ID + * designation - new designation to be assigned + * Returns: + * bool - true if update is successful, false otherwise + */ bool ZenvyController::updateDesignation(const std::string& id, Enums::EmployeeDesignation designation) { return m_employeeManagementService->updateDesignation(id, designation); } +/* + * Function: getShorlistedCandidates + * Description: retrieves the list of shortlisted candidates + * Parameters: + * None + * Returns: + * Vector of shortlisted candidate pointers + */ std::vector ZenvyController::getShorlistedCandidates() const { return m_employeeManagementService->getShorlistedCandidates(); } -//Payslip Management +/* + * Function: updateSalary + * Description: updates salary details of an employee + * Parameters: + * employeeId - unique employee ID + * basicSalary - basic salary amount + * houseRentAllowance - HRA amount + * foodAllowance - food allowance amount + * employeePFContribution - employee PF contribution + * employerPFContribution - employer PF contribution + * Returns: + * void - no return value + */ void ZenvyController::updateSalary(const std::string& employeeId, double basicSalary, double houseRentAllowance, double foodAllowance, double employeePFContribution, double employerPFContribution) { m_payslipManagementService->updateSalary(employeeId, basicSalary, houseRentAllowance, foodAllowance, employeePFContribution, employerPFContribution); } +/* + * Function: generatePayslips + * Description: generates payslips for all eligible employees + * Parameters: + * None + * Returns: + * void - no return value + */ void ZenvyController::generatePayslips() { m_payslipManagementService->generatePayslips(); } +/* + * Function: loadStates + * Description: loads persisted application data into memory + * Parameters: + * None + * Returns: + * void - no return value + */ void ZenvyController::loadStates() { m_employeeManagementService->loadEmployees(); @@ -106,6 +192,14 @@ void ZenvyController::loadStates() m_payslipManagementService->loadPayslips(); } +/* + * Function: persistStates + * Description: saves current application data to storage + * Parameters: + * None + * Returns: + * void - no return value + */ void ZenvyController::persistStates() { m_employeeManagementService->saveEmployees(); @@ -113,11 +207,29 @@ void ZenvyController::persistStates() m_payslipManagementService->savePayslips(); } +/* + * Function: getPayslipForMonth + * Description: retrieves payroll and payslip details for a specific month + * Parameters: + * employeeId - unique employee ID + * year - year of the payslip + * month - month of the payslip + * Returns: + * Pair of payroll and payslip pointers + */ std::pair ZenvyController::getPayslipForMonth(const std::string& employeeId, int year, int month) { return m_payslipManagementService->getPayslipForMonth(employeeId, year, month); } +/* + * Function: ~ZenvyController + * Description: cleans up dynamically allocated service objects + * Parameters: + * None + * Returns: + * void - no return value + */ ZenvyController::~ZenvyController() { delete m_authenticationManagementService; diff --git a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp index 4495e9d..fa5610d 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/datastores/DataStore.cpp @@ -16,7 +16,6 @@ * Returns: * DataStore& - reference to the single DataStore object. */ - DataStore& DataStore::getInstance() { static DataStore dataStore; @@ -31,7 +30,6 @@ DataStore& DataStore::getInstance() * Returns: * logMap& - reference to the log map. */ - logMap& DataStore::getLogs() { return m_logs; @@ -39,13 +37,12 @@ logMap& DataStore::getLogs() /* * Function: getAuthenticatedEmployee - * Description: returns the currently authenticated employee. + * Description: retrieves the currently authenticated employee. * Parameters: * None * Returns: - * std::shared_ptr& - reference to the authenticated employee object. + * Employee*& - reference to the authenticated employee pointer. */ - Employee*& DataStore::getAuthenticatedEmployee() { return m_authenticatedEmployee; @@ -55,11 +52,10 @@ Employee*& DataStore::getAuthenticatedEmployee() * Function: setAuthenticatedEmployee * Description: sets the currently authenticated employee. * Parameters: - * authenticatedEmployee - shared pointer to the employee object to be set as authenticated. + * authenticatedEmployee - pointer to the employee to be set as authenticated. * Returns: * void - no return value. */ - void DataStore::setAuthenticatedEmployee(Employee* authenticatedEmployee) { m_authenticatedEmployee = authenticatedEmployee; @@ -67,33 +63,64 @@ void DataStore::setAuthenticatedEmployee(Employee* authenticatedEmployee) /* * Function: getEmployees - * Description: retrieves the employee map containing all employees. + * Description: retrieves the map containing all employees. * Parameters: * None * Returns: * employeeMap& - reference to the employee map. */ - employeeMap& DataStore::getEmployees() { return m_employees; } +/* + * Function: getPayrolls + * Description: retrieves the map containing all payroll records. + * Parameters: + * None + * Returns: + * payrollMap& - reference to the payroll map. + */ payrollMap& DataStore::getPayrolls() { return m_payrolls; } +/* + * Function: getPayslips + * Description: retrieves the map containing all payslip records. + * Parameters: + * None + * Returns: + * payslipMap& - reference to the payslip map. + */ payslipMap& DataStore::getPayslips() { return m_payslips; } +/* + * Function: getCandidates + * Description: retrieves the map containing all shortlisted candidates. + * Parameters: + * None + * Returns: + * candidateMap& - reference to the candidate map. + */ candidateMap& DataStore::getCandidates() { return m_candidates; } +/* + * Function: ~DataStore + * Description: releases all dynamically allocated objects stored in the DataStore. + * Parameters: + * None + * Returns: + * void - no return value. + */ DataStore::~DataStore() { for (auto& pair : m_employees) @@ -122,4 +149,4 @@ DataStore::~DataStore() } m_candidates.clear(); m_authenticatedEmployee = nullptr; -} +} \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h b/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h index 15b829d..40eaf40 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h +++ b/Trenser.Zenvy/Trenser.Zenvy/factories/Factory.h @@ -1,7 +1,7 @@ /* * File: Factory.h - * Description: Provides a generic factory utility to create shared_ptr instances of objects. - * Author: Ajmal J S + * Description: Provides a generic factory utility to create objects. + * Author: Trenser * Created: 01-Apr-2026 */ @@ -13,17 +13,17 @@ class Factory public: /* - * Function: getObject - * Description: Creates and returns a shared_ptr to an object of type T. - * Parameters: - * T - the type of object to be created - * Args - constructor arguments forwarded to T's constructor - * Returns: - * std::shared_ptr - a shared pointer managing the newly created object - */; + * Function: getObject + * Description: Creates and returns a dynamically allocated object of type T. + * Parameters: + * T - the type of object to be created + * Args - constructor arguments forwarded to T's constructor + * Returns: + * T* - pointer to the newly created object + */ template static T* getObject(Args&&... args) { return new T(std::forward(args)...); } -}; \ No newline at end of file +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/Enums.h b/Trenser.Zenvy/Trenser.Zenvy/utilities/Enums.h index 6f939e4..1bef70f 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/Enums.h +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/Enums.h @@ -10,19 +10,19 @@ namespace Enums { - enum class AccountStatus + enum class AccountStatus { ACTIVE, INACTIVE }; - enum class TeamStatus + enum class TeamStatus { IN_TEAM, NOT_IN_TEAM }; - enum class CandidateStatus + enum class CandidateStatus { PENDING, SHORTLISTED, @@ -116,6 +116,14 @@ namespace Enums { INVALID }; + /* + * Function: getAccountStatusString + * Description: Converts AccountStatus enum value to string. + * Parameters: + * status - account status enum + * Returns: + * std::string - string representation of status + */ inline std::string getAccountStatusString(AccountStatus status) { switch (status) @@ -129,6 +137,14 @@ namespace Enums { } } + /* + * Function: getEmployeeTypeString + * Description: Converts EmployeeType enum value to string. + * Parameters: + * type - employee type enum + * Returns: + * std::string - string representation of employee type + */ inline std::string getEmployeeTypeString(EmployeeType type) { switch (type) @@ -154,6 +170,14 @@ namespace Enums { } } + /* + * Function: getTeamStatusString + * Description: Converts TeamStatus enum value to string. + * Parameters: + * status - team status enum + * Returns: + * std::string - string representation of team status + */ inline std::string getTeamStatusString(TeamStatus status) { switch (status) @@ -167,6 +191,14 @@ namespace Enums { } } + /* + * Function: getEmployeeDesignationString + * Description: Converts EmployeeDesignation enum value to string. + * Parameters: + * designation - employee designation enum + * Returns: + * std::string - string representation of designation + */ inline std::string getEmployeeDesignationString(EmployeeDesignation designation) { switch (designation) @@ -184,9 +216,17 @@ namespace Enums { } } - inline std::string getCandidateStatusString(CandidateStatus status) + /* + * Function: getCandidateStatusString + * Description: Converts CandidateStatus enum value to string. + * Parameters: + * status - candidate status enum + * Returns: + * std::string - string representation of candidate status + */ + inline std::string getCandidateStatusString(CandidateStatus status) { - switch (status) + switch (status) { case CandidateStatus::PENDING: return "Pending"; case CandidateStatus::SHORTLISTED: return "Shortlisted"; @@ -195,41 +235,57 @@ namespace Enums { } } + /* + * Function: getMonthString + * Description: Converts Month enum value to month name. + * Parameters: + * month - month enum + * Returns: + * std::string - month name + */ inline std::string getMonthString(Month month) { switch (month) { - case Month::JANUARY : + case Month::JANUARY: return "January"; - case Month::FEBRUARY: + case Month::FEBRUARY: return "February"; - case Month::MARCH: + case Month::MARCH: return "March"; - case Month::APRIL: + case Month::APRIL: return "April"; - case Month::MAY: + case Month::MAY: return "May"; - case Month::JUNE: + case Month::JUNE: return "June"; - case Month::JULY: + case Month::JULY: return "July"; - case Month::AUGUST: + case Month::AUGUST: return "August"; - case Month::SEPTEMBER: + case Month::SEPTEMBER: return "September"; - case Month::OCTOBER: + case Month::OCTOBER: return "October"; - case Month::NOVEMBER: + case Month::NOVEMBER: return "November"; - case Month::DECEMBER: + case Month::DECEMBER: return "December"; - case Month::INVALID: + case Month::INVALID: return "Invalid Month"; - default: + default: return "Unknown"; } } + /* + * Function: getAccountStatus + * Description: Converts string to AccountStatus enum. + * Parameters: + * input - string representation of account status + * Returns: + * AccountStatus - enum value + */ inline AccountStatus getAccountStatus(const std::string& input) { if (input == "ACTIVE") @@ -243,6 +299,14 @@ namespace Enums { return AccountStatus::INACTIVE; } + /* + * Function: getEmployeeType + * Description: Converts string to EmployeeType enum. + * Parameters: + * input - string representation of employee type + * Returns: + * EmployeeType - enum value + */ inline EmployeeType getEmployeeType(const std::string& input) { if (input == "GENERAL") @@ -276,6 +340,14 @@ namespace Enums { return EmployeeType::INVALID; } + /* + * Function: getTeamStatus + * Description: Converts string to TeamStatus enum. + * Parameters: + * str - string representation of team status + * Returns: + * TeamStatus - enum value + */ inline TeamStatus getTeamStatus(const std::string& str) { if (str == "IN_TEAM") @@ -289,6 +361,14 @@ namespace Enums { return TeamStatus::NOT_IN_TEAM; } + /* + * Function: getEmployeeDesignation + * Description: Converts string to EmployeeDesignation enum. + * Parameters: + * input - string representation of designation + * Returns: + * EmployeeDesignation - enum value + */ inline EmployeeDesignation getEmployeeDesignation(const std::string& input) { if (input == "JUNIOR") @@ -305,39 +385,46 @@ namespace Enums { } return EmployeeDesignation::INVALID; } - + + /* + * Function: getMonth + * Description: Converts integer to Month enum. + * Parameters: + * inputMonth - month number (1–12) + * Returns: + * Month - enum value + */ inline Month getMonth(const int inputMonth) { switch (inputMonth) { - case 1: + case 1: return Month::JANUARY; - case 2: + case 2: return Month::FEBRUARY; - case 3: + case 3: return Month::MARCH; - case 4: + case 4: return Month::APRIL; - case 5: + case 5: return Month::MAY; - case 6: + case 6: return Month::JUNE; - case 7: + case 7: return Month::JULY; - case 8: + case 8: return Month::AUGUST; - case 9: + case 9: return Month::SEPTEMBER; - case 10: + case 10: return Month::OCTOBER; - case 11: + case 11: return Month::NOVEMBER; - case 12: + case 12: return Month::DECEMBER; - default: + default: return Month::INVALID; } } -} - +} \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/InputHelper.h b/Trenser.Zenvy/Trenser.Zenvy/utilities/InputHelper.h index 245ea34..eb23b24 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/InputHelper.h +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/InputHelper.h @@ -4,7 +4,6 @@ * Author: Smitha * Created: 08-Apr-2026 */ - #pragma once #include #include @@ -21,7 +20,6 @@ namespace util * Returns: * void - throws runtime_error if input is invalid */ - template inline void read(T& value) { @@ -41,7 +39,6 @@ namespace util * Returns: * void - no return value */ - inline void read(std::string& value) { std::getline(std::cin >> std::ws, value); @@ -53,7 +50,6 @@ namespace util * Parameters: None * Returns: void - no return value */ - inline void pressEnter() { std::cout << std::endl; diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/OutputHelper.cpp b/Trenser.Zenvy/Trenser.Zenvy/utilities/OutputHelper.cpp index ce37ac4..e113f4f 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/OutputHelper.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/OutputHelper.cpp @@ -4,7 +4,6 @@ * Author: Trenser * Created: 01-04-2026 */ - #include "outputHelper.h" /* @@ -14,7 +13,6 @@ * Returns: * void - no return value */ - void util::clear() { std::cout << "\x1B[2J\x1B[H" << std::flush; diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/OutputHelper.h b/Trenser.Zenvy/Trenser.Zenvy/utilities/OutputHelper.h index 08a5b5f..0c17c57 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/OutputHelper.h +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/OutputHelper.h @@ -4,7 +4,6 @@ * Author: Trenser * Created: 01-04-2026 */ - #pragma once #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/StringHelper.cpp b/Trenser.Zenvy/Trenser.Zenvy/utilities/StringHelper.cpp index 00af011..2f32a39 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/StringHelper.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/StringHelper.cpp @@ -1,6 +1,20 @@ +/* + * File: StringHelper.cpp + * Description: Provides functions to help with string manipulation. + * Author: Trenser + * Created: 10-04-2026 +*/ #include "StringHelper.h" #include +/* + * Function: extractNumber + * Description: Extracts and returns the numeric value formed by digits in the input string. + * Parameters: + * input - string containing numeric and non-numeric characters + * Returns: + * int - number extracted from the input string + */ int util::extractNumber(const std::string& input) { int result = 0; @@ -12,4 +26,4 @@ int util::extractNumber(const std::string& input) } } return result; -} +} \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/StringHelper.h b/Trenser.Zenvy/Trenser.Zenvy/utilities/StringHelper.h index 12df49a..cc6e74a 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/StringHelper.h +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/StringHelper.h @@ -1,3 +1,9 @@ +/* + * File: StringHelper.h + * Description: Provides functions to help with string manipulation. + * Author: Trenser + * Created: 10-04-2026 +*/ #pragma once #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/Timestamp.cpp b/Trenser.Zenvy/Trenser.Zenvy/utilities/Timestamp.cpp index 6172503..ba581db 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/Timestamp.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/Timestamp.cpp @@ -6,21 +6,19 @@ * Author: Trenser * Created: 01-Apr-2026 */ - #include #include #include #include "Timestamp.h" -/* -* Function: Timestamp -* Description: Default constructor that initializes the timestamp to the current system time. -* Parameters: -* None -* Returns: -* Timestamp object -*/ - + /* + * Function: Timestamp + * Description: Default constructor that initializes the timestamp to the current system time. + * Parameters: + * None + * Returns: + * Timestamp object + */ util::Timestamp::Timestamp() { m_time = std::time(nullptr); @@ -34,7 +32,6 @@ util::Timestamp::Timestamp() * Returns: * Timestamp object */ - util::Timestamp::Timestamp(std::time_t timeValue) { m_time = timeValue; @@ -50,7 +47,6 @@ util::Timestamp::Timestamp(std::time_t timeValue) * Throws: * runtime_error if the string format is invalid */ - util::Timestamp util::Timestamp::fromString(const std::string& timeString) { std::tm timeStruct = {}; @@ -72,7 +68,6 @@ util::Timestamp util::Timestamp::fromString(const std::string& timeString) * Returns: * string - formatted as "YYYY-MM-DD HH:MM:SS" */ - std::string util::Timestamp::toString() const { std::tm timeStruct = {}; @@ -91,7 +86,6 @@ std::string util::Timestamp::toString() const * Returns: * double - duration in seconds */ - double util::Timestamp::getDurationInSeconds(const Timestamp& startTimestamp, const Timestamp& endTimestamp) { return std::difftime(endTimestamp.m_time, startTimestamp.m_time); @@ -105,7 +99,6 @@ double util::Timestamp::getDurationInSeconds(const Timestamp& startTimestamp, co * Returns: * int - date as YYYYMMDD */ - int util::Timestamp::getDateAsInt() const { std::tm timeStruct{}; @@ -116,6 +109,14 @@ int util::Timestamp::getDateAsInt() const return year * 10000 + month * 100 + day; } +/* +* Function: getMonth +* Description: Extracts the month value from the timestamp. +* Parameters: +* None +* Returns: +* int - month value (1 to 12) +*/ int util::Timestamp::getMonth() const { std::tm timeStruct{}; @@ -123,6 +124,14 @@ int util::Timestamp::getMonth() const return timeStruct.tm_mon + 1; } +/* +* Function: getYear +* Description: Extracts the year value from the timestamp. +* Parameters: +* None +* Returns: +* int - year value +*/ int util::Timestamp::getYear() const { std::tm timeStruct{}; @@ -130,6 +139,14 @@ int util::Timestamp::getYear() const return timeStruct.tm_year + 1900; } +/* +* Function: getDay +* Description: Extracts the day value from the timestamp. +* Parameters: +* None +* Returns: +* int - day of the month +*/ int util::Timestamp::getDay() const { std::tm timeStruct{}; @@ -146,7 +163,6 @@ int util::Timestamp::getDay() const * Returns: * double - duration in minutes */ - double util::Timestamp::getDurationInMinutes(const Timestamp& startTimestamp, const Timestamp& endTimestamp) { return getDurationInSeconds(startTimestamp, endTimestamp) / 60.0; @@ -161,7 +177,6 @@ double util::Timestamp::getDurationInMinutes(const Timestamp& startTimestamp, co * Returns: * double - duration in hours */ - double util::Timestamp::getDurationInHours(const Timestamp& startTimestamp, const Timestamp& endTimestamp) { return getDurationInSeconds(startTimestamp, endTimestamp) / 3600.0; @@ -175,7 +190,6 @@ double util::Timestamp::getDurationInHours(const Timestamp& startTimestamp, cons * Returns: * bool - true if current timestamp is earlier */ - bool util::Timestamp::operator<(const Timestamp& other) const { return m_time < other.m_time; @@ -189,7 +203,6 @@ bool util::Timestamp::operator<(const Timestamp& other) const * Returns: * bool - true if current timestamp is later */ - bool util::Timestamp::operator>(const Timestamp& other) const { return m_time > other.m_time; @@ -203,7 +216,6 @@ bool util::Timestamp::operator>(const Timestamp& other) const * Returns: * bool - true if current timestamp is earlier or equal */ - bool util::Timestamp::operator<=(const Timestamp& other) const { return m_time <= other.m_time; @@ -217,7 +229,6 @@ bool util::Timestamp::operator<=(const Timestamp& other) const * Returns: * bool - true if current timestamp is later or equal */ - bool util::Timestamp::operator>=(const Timestamp& other) const { return m_time >= other.m_time; @@ -231,8 +242,7 @@ bool util::Timestamp::operator>=(const Timestamp& other) const * Returns: * bool - true if both timestamps are equal */ - bool util::Timestamp::operator==(const Timestamp& other) const { return m_time == other.m_time; -} +} \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/Timestamp.h b/Trenser.Zenvy/Trenser.Zenvy/utilities/Timestamp.h index b55b7a8..56a6a0b 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/Timestamp.h +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/Timestamp.h @@ -6,7 +6,6 @@ * Author: Trenser * Created: 01-Apr-2026 */ - #pragma once #include #include diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.cpp b/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.cpp index f06a860..5b1631c 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/Validator.cpp @@ -11,15 +11,14 @@ #include "Employee.h" #include "ApplicationConfig.h" - /* - * Function: isPhoneNumberValid - * Description: Validates whether the given string is a valid phone number. - * Parameters: - * phoneNumber - string containing the phone number to validate - * Returns: - * bool - true if the phone number is valid (10 digits, all numeric), false otherwise - */ - +/* + * Function: isPhoneNumberValid + * Description: Validates whether the given string is a valid phone number. + * Parameters: + * phoneNumber - string containing the phone number to validate + * Returns: + * bool - true if the phone number is valid (10 digits, all numeric), false otherwise + */ bool util::isPhoneNumberValid(const std::string& phoneNumber) { if (phoneNumber.size() != 10) { @@ -41,7 +40,6 @@ bool util::isPhoneNumberValid(const std::string& phoneNumber) { * Returns: * bool - true if the email contains exactly one '@' character and is not at the start or end, false otherwise */ - bool util::isEmailValid(const std::string& email) { size_t index = email.find('@'); if (index == std::string::npos) @@ -72,7 +70,6 @@ bool util::isEmailValid(const std::string& email) { * - Must contain at least one uppercase letter, one lowercase letter, one digit, and one special character * - Must not contain whitespace */ - bool util::isPasswordValid(const std::string& password) { if (password == Config::Authentication::DEFAULT_PASSWORD) @@ -112,7 +109,16 @@ bool util::isPasswordValid(const std::string& password) return hasUpper && hasLower && hasDigit && hasSpecial; } -bool util::hasActiveEmployeeOfType(Enums::EmployeeType employeeType, const std::map & employees) +/* + * Function: hasActiveEmployeeOfType + * Description: Checks whether there is any active employee of the given employee type. + * Parameters: + * employeeType - the type of employee to check against + * employees - map of employee ID to Employee* objects + * Returns: + * bool - true if an active employee of the given type exists, otherwise false + */ +bool util::hasActiveEmployeeOfType(Enums::EmployeeType employeeType, const std::map& employees) { for (const auto& employeePair : employees) { @@ -125,6 +131,15 @@ bool util::hasActiveEmployeeOfType(Enums::EmployeeType employeeType, const std:: return false; } +/* + * Function: isEmailDuplicate + * Description: Checks if an email already exists among the given employees. + * Parameters: + * email - the email address to check + * employees - map of employee ID to Employee* objects + * Returns: + * bool - true if a duplicate email is found, otherwise false + */ bool util::isEmailDuplicate(const std::string& email, const std::map& employees) { for (const auto& employeePair : employees) @@ -138,6 +153,15 @@ bool util::isEmailDuplicate(const std::string& email, const std::map& employees) { for (const auto& employeePair : employees) @@ -151,6 +175,15 @@ bool util::isPhoneDuplicate(const std::string& phone, const std::map& employees) { for (const auto& employee : employees) From 6496fcbc857c4a6ee678057c536bc7a0aef74dde Mon Sep 17 00:00:00 2001 From: Princy Jerin Date: Fri, 17 Apr 2026 10:32:12 +0530 Subject: [PATCH 17/19] Add function headers to models --- Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp | 1 - .../Trenser.Zenvy/models/Payroll.cpp | 28 +++++++++++++++---- Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h | 2 +- .../Trenser.Zenvy/models/Payslip.cpp | 28 +++++++++++++++---- Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h | 2 +- Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp | 8 ++++++ .../Trenser.Zenvy/models/TalentExecutive.h | 3 +- .../Trenser.Zenvy/models/TeamExecutive.h | 3 +- 8 files changed, 56 insertions(+), 19 deletions(-) diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp index 15ff4ce..579b908 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Log.cpp @@ -6,7 +6,6 @@ File: Log.cpp */ #include "Log.h" -//Getters and setters const util::Timestamp& Log::getTimestamp() const { return m_timestamp; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp index d5afbdb..ba958ce 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.cpp @@ -73,6 +73,11 @@ double Payroll::getEmployerPFContribution() const return m_employerPFContribution; } +std::string Payroll::getHeaders() +{ + return "PayrollId,EmployeeId,BasicSalary,HouseRentAllowance,FoodAllowance,EmployeePFContribution,EmployerPFContribution"; +} + void Payroll::setBasicSalary(double basicSalary) { m_basicSalary = basicSalary; @@ -98,6 +103,14 @@ void Payroll::setEmployerPFContribution(double value) m_employerPFContribution = value; } +/* +Function: serialize +Description: Converts the payroll object into a comma-separated string. +Parameters: + None +Returns: + A serialized string representation of the payroll. +*/ std::string Payroll::serialize() const { std::ostringstream serializedPayroll; @@ -111,6 +124,14 @@ std::string Payroll::serialize() const return serializedPayroll.str(); } +/* +Function: deserialize +Description: Creates a Payroll object from a serialized comma-separated string. +Parameters: + record - Serialized payroll data. +Returns: + Pointer to a Payroll object. +*/ Payroll* Payroll::deserialize(const std::string& record) { std::string id, employeeId; @@ -144,9 +165,4 @@ Payroll* Payroll::deserialize(const std::string& record) { throw std::runtime_error("Failed to deserialize Payroll object"); } -} - -std::string Payroll::getHeaders() -{ - return "PayrollId,EmployeeId,BasicSalary,HouseRentAllowance,FoodAllowance,EmployeePFContribution,EmployerPFContribution"; -} +} \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h index ebf13ed..7b4699b 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payroll.h @@ -54,6 +54,7 @@ public: double getFoodAllowance() const; double getEmployeePFContribution() const; double getEmployerPFContribution() const; + static std::string getHeaders(); void setBasicSalary(double); void setHouseRentAllowance(double); void setFoodAllowance(double); @@ -61,5 +62,4 @@ public: void setEmployerPFContribution(double); std::string serialize() const; static Payroll* deserialize(const std::string&); - static std::string getHeaders(); }; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp index e0198f2..1f4f705 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.cpp @@ -57,6 +57,19 @@ const std::string& Payslip::getEmployeeId() const return m_employeeId; } +std::string Payslip::getHeaders() +{ + return "PayslipId,EmployeeId,Salary,Timestamp"; +} + +/* +Function: serialize +Description: Converts the payslip object into a comma-separated string. +Parameters: + None +Returns: + A serialized string representation of the payslip. +*/ std::string Payslip::serialize() const { std::ostringstream serializedPayslip; @@ -67,6 +80,14 @@ std::string Payslip::serialize() const return serializedPayslip.str(); } +/* +Function: deserialize +Description: Creates a Payslip object from a serialized comma-separated string. +Parameters: + record - Serialized payslip data. +Returns: + Pointer to a Payslip object. +*/ Payslip* Payslip::deserialize(const std::string& record) { std::string id, employeeId, timestampString; @@ -92,9 +113,4 @@ Payslip* Payslip::deserialize(const std::string& record) { throw std::runtime_error("Failed to deserialize Payslip object"); } -} - -std::string Payslip::getHeaders() -{ - return "PayslipId,EmployeeId,Salary,Timestamp"; -} +} \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h b/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h index e5e617f..108b9c5 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Payslip.h @@ -25,11 +25,11 @@ public: util::Timestamp timestamp); const std::string& getId() const; double getSalary() const; + static std::string getHeaders(); void setPayslipId(const std::string& id); void setSalary(double salary); const util::Timestamp& getTimestamp() const; const std::string& getEmployeeId() const; std::string serialize() const; static Payslip* deserialize(const std::string&); - static std::string getHeaders(); }; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp index b760a32..6c1df34 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Room.cpp @@ -33,6 +33,14 @@ void Room::setRoomName(const std::string& name) m_name = name; } +/* +Function: addBooking +Description: Adds a valid booking to the room’s booking list using the booking ID as the key. +Parameters: + booking - A pointer to a Booking object to be added to the room. +Returns: + void +*/ void Room::addBooking(Booking* booking) { if (booking) diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h b/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h index 06b31a4..9ddde43 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/TalentExecutive.h @@ -36,5 +36,4 @@ public: accountStatus) { } ~TalentExecutive() = default; -}; - +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h b/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h index 84e1b3f..b550be3 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/TeamExecutive.h @@ -35,5 +35,4 @@ public: Enums::EmployeeType::TEAM, accountStatus) {} ~TeamExecutive() = default; -}; - +}; \ No newline at end of file From 7d75f978323a860cf513149722e2f135ddc48830 Mon Sep 17 00:00:00 2001 From: Ajmal Jalaludeen Date: Fri, 17 Apr 2026 12:00:35 +0530 Subject: [PATCH 18/19] Add function headers to Service Layers --- .../AuthenticationManagementService.h | 2 +- .../services/EmployeeManagementService.cpp | 118 +++++++++++++++--- .../services/EmployeeManagementService.h | 17 +++ .../Trenser.Zenvy/services/LogService.cpp | 11 +- .../Trenser.Zenvy/services/LogService.h | 2 +- .../services/PayslipManagementService.cpp | 69 +++++++++- .../utilities/AuthorizationHelper.h | 38 +++++- 7 files changed, 238 insertions(+), 19 deletions(-) diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.h index b7a5768..b4669d4 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/AuthenticationManagementService.h @@ -24,4 +24,4 @@ public: AuthenticationDTO login(const std::string& username, const std::string& password); void logout(); void changePassword(const std::string&); -}; +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.cpp index f0c9045..c5751bf 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.cpp @@ -1,3 +1,11 @@ +/* + * File: EmployeeManagementService.h + * Description: Provides services for managing employees, including creation, deactivation, + * designation updates, profile modifications, searching, and retrieval of + * shortlisted candidates. + * Author: Trenser + * Created: 07-Apr-2026 + */ #include #include #include @@ -15,6 +23,19 @@ #include "FileManager.h" #include "ApplicationConfig.h" + /* + * Function: createEmployee + * Description: Creates a new employee of the specified type and designation, validates + * email and phone, enforces authorization, and associates payroll. + * Parameters: + * employeeType - type of employee (HR, IT, Finance, Team, Talent Acquisition, General) + * employeeDesignation - designation for general employees (Junior, Senior) + * email - employee email address + * name - employee name + * phone - employee phone number + * Returns: + * None + */ void EmployeeManagementService::createEmployee(Enums::EmployeeType employeeType, Enums::EmployeeDesignation employeeDesignation, const std::string& email, const std::string& name, const std::string& phone) { auto& employees = m_dataStore.getEmployees(); @@ -113,6 +134,16 @@ void EmployeeManagementService::createEmployee(Enums::EmployeeType employeeType, m_dataStore.getPayrolls().emplace(std::make_pair(payroll->getId(), payroll)); m_dataStore.getEmployees().emplace(std::make_pair(employee->getId(), employee)); } + +/* + * Function: deactivateEmployee + * Description: Deactivates an employee account by setting its status to INACTIVE. + * Prevents deactivation of Admin accounts. + * Parameters: + * id - unique identifier of the employee + * Returns: + * bool - true if deactivation succeeded, false otherwise + */ bool EmployeeManagementService::deactivateEmployee(const std::string& id) { auto& authenticatedEmployee = m_dataStore.getAuthenticatedEmployee(); @@ -131,6 +162,15 @@ bool EmployeeManagementService::deactivateEmployee(const std::string& id) return true; } + /* + * Function: updateDesignation + * Description: Updates the designation of a general employee. + * Parameters: + * id - unique identifier of the employee + * designation - new designation to assign + * Returns: + * bool - true if update succeeded, false otherwise + */ bool EmployeeManagementService::updateDesignation(const std::string& id, Enums::EmployeeDesignation designation) { auto& authenticatedEmployee = m_dataStore.getAuthenticatedEmployee(); @@ -149,11 +189,28 @@ bool EmployeeManagementService::updateDesignation(const std::string& id, Enums:: return true; } +/* + * Function: getCurrentEmployee + * Description: Retrieves the currently authenticated employee from the DataStore. + * Parameters: + * None + * Returns: + * const Employee* - pointer to the current employee + */ const Employee* EmployeeManagementService::getCurrentEmployee() { return m_dataStore.getAuthenticatedEmployee(); } +/* + * Function: updateProfile + * Description: Updates the name and phone number of the currently authenticated employee. + * Parameters: + * name - new employee name + * phone - new employee phone number + * Returns: + * None + */ void EmployeeManagementService::updateProfile(const std::string& name,const std::string& phone) { Employee* employee = m_dataStore.getAuthenticatedEmployee(); @@ -161,6 +218,15 @@ void EmployeeManagementService::updateProfile(const std::string& name,const std: employee->setEmployeePhone(phone); } +/* + * Function: searchEmployee + * Description: Searches employees by name and returns matches along + * with the type of the current authenticated employee. + * Parameters: + * name - search string for employee name + * Returns: + * pair> - current user type and matching employees + */ std::pair> EmployeeManagementService::searchEmployee(const std::string& name) { Employee* currentUser = m_dataStore.getAuthenticatedEmployee(); @@ -189,6 +255,36 @@ std::pair> EmployeeManagementS return { employeeType, employeeList }; } +/* + * Function: getShorlistedCandidates + * Description: Retrieves candidates with status SHORTLISTED from the DataStore. + * Parameters: + * None + * Returns: + * vector - list of shortlisted candidates + */ +std::vector EmployeeManagementService::getShorlistedCandidates() +{ + candidateMap candidates = m_dataStore.getCandidates(); + std::vector shortlistedCandidates; + for (auto& candidate : candidates) + { + if (candidate.second->getCandidateStatus() == Enums::CandidateStatus::SHORTLISTED) + { + shortlistedCandidates.push_back(candidate.second); + } + } + return shortlistedCandidates; +} + +/* + * Function: loadEmployees + * Description: Loads employees and general employees from FileManager into the DataStore. + * Parameters: + * None + * Returns: + * None + */ void EmployeeManagementService::loadEmployees() { FileManager employeeFileManager(Config::File::EMPLOYEES_FILE); @@ -214,6 +310,14 @@ void EmployeeManagementService::loadEmployees() } } +/* + * Function: saveEmployees + * Description: Saves employees and general employees from the DataStore into FileManager. + * Parameters: + * None + * Returns: + * None + */ void EmployeeManagementService::saveEmployees() { FileManager employeeFileManager(Config::File::EMPLOYEES_FILE); @@ -234,18 +338,4 @@ void EmployeeManagementService::saveEmployees() } employeeFileManager.save(employees); generalEmployeeFileManager.save(generalEmployees); -} - -std::vector EmployeeManagementService::getShorlistedCandidates() -{ - candidateMap candidates = m_dataStore.getCandidates(); - std::vector shortlistedCandidates; - for (auto& candidate : candidates) - { - if (candidate.second->getCandidateStatus() == Enums::CandidateStatus::SHORTLISTED) - { - shortlistedCandidates.push_back(candidate.second); - } - } - return shortlistedCandidates; } \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.h b/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.h index d8ea1bc..b819a8b 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/EmployeeManagementService.h @@ -1,3 +1,11 @@ +/* + * File: EmployeeManagementService.h + * Description: Provides services for managing employees, including creation, deactivation, + * designation updates, profile modifications, searching, and retrieval of + * shortlisted candidates. + * Author: Trenser + * Created: 07-Apr-2026 + */ #pragma once #include #include @@ -25,6 +33,15 @@ public: void loadEmployees(); void saveEmployees(); + /* + * Function: getEmployees (template) + * Description: Retrieves active employees filtered by specified types. Excludes admin employees + * if no filter is provided. + * Parameters: + * types... - variadic list of employee types + * Returns: + * Employees - vector of pointers to filtered employees + */ template Employees getEmployees(Types... types) { diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/LogService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/LogService.cpp index 535fb0b..1f68ffe 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/LogService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/LogService.cpp @@ -9,10 +9,19 @@ #include "Factory.h" #include "DataStore.h" + /* + * Function: log + * Description: Creates a new log entry with the given message, assigns a timestamp, + * and stores it in the DataStore. + * Parameters: + * message - string containing the log message to be recorded + * Returns: + * void - no return value + */ void LogService::log(const std::string& message) { DataStore& dataStore = DataStore::getInstance(); logMap& logs = dataStore.getLogs(); Log* log = Factory::getObject(message); logs.emplace(std::make_pair(log->getTimestamp(), log)); -} +} \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/LogService.h b/Trenser.Zenvy/Trenser.Zenvy/services/LogService.h index 93ff404..416d4ba 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/LogService.h +++ b/Trenser.Zenvy/Trenser.Zenvy/services/LogService.h @@ -11,4 +11,4 @@ class LogService { public: static void log(const std::string&); -}; +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.cpp b/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.cpp index 313a35d..685d487 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/services/PayslipManagementService.cpp @@ -13,6 +13,20 @@ #include "FileManager.h" #include "Factory.h" + /* + * Function: updateSalary + * Description: Updates the payroll details of a given employee, including salary components + * and PF contributions. + * Parameters: + * employeeId - unique identifier of the employee + * basicSalary - basic salary of the employee + * houseRentAllowance - HRA component + * foodAllowance - food allowance component + * employeePFContribution - employee PF contribution + * employerPFContribution - employer PF contribution + * Returns: + * void - throws runtime_error if employee not found or unauthorized + */ void PayslipManagementService::updateSalary(const std::string& employeeId, double basicSalary, double houseRentAllowance, double foodAllowance, double employeePFContribution, double employerPFContribution) { util::enforceAuthorization(m_dataStore.getAuthenticatedEmployee()->getEmployeeType(), Enums::EmployeeType::FINANCE); @@ -32,6 +46,14 @@ void PayslipManagementService::updateSalary(const std::string& employeeId, doubl } } + /* + * Function: generatePayslips + * Description: Generates payslips for all employees for the current month and year. + * Parameters: + * None + * Returns: + * void - creates and stores payslips in DataStore + */ void PayslipManagementService::generatePayslips() { util::enforceAuthorization(m_dataStore.getAuthenticatedEmployee()->getEmployeeType(), Enums::EmployeeType::FINANCE); @@ -68,6 +90,15 @@ void PayslipManagementService::generatePayslips() } } + /* + * Function: loadPayrolls + * Description: Loads payroll objects from persistent storage and associates them + * with existing employees. + * Parameters: + * None + * Returns: + * void - updates DataStore with loaded payrolls + */ void PayslipManagementService::loadPayrolls() { FileManager payrollFileManager(Config::File::PAYROLL_FILE); @@ -86,6 +117,14 @@ void PayslipManagementService::loadPayrolls() payrolls.insert(payrollObjects.begin(), payrollObjects.end()); } + /* + * Function: savePayrolls + * Description: Saves all payroll objects from DataStore into persistent storage. + * Parameters: + * None + * Returns: + * None + */ void PayslipManagementService::savePayrolls() { FileManager payrollFileManager(Config::File::PAYROLL_FILE); @@ -93,6 +132,17 @@ void PayslipManagementService::savePayrolls() payrollFileManager.save(payrolls); } + /* + * Function: getPayslipForMonth + * Description: Retrieves the payroll and payslip of a given employee for a specific + * month and year. + * Parameters: + * employeeId - unique identifier of the employee + * year - year of the payslip + * month - month of the payslip + * Returns: + * pair - payroll and payslip for the given month. + */ std::pair PayslipManagementService::getPayslipForMonth(const std::string& employeeId, int year, int month) { auto& employees = m_dataStore.getEmployees(); @@ -116,6 +166,15 @@ std::pair PayslipManagementService::getPayslipForMonth(const return { nullptr, nullptr }; } + /* + * Function: loadPayslips + * Description: Loads payslip objects from FileManager and associates them + * with existing employees. + * Parameters: + * None + * Returns: + * void - updates DataStore with loaded payslips + */ void PayslipManagementService::loadPayslips() { FileManager payslipFileManager(Config::File::PAYSLIP_FILE); @@ -134,9 +193,17 @@ void PayslipManagementService::loadPayslips() payslips.insert(payslipObjects.begin(), payslipObjects.end()); } + /* + * Function: savePayslips + * Description: Saves all payslip objects from DataStore into FileManager. + * Parameters: + * None + * Returns: + * void + */ void PayslipManagementService::savePayslips() { FileManager payslipFileManager(Config::File::PAYSLIP_FILE); auto& payslips = m_dataStore.getPayslips(); payslipFileManager.save(payslips); -} +} \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/utilities/AuthorizationHelper.h b/Trenser.Zenvy/Trenser.Zenvy/utilities/AuthorizationHelper.h index e9c4d4b..9f5690f 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/utilities/AuthorizationHelper.h +++ b/Trenser.Zenvy/Trenser.Zenvy/utilities/AuthorizationHelper.h @@ -1,14 +1,40 @@ +/* + * File: AuthorizationHelper.h + * Description : Provides utility functions to check and enforce authorization + * based on allowed employee types. + * Author : Trenser + * Created : 07-Apr-2026 + */ #pragma once #include #include "Enums.h" namespace util { + /* + * Function: isAuthorized + * Description: Checks if the current employee type matches the specified allowed type. + * Parameters: + * current - the employee type of the current user + * first - the allowed employee type to compare against + * Returns: + * bool - true if current matches the allowed type, false otherwise + */ inline bool isAuthorized(Enums::EmployeeType current, Enums::EmployeeType first) { return current == first; } + /* + * Function: isAuthorized + * Description: Checks if the current employee type matches any of the specified allowed types. + * Parameters: + * current - the employee type of the current user + * first - the first allowed employee type + * rest - additional allowed employee types + * Returns: + * bool - true if current matches any of the allowed types, false otherwise + */ template inline bool isAuthorized(Enums::EmployeeType current, Enums::EmployeeType first, Rest... rest) @@ -20,6 +46,16 @@ namespace util return isAuthorized(current, rest...); } + /* + * Function: enforceAuthorization + * Description: Enforces authorization by checking if the current employee type + * is among the allowed types. + * Parameters: + * current - the employee type of the current user + * alloweds - one or more allowed employee types + * Returns: + * void - throws runtime_error if current is not authorized + */ template inline void enforceAuthorization(Enums::EmployeeType current, Allowed... allowed) { @@ -28,4 +64,4 @@ namespace util throw std::runtime_error("You are unauthorized to perform this operation!"); } } -} +} \ No newline at end of file From 8fd0366a3505f9f08c1ba50c9878478da3c7b2b9 Mon Sep 17 00:00:00 2001 From: Jissin Sam Mathew Date: Fri, 17 Apr 2026 12:19:24 +0530 Subject: [PATCH 19/19] Add headers to the views and remove Leave static members --- Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp | 30 --------- Trenser.Zenvy/Trenser.Zenvy/models/Leave.h | 9 --- .../Trenser.Zenvy/views/AdminMenu.cpp | 2 +- Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h | 3 +- .../Trenser.Zenvy/views/EmployeeMenu.cpp | 4 +- .../Trenser.Zenvy/views/EmployeeMenu.h | 3 +- .../views/FinanceExecutiveMenu.cpp | 4 +- .../views/FinanceExecutiveMenu.h | 3 +- .../Trenser.Zenvy/views/HRManagerMenu.cpp | 4 +- .../Trenser.Zenvy/views/HRManagerMenu.h | 3 +- .../Trenser.Zenvy/views/ITExecutiveMenu.cpp | 4 +- .../Trenser.Zenvy/views/ITExecutiveMenu.h | 3 +- .../Trenser.Zenvy/views/MenuHelper.cpp | 53 ++++++++++++++- .../Trenser.Zenvy/views/MenuHelper.h | 65 +++++++++++++++++++ .../views/TalentExecutiveMenu.cpp | 2 +- .../Trenser.Zenvy/views/TalentExecutiveMenu.h | 3 +- .../Trenser.Zenvy/views/TeamExecutiveMenu.cpp | 2 +- .../Trenser.Zenvy/views/TeamExecutiveMenu.h | 3 +- .../Trenser.Zenvy/views/TeamLeadMenu.cpp | 2 +- .../Trenser.Zenvy/views/TeamLeadMenu.h | 3 +- 20 files changed, 137 insertions(+), 68 deletions(-) diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp b/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp index e33e319..c3f8a2d 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Leave.cpp @@ -28,21 +28,6 @@ const std::string& Leave::getLeaveReason() const return m_reason; } -int Leave::getNumberOfGeneralLeave() -{ - return m_numberOfGeneralLeave; -} - -int Leave::getNumberOfRestrictedLeave() -{ - return m_numberOfRestrictedLeave; -} - -int Leave::getNumberOfMedicalLeave() -{ - return m_numberOfMedicalLeave; -} - Enums::LeaveType Leave::getLeaveType() const { return m_leaveType; @@ -68,21 +53,6 @@ void Leave::setLeaveReason(const std::string& reason) m_reason = reason; } -void Leave::setNumberOfGeneralLeave(int value) -{ - m_numberOfGeneralLeave = value; -} - -void Leave::setNumberOfRestrictedLeave(int value) -{ - m_numberOfRestrictedLeave = value; -} - -void Leave::setNumberOfMedicalLeave(int value) -{ - m_numberOfMedicalLeave = value; -} - void Leave::setLeaveType(Enums::LeaveType type) { m_leaveType = type; diff --git a/Trenser.Zenvy/Trenser.Zenvy/models/Leave.h b/Trenser.Zenvy/Trenser.Zenvy/models/Leave.h index 1da66ca..3bd731f 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/models/Leave.h +++ b/Trenser.Zenvy/Trenser.Zenvy/models/Leave.h @@ -17,9 +17,6 @@ private: std::string m_employeeId; util::Timestamp m_timestamp; std::string m_reason; - static int m_numberOfGeneralLeave; - static int m_numberOfRestrictedLeave; - static int m_numberOfMedicalLeave; Enums::LeaveType m_leaveType; public: Leave() : m_id("LV" + std::to_string(++m_uid)), m_employeeId(""), m_timestamp(), m_reason(""), m_leaveType(Enums::LeaveType::GENERAL) {} @@ -32,16 +29,10 @@ public: const std::string& getEmployeeId() const; const util::Timestamp& getTimestamp() const; const std::string& getLeaveReason() const; - static int getNumberOfGeneralLeave(); - static int getNumberOfRestrictedLeave(); - static int getNumberOfMedicalLeave(); Enums::LeaveType getLeaveType() const; void setLeaveId(const std::string& id); void setEmployeeId(const std::string& employeeId); void setTimestamp(const util::Timestamp& timestamp); void setLeaveReason(const std::string& reason); - void setNumberOfGeneralLeave(int value); - void setNumberOfRestrictedLeave(int value); - void setNumberOfMedicalLeave(int value); void setLeaveType(Enums::LeaveType type); }; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.cpp index 8338cd9..c8b0019 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.cpp @@ -84,4 +84,4 @@ bool AdminMenu::handleOperation(int choice) util::pressEnter(); } return true; -} +} \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h index 88ca794..39fda7c 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/AdminMenu.h @@ -15,5 +15,4 @@ public: AdminMenu() :m_zenvyController(new ZenvyController()) {}; void run(); bool handleOperation(int); -}; - +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.cpp index 33978b9..2a81bfc 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.cpp @@ -28,7 +28,7 @@ void EmployeeMenu::run() { int choice; util::clear(); - std::cout << "Employee Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. Raise Ticket\n5. View Ticket\n6. View Ticket History\n7. View Employees\n8. Search Employee\n9. View Team Members\n10. Book Meeting Room\n11. View Booking History\n12. View Notification\n13. View Announcements\n14. Update Profile\n15. View Profile\n16. Exit\nEnter your Choice: "; + std::cout << "Employee Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. Raise Ticket\n5. View Ticket\n6. View Ticket History\n7. View Employees\n8. Search Employee\n9. View Team Members\n10. Book Meeting Room\n11. View Booking History\n12. View Notifications\n13. View Announcements\n14. Update Profile\n15. View Profile\n16. Exit\nEnter your Choice: "; util::read(choice); if (!handleOperation(choice)) { @@ -81,4 +81,4 @@ bool EmployeeMenu::handleOperation(int choice) util::pressEnter(); } return true; -} +} \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.h index d29f301..579903e 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/EmployeeMenu.h @@ -15,5 +15,4 @@ public: EmployeeMenu() : m_zenvyController(new ZenvyController()) {}; void run(); bool handleOperation(int); -}; - +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.cpp index 68a5d26..b301167 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.cpp @@ -28,7 +28,7 @@ void FinanceExecutiveMenu::run() { int choice; util::clear(); - std::cout << "Finance Executive Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. View Employees\n5. Search Employee\n6. View Notification\n7. View Announcements\n8. Resolve Ticket\n9. Generate Payslips\n10. Update Payroll\n11. Update Profile\n12. View Profile \n13. Logout\nEnter your Choice: "; + std::cout << "Finance Executive Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. View Employees\n5. Search Employee\n6. View Notifications\n7. View Announcements\n8. Resolve Ticket\n9. Generate Payslips\n10. Update Payroll\n11. Update Profile\n12. View Profile \n13. Logout\nEnter your Choice: "; util::read(choice); if (!handleOperation(choice)) { @@ -119,4 +119,4 @@ bool FinanceExecutiveMenu::handleOperation(int choice) util::pressEnter(); } return true; -} +} \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.h index 038658f..69097da 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/FinanceExecutiveMenu.h @@ -21,5 +21,4 @@ public: bool handleOperation(int); void updatePayroll(); void generatePayslips(); -}; - +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.cpp index 3875de5..d72e29f 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.cpp @@ -27,7 +27,7 @@ void HRManagerMenu::run() { int choice; util::clear(); - std::cout << "HR Manager Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. View Employees\n5. Search Employee\n6. View Notification\n7. View Announcements\n8. Create Employee\n9. Regularize Attendance\n10. Update Leave Request\n11. Update Profile\n12. Deactivate Employee\n13. View Profile\n14. Update Designation\n15. Add Shortlisted Candidate as Employee\n16. Logout\nEnter your Choice: "; + std::cout << "HR Manager Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. View Employees\n5. Search Employee\n6. View Notifications\n7. View Announcements\n8. Create Employee\n9. Regularize Attendance\n10. Update Leave Request\n11. Update Profile\n12. Deactivate Employee\n13. View Profile\n14. Update Designation\n15. Add Shortlisted Candidate as Employee\n16. Logout\nEnter your Choice: "; util::read(choice); if (!handleOperation(choice)) { @@ -92,4 +92,4 @@ bool HRManagerMenu::handleOperation(int choice) util::pressEnter(); } return true; -} +} \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.h index 158deaf..b455bc9 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/HRManagerMenu.h @@ -15,5 +15,4 @@ public: HRManagerMenu() : m_zenvyController(new ZenvyController()) {}; void run(); bool handleOperation(int); -}; - +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.cpp index 6ae71ea..ec94afd 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.cpp @@ -27,7 +27,7 @@ void ITExecutiveMenu::run() { int choice; util::clear(); - std::cout << "IT Executive Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. View Employees\n5. Search Employee\n6. View Notification\n7. View Announcements\n8. Resolve Ticket\n9. Update Profile\n10. View Profile\n11. Logout\nEnter your Choice: "; + std::cout << "IT Executive Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. View Employees\n5. Search Employee\n6. View Notifications\n7. View Announcements\n8. Resolve Ticket\n9. Update Profile\n10. View Profile\n11. Logout\nEnter your Choice: "; util::read(choice); if (!handleOperation(choice)) { @@ -80,4 +80,4 @@ bool ITExecutiveMenu::handleOperation(int choice) util::pressEnter(); } return true; -} +} \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.h index e6cf86e..a1817cd 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/ITExecutiveMenu.h @@ -15,5 +15,4 @@ public: ITExecutiveMenu() : m_zenvyController(new ZenvyController()) {}; void run(); bool handleOperation(int); -}; - +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.cpp index cfcc4c4..95d10d9 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.cpp @@ -1,6 +1,22 @@ +/* + * File: MenuHelper.cpp + * Description: Inline functions and utilities for employee management, + * including profile handling, payslip viewing, search, + * and employee activation/deactivation. + * Author: Trenser + * Created: 08-Apr-2026 + */ #include #include "MenuHelper.h" +/* + * Function: getEmployeeType + * Description: Retrieves a valid employee type based on the authority of the current user + * Parameters: + * employeeType - the type of the employee requesting to create another employee + * Returns: + * Enums::EmployeeType - selected employee type or INVALID if choice is invalid + */ static Enums::EmployeeType getEmployeeType(Enums::EmployeeType employeeType) { int choice; @@ -50,6 +66,13 @@ static Enums::EmployeeType getEmployeeType(Enums::EmployeeType employeeType) return Enums::EmployeeType::INVALID; } +/* + * Function: getEmployeeDesignation + * Description: Retrieves the designation (Senior or Junior) for a new employee + * Parameters: None + * Returns: + * Enums::EmployeeDesignation - selected designation or INVALID if choice is invalid + */ static Enums::EmployeeDesignation getEmployeeDesignation() { int choice; @@ -70,6 +93,13 @@ static Enums::EmployeeDesignation getEmployeeDesignation() } } +/* + * Function: createEmployee + * Description: Creates a new employee record and adds it to the system + * Parameters: + * m_zenvyController - pointer to the ZenvyController managing employees + * Returns: void + */ void createEmployee(ZenvyController* m_zenvyController) { auto currentEmployee = m_zenvyController->getCurrentEmployee(); @@ -103,6 +133,13 @@ void createEmployee(ZenvyController* m_zenvyController) util::pressEnter(); } +/* + * Function: updateDesignation + * Description: Updates the designation of an existing employee + * Parameters: + * m_zenvyController - pointer to the ZenvyController managing employees + * Returns: void + */ void updateDesignation(ZenvyController* m_zenvyController) { std::string selectedEmployeeId = selectEmployeeId(m_zenvyController->getEmployees(Enums::EmployeeType::GENERAL)); @@ -123,6 +160,13 @@ void createEmployee(ZenvyController* m_zenvyController) } } + /* + * Function: displayCandidateDetails + * Description: Displays details of shortlisted candidates + * Parameters: + * shorlistedCandidates - vector of candidate pointers to display + * Returns: void + */ void displayCandidateDetails(const std::vector shorlistedCandidates) { util::clear(); @@ -148,6 +192,13 @@ void displayCandidateDetails(const std::vector shorlistedCandidates) } } +/* + * Function: addShortlistedCandidateAsEmployee + * Description: Converts a shortlisted candidate into an employee record + * Parameters: + * m_zenvyController - pointer to the ZenvyController managing employees + * Returns: void + */ void addShortlistedCandidateAsEmployee(const ZenvyController* m_zenvyController) { int index; @@ -199,4 +250,4 @@ void addShortlistedCandidateAsEmployee(const ZenvyController* m_zenvyController) { throw std::runtime_error("Enter a valid Index."); } -} +} \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.h b/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.h index d7517f1..1f892fb 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/MenuHelper.h @@ -1,3 +1,11 @@ +/* + * File: MenuHelper.h + * Description: Inline functions and utilities for employee management, + * including profile handling, payslip viewing, search, + * and employee activation/deactivation. + * Author: Trenser + * Created: 08-Apr-2026 + */ #pragma once #include #include @@ -19,6 +27,13 @@ void updateDesignation(ZenvyController* m_zenvyController); void displayCandidateDetails(const std::vector shorlistedCandidates); void addShortlistedCandidateAsEmployee(const ZenvyController* m_zenvyController); +/* + * Function: viewPayslipHistory + * Description: Displays the payslip history of the current employee + * Parameters: + * m_zenvyController - pointer to the ZenvyController managing employees + * Returns: void + */ inline void viewPayslipHistory(ZenvyController* m_zenvyController) { auto& employeePayslips = m_zenvyController->getCurrentEmployee()->getEmployeePayslips(); @@ -52,6 +67,13 @@ inline void viewPayslipHistory(ZenvyController* m_zenvyController) util::pressEnter(); } +/* + * Function: viewProfile + * Description: Displays the profile details of the current employee + * Parameters: + * m_zenvyController - pointer to the ZenvyController managing employees + * Returns: void + */ inline void viewProfile(ZenvyController* m_zenvyController) { util::clear(); @@ -95,6 +117,13 @@ inline void viewProfile(ZenvyController* m_zenvyController) } } +/* + * Function: updateProfile + * Description: Allows the current employee to update their profile information + * Parameters: + * m_zenvyController - pointer to the ZenvyController managing employees + * Returns: void + */ inline void updateProfile(ZenvyController* m_zenvyController) { int choice; @@ -146,6 +175,14 @@ inline void updateProfile(ZenvyController* m_zenvyController) } } +/* + * Function: selectEmployeeId + * Description: Displays a list of employees and allows selection by index + * Parameters: + * allEmployees - vector of employee pointers to choose from + * Returns: + * string - selected employee ID + */ inline std::string selectEmployeeId(const std::vector& allEmployees) { int choice; @@ -207,6 +244,13 @@ inline std::string selectEmployeeId(const std::vector& allEmplo } } +/* + * Function: deactivateEmployee + * Description: Deactivates an employee based on selection + * Parameters: + * m_zenvyController - pointer to the ZenvyController managing employees + * Returns: void + */ inline void deactivateEmployee(const ZenvyController* m_zenvyController) { std::string selectedEmployeeId = selectEmployeeId(m_zenvyController->getEmployees()); @@ -226,6 +270,13 @@ inline void deactivateEmployee(const ZenvyController* m_zenvyController) } } +/* + * Function: viewEmployees + * Description: Displays a list of all employees in the system + * Parameters: + * m_zenvyController - pointer to the ZenvyController managing employees + * Returns: void + */ inline void viewEmployees(ZenvyController* m_zenvyController) { util::clear(); @@ -259,6 +310,13 @@ inline void viewEmployees(ZenvyController* m_zenvyController) util::pressEnter(); } +/* + * Function: searchEmployee + * Description: Searches for employees by name and displays matching results + * Parameters: + * m_zenvyController - pointer to the ZenvyController managing employees + * Returns: void + */ inline void searchEmployee(ZenvyController* m_zenvyController) { std::string name; @@ -331,6 +389,13 @@ inline void searchEmployee(ZenvyController* m_zenvyController) util::pressEnter(); } +/* + * Function: viewPayslip + * Description: Displays the payslip of the current employee for a given month and year + * Parameters: + * m_zenvyController - pointer to the ZenvyController managing employees + * Returns: void + */ inline void viewPayslip(ZenvyController* m_zenvyController) { int year, month; diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.cpp index 69e6cbd..a4897f0 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.cpp @@ -27,7 +27,7 @@ void TalentExecutiveMenu::run() { int choice; util::clear(); - std::cout << "Talent Executive Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. View Employees\n5. Search Employee\n6. View Notification\n7. View Announcements\n8. Create New Job\n9. View Job Opening\n10. Add Candidate\n11. UpdateCandidate Status\n12. View Shortlisted Candidate\n13. Update Profile\n14. View Profile\n15. Logout\nEnter your Choice: "; + std::cout << "Talent Executive Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. View Employees\n5. Search Employee\n6. View Notifications\n7. View Announcements\n8. Create New Job\n9. View Job Opening\n10. Add Candidate\n11. Update Candidate Status\n12. View Shortlisted Candidate\n13. Update Profile\n14. View Profile\n15. Logout\nEnter your Choice: "; util::read(choice); if (!handleOperation(choice)) { diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.h index 92e5a23..e6847bc 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TalentExecutiveMenu.h @@ -15,5 +15,4 @@ public: TalentExecutiveMenu() : m_zenvyController(new ZenvyController()) {}; void run(); bool handleOperation(int); -}; - +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.cpp index 9cfacf6..3110402 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.cpp @@ -27,7 +27,7 @@ void TeamExecutiveMenu::run() { int choice; util::clear(); - std::cout << "Team Executive Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. View Employees\n5. Search Employee\n6. View Notification\n7. View Announcements\n8. Create Team\n9. Update Team\n10. Remove Team\n11. Assign Employee\n12. Unassign Employee\n13. View Teams\n14. Update Profile\n15. View Profile\n16. Logout\nEnter your Choice: "; + std::cout << "Team Executive Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. View Employees\n5. Search Employee\n6. View Notifications\n7. View Announcements\n8. Create Team\n9. Update Team\n10. Remove Team\n11. Assign Employee\n12. Unassign Employee\n13. View Teams\n14. Update Profile\n15. View Profile\n16. Logout\nEnter your Choice: "; util::read(choice); if (!handleOperation(choice)) { diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.h index 307d26e..21fd70a 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.h @@ -15,5 +15,4 @@ public: TeamExecutiveMenu() : m_zenvyController(new ZenvyController()) {}; void run(); bool handleOperation(int); -}; - +}; \ No newline at end of file diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.cpp b/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.cpp index 6ead718..40ca7c2 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.cpp +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.cpp @@ -27,7 +27,7 @@ void TeamLeadMenu::run() { int choice; util::clear(); - std::cout << "Team Lead Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. Raise Ticke\n5. View Ticket\n6. View Ticket History\n7. View Employees\n8. Search Employee\n9. View Team Members\n10. Book Meeting Room\n11. View Booking History\n12. View Notification\n13. View Announcements\n4. Regularize Attendance\n15. Update Leave Request\n16. Update Profile\n17. View Profile\n18. Logout\nEnter your Choice: "; + std::cout << "Team Lead Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. Raise Ticket\n5. View Ticket\n6. View Ticket History\n7. View Employees\n8. Search Employee\n9. View Team Members\n10. Book Meeting Room\n11. View Booking History\n12. View Notifications\n13. View Announcements\n14. Regularize Attendance\n15. Update Leave Request\n16. Update Profile\n17. View Profile\n18. Logout\nEnter your Choice: "; util::read(choice); if (!handleOperation(choice)) { diff --git a/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.h b/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.h index e34eee3..2eabf24 100644 --- a/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.h +++ b/Trenser.Zenvy/Trenser.Zenvy/views/TeamLeadMenu.h @@ -15,5 +15,4 @@ public: TeamLeadMenu() : m_zenvyController(new ZenvyController()) {}; void run(); bool handleOperation(int); -}; - +}; \ No newline at end of file