Skip to content

feature/options#7

Merged
LinusWestling merged 11 commits intomainfrom
feature/options
Jan 6, 2026
Merged

feature/options#7
LinusWestling merged 11 commits intomainfrom
feature/options

Conversation

@LinusWestling
Copy link
Copy Markdown

@LinusWestling LinusWestling commented Jan 6, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added command-line interface with user authentication and login flow
    • User interface for browsing and managing movie collections and ratings
    • Admin interface for managing users, movies, actors, directors, and genres
    • Movie search and filtering by language, rating, release date, length, and genre
    • User rating system with improved precision
  • Chores

    • Added testing infrastructure with in-memory database support
    • Updated project dependencies and build configuration
    • Expanded design documentation

✏️ Tip: You can customize this high-level summary in your review settings.

Linus Westling and others added 11 commits December 18, 2025 09:07
Basic tests also implmented.

Co-authored-by: Oscar Nidemar <oscar.nidemar@gmail.com>

Co-authored-by: Oskar Lundqvist <oskar.lundqvist3@icloud.com>

Co-authored-by: Mark Cavric <cavric_123@hotmail.se>

Co-authored-by: Linus Westling <westling.linus@gmail.com>
Co-authored-by: Oscar Nidemar <oscar.nidemar@gmail.com>

Co-authored-by: Oskar Lundqvist <oskar.lundqvist3@icloud.com>

Co-authored-by: Mark Cavric <cavric_123@hotmail.se>

Co-authored-by: Linus Westling <westling.linus@gmail.com>
…ontiued implementation of switch menue's.

Co-authored-by: Oscar Nidemar <oscar.nidemar@gmail.com>

Co-authored-by: Oskar Lundqvist <oskar.lundqvist3@icloud.com>

Co-authored-by: Mark Cavric <cavric_123@hotmail.se>

Co-authored-by: Linus Westling <westling.linus@gmail.com>
Co-authored-by: Oscar Nidemar <oscar.nidemar@gmail.com>
Co-authored-by: Oskar Lundqvist <oskar.lundqvist3@icloud.com>
Co-authored-by: Mark Cavric <cavric_123@hotmail.se>
Co-authored-by: Linus Westling <westling.linus@gmail.com>
Co-authored-by: Oscar Nidemar <oscar.nidemar@gmail.com>
Co-authored-by: Oskar Lundqvist <oskar.lundqvist3@icloud.com>
Co-authored-by: Mark Cavric <cavric_123@hotmail.se>
Co-authored-by: Linus Westling <westling.linus@gmail.com>
Simplified the EntityManager mess for CliAdminApp.

TODO: Simplify em for CliApp.
Co-authored-by: Oscar Nidemar <oscar.nidemar@gmail.com>
Co-authored-by: Oskar Lundqvist <oskar.lundqvist3@icloud.com>
Co-authored-by: Mark Cavric <cavric_123@hotmail.se>
Co-authored-by: Linus Westling <westling.linus@gmail.com>
Co-authored-by: Oskar Lundqvist <oskar.lundqvist3@icloud.com>
Co-authored-by: Mark Cavric <cavric_123@hotmail.se>
Co-authored-by: Linus Westling <westling.linus@gmail.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 6, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR introduces a CLI-driven application layer with separate admin and user interfaces, refactors the application entry point to include a database emptiness guard with conditional seeding, adds transaction and entity manager utility classes, extends the repository layer with comprehensive querying methods, converts rating precision from float to double, and substantially expands test coverage with integration tests for seeding and user interaction flows.

Changes

Cohort / File(s) Summary
CLI Application Framework
src/main/java/org/example/App.java, src/main/java/org/example/CliApp.java, src/main/java/org/example/CliAdminApp.java
Refactored App entry point to implement database-aware startup with login flow and menu routing; added CliApp user menu system with favorites, movie queries, and rating capabilities; added CliAdminApp admin menu for user/movie/genre/actor/director management
JPA Utilities
src/main/java/org/example/JpaRunner.java, src/main/java/org/example/JpaUtil.java
Introduced transaction wrapper (JpaRunner) for centralized transactional execution; introduced EntityManager factory manager (JpaUtil) with Hibernate configuration for six entity classes
Seeding Infrastructure
src/main/java/org/example/DatabaseFiller.java, src/main/java/org/example/seed/SeedMovies.java, src/main/java/org/example/seed/SeedUsers.java, src/main/java/org/example/seed/SeedMovieRelations.java
Added database emptiness check and seedAll orchestration to DatabaseFiller; added Admin user to seed; removed EntityManager.clear() from batch loop; minor whitespace cleanup
Repository Layer—Movie
src/main/java/org/example/jpaimpl/MovieRepoJpa.java, src/main/java/org/example/repo/MovieRepo.java
Implemented MovieRepo interface in MovieRepoJpa; replaced findByTitleOptional with findByTitle; added comprehensive query methods (byDirector, byActor, byReleaseDate, byLength, byRanking, byLanguage, byGenre, getAllMovies, getById); enhanced addMovie with upsert logic; removed three actor/director methods from interface
Repository Layer—Rating
src/main/java/org/example/jpaimpl/UserRatingRepoJpa.java, src/main/java/org/example/repo/UserRatingRepo.java, src/main/java/org/example/pojo/UserRating.java
Converted all rating types from float to double; changed rateMovie return type from void to boolean with early false on null inputs; updated validation semantics in UserRatingRepoJpa
Repository Layer—Actor/Director
src/main/java/org/example/jpaimpl/ActorRepoJpa.java, src/main/java/org/example/jpaimpl/DirectorRepoJpa.java
Added deleteByName methods for name-based deletion in both Actor and Director repositories
Configuration & Build
pom.xml
Added H2 test-scoped database dependency (2.2.224); configured Maven Surefire plugin (3.2.5) with useModulePath disabled
Testing
src/test/java/org/example/AppTest.java
Migrated from JUnit 5 to Jakarta Persistence integration tests; established in-memory H2 setup with lifecycle hooks; added comprehensive seeder verification, entity persistence tests, and end-to-end user flow simulation with mocks
Documentation
NOTES.md, README.md
Added detailed design planning document with User/UserRating/Movie/Admin use cases and data model; marked Week 2 design documentation task as complete

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant App as App.main
    participant DBCheck as DatabaseFiller
    participant Seed as Seed*
    participant Repo as Repositories
    participant DB as Database
    participant Login as CLI Login
    participant CliApp as CliApp/CliAdminApp

    User->>App: Start Application
    App->>DBCheck: isDatabaseEmpty()
    DBCheck->>Repo: Query Movie count
    Repo->>DB: COUNT(movies)
    DB-->>Repo: count result
    Repo-->>DBCheck: count
    DBCheck-->>App: true/false
    
    alt Database is Empty
        App->>Seed: seedAll()
        Seed->>Repo: addGenres, addActors, addDirectors
        Repo->>DB: INSERT entities
        Seed->>Repo: addMovies with relations
        Repo->>DB: INSERT movies + relations
        Seed->>Repo: attachRelations (genres, cast)
        Repo->>DB: UPDATE movie relations
        Seed->>Repo: addUsers + ratings
        Repo->>DB: INSERT users, user_ratings
    end
    
    App->>Login: Display Welcome & Login Prompt
    Login->>User: Username/Password Input
    User-->>Login: Credentials
    Login->>Repo: Verify User
    Repo->>DB: SELECT user
    DB-->>Repo: user or null
    
    alt Login Successful
        Repo-->>Login: User found
        Login->>App: Authentication OK
        App->>App: Check if Admin
        alt User is Admin
            App->>CliAdminApp: runAdminMenu(user)
            CliAdminApp->>CliAdminApp: Display Admin Options
        else User is Regular User
            App->>CliApp: runUserMenu(user)
            CliApp->>CliApp: Display User Options
        end
    else Login Failed
        Repo-->>Login: User not found
        Login->>User: Invalid Credentials
        Login->>App: Retry Loop
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

  • PR #3: Both modify DatabaseFiller and seeding orchestration with guard checks and consolidate seed methods into a unified seedAll flow
  • PR #4: Overlapping changes to App.main entry point, seed class refactoring (SeedUsers, SeedMovieRelations, SeedActors), MovieRepo interface methods, and UserRating domain changes
  • PR #1: Builds upon and extends the same JPA entity implementations (DatabaseFiller, MovieRepoJpa, UserRatingRepoJpa, repository interfaces) introduced in the feature baseline

Poem

🐰 A CLI blooms, with menus so grand,
Where admins command and users expand,
From seeds that spring when databases sleep,
Ratings now double their precision to keep,
And tests that verify all that we've sown—
Our burrow of code, now thoroughly grown! 🌱

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a48098b and 03a1199.

📒 Files selected for processing (20)
  • NOTES.md
  • README.md
  • pom.xml
  • src/main/java/org/example/App.java
  • src/main/java/org/example/CliAdminApp.java
  • src/main/java/org/example/CliApp.java
  • src/main/java/org/example/DatabaseFiller.java
  • src/main/java/org/example/JpaRunner.java
  • src/main/java/org/example/JpaUtil.java
  • src/main/java/org/example/jpaimpl/ActorRepoJpa.java
  • src/main/java/org/example/jpaimpl/DirectorRepoJpa.java
  • src/main/java/org/example/jpaimpl/MovieRepoJpa.java
  • src/main/java/org/example/jpaimpl/UserRatingRepoJpa.java
  • src/main/java/org/example/pojo/UserRating.java
  • src/main/java/org/example/repo/MovieRepo.java
  • src/main/java/org/example/repo/UserRatingRepo.java
  • src/main/java/org/example/seed/SeedMovieRelations.java
  • src/main/java/org/example/seed/SeedMovies.java
  • src/main/java/org/example/seed/SeedUsers.java
  • src/test/java/org/example/AppTest.java

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@LinusWestling LinusWestling merged commit 6ad9eaa into main Jan 6, 2026
0 of 3 checks passed
@LinusWestling LinusWestling deleted the feature/options branch January 6, 2026 09:49
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