S16 postgresql opslag added
All checks were successful
Build, test and publish / verify (push) Successful in 7m31s

This commit is contained in:
2026-11-04 17:10:25 +01:00
parent f59cad115a
commit 694bf3fa86
89 changed files with 3087 additions and 252 deletions

View File

@@ -19,14 +19,19 @@ mvn -pl agiledancers-be quarkus:dev
Run the packaged application after building:
```sh
# Set DATABASE_URL, DATABASE_USER and DATABASE_PASSWORD first.
java -jar agiledancers-be/target/quarkus-app/quarkus-run.jar
```
Build and run a Docker container from the repository root (only Docker is required):
Build a Docker container against an isolated test database (see [connection setup](docs/persistent-storage.md)):
```sh
docker build -t agiledancers .
docker run --rm --name agiledancers -p 8080:8080 agiledancers
docker build --network=host \
--secret id=database_url,env=TEST_DATABASE_URL \
--secret id=database_user,env=TEST_DATABASE_USER \
--secret id=database_password,env=TEST_DATABASE_PASSWORD -t agiledancers .
docker run --rm --name agiledancers -p 8080:8080 \
-e DATABASE_URL -e DATABASE_USER -e DATABASE_PASSWORD agiledancers
```
The Docker build compiles the application and runs the tests in a Maven build stage,
@@ -42,7 +47,13 @@ curl --fail http://localhost:8080/q/health/ready
Quarkus configuration can be overridden with environment variables, for example
`docker run --rm -e QUARKUS_HTTP_PORT=9090 -p 9090:9090 agiledancers`.
The REST API uses shared in-memory storage; data is lost when the process stops.
PostgreSQL stores all school data, planning state and the latest scheduling run
through JPA/Hibernate ORM. Persistence entities remain in the repository layer.
Flyway initializes and versions the schema. Production requires `DATABASE_URL`
(a JDBC PostgreSQL URL), `DATABASE_USER` and `DATABASE_PASSWORD`; missing credentials,
connection failures and migration failures prevent startup. See
[database setup and transition](docs/persistent-storage.md) before replacing an
in-memory release: export every school before stopping it.
Architecture checks run with the normal test suite, or separately with:
@@ -56,7 +67,7 @@ mvn -pl agiledancers-be -Dtest=ArchitectureTest test
| --- | --- | --- |
| `model` | Domain entities and specifications | Model |
| `service` | Application use cases and future ports | Model, repositories |
| `repository` | Current in-memory persistence | Model |
| `repository` | JPA/Hibernate entities, repositories and transaction boundaries | Model |
| `rest` | Future REST services | Services, model |
| `solver` | Future OR-Tools calculations | Services (ports), model |
@@ -175,8 +186,9 @@ recover current state on reconnection rather than requiring event replay. The
production proxy disables buffering. The UI shows phase, elapsed time, solution
discovery and final objective scores, and reports completion in an application-wide
snackbar. Reloading recovers the latest state without replaying old notifications.
Run state currently shares the application's in-memory lifetime; durable restart
recovery requires the PostgreSQL integration specified in S16.
The latest run and saved assignments survive restart. Startup marks formerly
running calculations `INTERRUPTED`, preserves the previous assignments, and allows
a new run. Results and successful status commit in one database transaction.
`PUT .../shows/{showId}/assignments` accepts `{"assignments":[[1,2],[3]]}`, an
ordered list of group IDs per daypart. Incomplete or invalid drafts can be saved;
@@ -281,7 +293,7 @@ for the current operational status.
Production releases and rollback use separate manual Gitea workflows. See the
[deployment runbook](docs/production-deployment.md) for Synology provisioning,
semantic version tags, release/retry/rollback and the accepted data-loss limitation
until S16, and [S6 evidence](docs/s6-validation.md) for deployment readiness.
during the one-time transition from an in-memory release, and [S6 evidence](docs/s6-validation.md) for deployment readiness.
### Java formatting (S8)
@@ -346,3 +358,18 @@ analysis tools, coverage policy and standalone commands. `mvn verify` runs stand
checks and requires at least 80% module-wide backend line coverage. CI also collects
and merges coverage from Playwright before publication. Reports are retained with
CI diagnostics. See [S7 validation](specs/S7-validation.md) for current migration status.
Existing-school mutations require `X-School-Revision` with the revision loaded by
the editor. `GET /api/dance-schools/{id}/data` returns the school and all its editor
data from one consistent snapshot; `school.revision` identifies that snapshot.
Missing or stale revisions receive `409` with a reload instruction. The import
preview returns `existingRevision` for replacement confirmation. Creation of a
new school does not need a revision. The frontend never automatically retries a
conflicting edit with a newer revision.
Domain-to-view projection is generated by MapStruct in `rest.mapping.DomainViewMapper`.
It is a CDI bean with `unmappedTargetPolicy = ERROR`, so unmatched target fields fail
compilation. REST resources supply calculated validation results explicitly. The
entity-to-domain graph mappings remain handwritten in the repository layer.