Repository navigation
Add PostgreSQL profile with Docker Compose - #9
Merged
Merged
Conversation
Introduced improvements in some fields in entities Reservation and RestauranTable in develop branch which are not in this branch yet
Chore/readme and repo cleanup
## 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
data.sqlwith aDataSeederCommandLineRunnerthat skips seeding when users already existpostgresSpring profile running on PostgreSQL through Docker Compose; H2 remains the default.envvariables in the README