This project is created based on the "Payroll" case study from the Agile Software Development Principles And Patterns by Robert.C.Martin.
The simple payroll system uses a Domain Model to cover its's Business functionality. Beside there are Operations which create/update the Domain Model Entities.
The files are organized by business concepts:
- classification
- payment_methods
- schedules
- union
- common
Each business concept contains:
- the entities
- the operations
- it's tests.
Other component is the Relational Database Persistence component which uses the repository pattern provided by the ROM-rb to persist the Objects from the Domain. It also contains an array/"in memory" implementation of the Persistence Layer.
The code loader is "Zeitwerk" using "Conventional File Structure".
- Add a new employee (with 3 classifications: salaried/hourly/comissioned)
- Delete an employee
- Post a time card for salaried employee
- Post a sales receipt for comissioned employee
- Post a union service charge
- Change employee details
- Run the payroll for today
A new employee is added. This Transaction contains the employee's name, address, and assigned employee number.
The employee record is created with its fields assigned appropriately.
Employees are deleted.
On receipt of a TimeCard transaction, the system will create a time card record an associate it with the appropriate employee record.
Alternative 1: The selected employee is not hourly
The system will report an error message and take no further action.
On receipt of the SalesReceipt Transaction, the system will create a new salesreceipt record and associate it with the appropriate commissioned employee.
SalesReceipt <emp_id>
Alternative 1: The selected employee not commissioned
The system will report an error message.
On receipt of this transaction, the system will create a service-charge record and associate it with the appropriate union member.
ServiceCharge <member_id>
The system will alter one of the details of the appropriate employee record.
On receipt of the payday transaction, the system finds all those employees that should be paid on the specified date. The system then determines how much they are owed and pays them according to ther selected payment method.
Rake Tasks:
- Reseting the test environment:
PAYROLL_ENVIRONMENT=test rake db:reset
- Reseting the dev environment:
rake db:reset
- Clean our db modifications:
rake db:clean
, note: this only drops the tables listed in our migrations. (rom is a repository it assumes that there could be other things in the DB. It leaves those unchanged.)