Skip to content

Add PostgreSQL profile with Docker Compose - #9

Merged
cloudxdam merged 54 commits into
mainfrom
feat/postgres-profile
Oct 7, 2026
Merged

cloudxdam merged 54 commits into
mainfrom
feat/postgres-profile

Conversation

@cloudxdam

Copy link
Copy Markdown
Owner

Summary

  • Replace data.sql with a DataSeeder CommandLineRunner that skips seeding when users already exist
  • Add an optional postgres Spring profile running on PostgreSQL through Docker Compose; H2 remains the default
  • Document both startup paths and the required .env variables in the README

cloudxdam added 30 commits May 6, 2026 10:16
Introduced improvements in some fields in entities Reservation and RestauranTable
in develop branch which are not in this branch yet
cloudxdam added 24 commits May 20, 2026 09:59
## Summary

The JWT signing key was hardcoded in `application.properties` in a public
repo. Moved to a gitignored `.env` and rotated.

- `${JWT_SECRET}` with no default — app won't start without it
- `.env` gitignored, `.env.example` documents the variables
- README: new "Configure the JWT secret" section
- Regenerated the Maven wrapper (`.mvn/wrapper/` was missing, `mvnw` had no
  executable bit)

Old key stays in history — it's rotated, so it's dead.

**Verification:** no `.env` → won't start (`Could not resolve placeholder`);
with `.env` → login 200, endpoint 200/403/403; `./mvnw test` 6/6.
## Summary
- Add `ReservationServiceTxTest`, an integration test (real Spring context + H2) covering two missing transaction boundaries
- Annotate `create`, `cancelReservation` and `completeReservation` with `@Transactional`
- Fix inverted `assertEquals(expected, actual)` argument order in the existing `ReservationServiceTest`

Both bugs were red against a real H2 database before the fix and green after:
- `create` mutated a detached `RestaurantTable`, so `is_vip` was never persisted
- `cancelReservation` committed penalty points in their own transaction, so a failure on the last write left them applied

`./mvnw test` — 8/8 passing
## Summary
- Pessimistic lock (`SELECT ... FOR UPDATE`) on the table row in `ReservationService.create`
- Regression test rejecting a duplicate booking for the same slot

A plain `@Transactional` was not enough: two transactions could both pass the
conflict check before either inserted.
## Summary
- Scope the VIP gate to the current user instead of counting every confirmed
  reservation in the restaurant
- Add a test rejecting a VIP booking from a user with no reservation history

`./mvnw test` — 10/10 passing.
## Summary
- Run `./mvnw test` on every push and pull request targeting develop/main
- Add the CI status badge to the README
- Rename the default branch `master` → `main`

`JWT_SECRET` is provided as a clearly-labelled CI-only dummy (48 chars; jjwt
requires >= 32 for HS256) — tests run on in-memory H2, so no real secret is
needed.

`./mvnw test` locally — 10/10 passing.
@cloudxdam
cloudxdam merged commit 32d0fea into main Oct 7, 2026
1 check passed
@cloudxdam
cloudxdam deleted the feat/postgres-profile branch October 7, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant