We want to implement a new feature to display absence-quota information to our teacher end-users. To do so, we need to import the data from their salary-system (OPUS). Your task is to implement code to import the data.
You must:
- Create a migration to store the absence-quota. The absence quota should be related by a foreign key to the
schoolsandteacherstables. All other considerations, including normalization is up to you. - Create a model
AbsenceQuotawith relationships to theSchoolandTeachermodels. - Implement the functionality to import the data in
OpusAbsenceQuotaImportService. You should match schools and teacher by theinstitutionCodeandemployeeNumberfields. - The import implementation should be runnable multiple times, so
daysRemainingcan be updated in our system, as it changes in the salary system.
You should take the following things into consideration:
- Normalization of the data model
- Performance of the import
- Data consistency and constraints
You can use any database you have on your computer. The following instructions assume the use of sqlite:
- Run
composer install - Run
touch database/database.sqlite - Copy
.env.exampleto.env - Replace
{ADD ABSOLUTE PATH HERE}in your.envfile to point to the database - Run
php artisan migrate - Run
php artisan db:seed --class=DataSeeder
Use php artisan app:absence-quota-import-command to run the implementation.