Requirements:
- Java 21
- Docker (running)
- docker-compose
Steps to start Salat locally:
- Build the image:
./mvnw spring-boot:build-image
- Run docker-compose:
docker-compose up -d
(in newer docker versions usedocker compose up -d
) - That's it. Salat should now be running. To check, open in browser: http://localhost:8080?employee-sign=tt
Shutdown:
- Stop docker-compose: CTRL+C
- Stop built containers:
docker-compose stop
(in newer docker versions usedocker compose stop
) - If you want to remove the containers:
docker-compose down
(in newer docker versions usedocker compose down
)
Open the URL <http://localhost:8080?employee-sign=>
You can change the employee-sign
parameter to login as a different user.
It is even possible to append ?employee-sign=<sign>
to any URL, to log in the user.
Valid employee-signs in the test-dataset are:
- admin: Administrator
- bm: "Bossy Bossmann", Administrator
- tt: "Testy Testmann", Employee
There is no need to logout. But you can just click the button to logout.
With the above login url, you can change the login user at any time without logging out!
To start only the local database, without the Salat application:
docker-compose -f docker-compose-infra.yml up
docker-compose down
if you had the application running before.
Should you encounter the error
Consider defining a bean of type 'org.springframework.boot.info.BuildProperties' in your configuration.
This can be fixed by running
./mvnw package
Explanation: Maven creates a file named build-info.properties
.
This file might be missing when an IDE does not create it. (Happened to Klaus with IntelliJ IDEA, despite Maven Integration).
(by Klaus)
Changes to the data base are collected via Liquibase in the following file:
src/main/resources/db/changelog/db.changelog-master.yaml
The following environment variables must be set in each environment/stage:
SPRING_DATASOURCE_USERNAME
SPRING_DATASOURCE_PASSWORD
SPRING_DATASOURCE_URL
The following is an example for local testing with the included docker-compose file:
SPRING_DATASOURCE_USERNAME=salattest
SPRING_DATASOURCE_PASSWORD=salattest
SPRING_DATASOURCE_URL=jdbc:mysql://localhost:3306/salat?useUnicode=true&useJDBCCompliantTimezoneShift=true&serverTimezone=Europe/Berlin&useLegacyDatetimeCode=false&autoReconnect=true
- AfterLogin#createWarnings - erzeugt Warnungen, die dem User angezeigt werden sollen. Diese weisen auf Fehler bzw. offenen TODOs hin. Könnte man in einen Service packen und dann via scheduled Job regelmässig erzeugen lassen und in der DB speichern.
- AfterLogin#handleOvertime - berechnet Überstunden zur Anzeige beim User. Sollte in den OvertimeService überführt werden. Dieser existiert bereits und ist auch in der Lage, Überstunden zu berechnen. Könnte man entsprechend zusammenführen.
- StoreCustomerAction#executeAuthenticated - bei task=save wird ein Customer angelegt. Sollte im CustomerService sein.
- DeleteCustomerAction#executeAuthenticated - auch dies sollte weitestgehend im CustomerService sein.
- TimereportHelper#determineBeginTimeToDisplay - move to WorkingdayService
- TimereportHelper#determineTimesToDisplay - move to WorkingdayService and introduce a better value class to carry the result
- TimereportHelper#calculateLaborTime - more or less just a sum up time on Timereports, maybe this can be done without any service, just use Java streaming API and Duration.plus
- TimereportHelper#checkLaborTimeMaximum - move to WorkingdayService? Or maybe a business rule in TimereportService that creates a warning? Or when it's a warning, maybe add to the WarningService.
- TimereportHelper#calculateQuittingTime - nach WorkingdayService
- TrainingHelper#fromDBtimeToString - nach DurationUtils als neue Methode formatWithWorkingsdays(Duration duration, Duration dailyWorkingTime
- TrainingHelper#hoursMinToString - better use Duration and then DurationUtils#format
- StoreEmployeeAction#executeAuthenticated - move storing of Employee to EmployeeService
- DeleteEmployeeAction#executeAuthenticated - move deletion to EmployeeService
- StoreEmployeecontractAction#executeAuthenticated - move storing of Employeecontract to EmployeecontractService
- DeleteEmployeecontractAction#executeAuthenticated - move deletion to EmployeecontractService
- StoreCustomerorderAction#executeAuthenticated - move storing to CustomerorderService
- DeleteCustomerorderAction#executeAuthenticated - move deletion to CustomerorderService
- StoreEmployeeorderAction#executeAuthenticated - move storing to EmployeeorderService
- DeleteEmployeeorderAction#executeAuthenticated - move deletion to EmployeeorderService
- StoreSuborderAction#executeAuthenticated - move storing to SuborderService
- StoreSuborderAction#executeAuthenticated - move copy to SuborderService
- DeleteSuborderAction#executeAuthenticated - move deletion to SuborderService
- GenerateMultipleEmployeeordersAction - move storing to EmployeeorderService