- PHP 8.0+
- MySQL
- Composer
-
Clone the repository:
git clone https://github.com/thejsondev/LocalX-EMS cd employee-management
-
Install dependencies:
composer install
-
Configure the database in
.env
file:DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=8.0"
-
Create database:
php bin/console doctrine:database:create
-
Run migrations:
php bin/console doctrine:migrations:migrate
-
Start the Symfony server:
symfony server:start
POST /api/employee
: Upload a CSV file to batch import employees.GET /api/employee
: List all employees.GET /api/employee/{id}
: Get a specific employee by ID.DELETE /api/employee/{id}
: Delete a specific employee by ID.
If this were a real-world task, I would consider implementing the following:
- Authentication and Authorization: Secure the endpoints to ensure only authorized users can access them.
- Data Validation: Implement validation to ensure the data from the CSV is correct before saving it to the database.
- Pagination: Implement pagination for the
GET /api/employee
endpoint to handle large datasets. - Asynchronous Processing: For large CSV files, consider processing the file asynchronously using a queue system.
- Unit Tests: Write unit and integration tests to ensure the functionality is working as expected.
- Better property types: Check compatibility with DateTime on values in imported CSV to insert date and times in DateTime type instead of string.