Added employee persistence, serialization, and file loading support
<SRS>SRS02 : Employee Management </SRS> <Changes> - Implemented serialization and deserialization for Employee and GeneralEmployee models - Added FileManager integration to load employees from CSV files - Introduced ApplicationConfig entries for employee file paths - Updated Employee ID handling (getEmployeeId → getId) across project - Modified FileIO to auto-create file if not found instead of throwing exception - Added constructors for all employee types to support deserialization - Implemented loadEmployees in service and loadStates in controller - Ensured default admin creation if none exists during load - Added StringHelper utility for extracting numeric IDs - Extended Enums with string conversion and parsing utilities - Added initial CSV files for Employee and GeneralEmployee data - Improved login error message formatting and minor cleanup - Setup gitignore to not track csv files </Changes>
This commit is contained in:
@@ -5,14 +5,14 @@ std::vector<std::string> FileIO::readAllLines(const std::string& path)
|
||||
{
|
||||
std::ifstream file(path);
|
||||
if (!file.is_open())
|
||||
throw std::runtime_error("Failed to open file " + path);
|
||||
|
||||
std::vector<std::string> lines;
|
||||
{
|
||||
std::ofstream newFile(path);
|
||||
newFile.close();
|
||||
file.open(path);
|
||||
} std::vector<std::string> lines;
|
||||
std::string line;
|
||||
|
||||
while (std::getline(file, line))
|
||||
lines.push_back(line);
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "FileIO.h"
|
||||
|
||||
template <typename T> using objects = std::map<int, std::shared_ptr<T>>;
|
||||
template <typename T> using objects = std::map<std::string, std::shared_ptr<T>>;
|
||||
|
||||
template <typename T>
|
||||
class FileManager
|
||||
|
||||
Reference in New Issue
Block a user