Skip to content

Feature/create ticket view - #16

Merged
FionaSprinkles merged 21 commits into
mainfrom
feature/create-ticket-view
Apr 15, 2026
Merged

Feature/create ticket view#16
FionaSprinkles merged 21 commits into
mainfrom
feature/create-ticket-view

Conversation

@FionaSprinkles

@FionaSprinkles FionaSprinkles commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

This PR introduces the initial UI for the application using JTE templates, including layout, styling, and basic user flows for creating and viewing tickets.

Summary by CodeRabbit

  • New Features

    • Create Ticket form page and View Ticket details page; shared site layout with header navigation and footer.
  • Refactor

    • Ticket routes reorganized under /tickets for clearer routing.
  • Behavior

    • Form preserves entered data on validation errors and redirects to the newly created ticket’s page on success.
  • Style

    • Added global stylesheet with header, button, and card styles.
  • Security

    • Access rules updated to allow unauthenticated access to ticket pages and static assets.

@coderabbitai

coderabbitai Bot commented Apr 13, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a7041d54-1fbf-41e2-bf13-ffea12889928

📥 Commits

Reviewing files that changed from the base of the PR and between 3a6edb6 and 6826b6c.

📒 Files selected for processing (2)
  • src/main/java/org/example/alfs/config/SecurityConfig.java
  • src/main/jte/.jteroot
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/org/example/alfs/config/SecurityConfig.java

📝 Walkthrough

Walkthrough

Updates security to permit development/static endpoints, scopes TicketController under /tickets with adjusted routes and redirects, adds JTE layout/create/view templates, removes a placeholder template, and adds a static CSS stylesheet.

Changes

Cohort / File(s) Summary
Security Configuration
src/main/java/org/example/alfs/config/SecurityConfig.java
Adds permitAll() matchers for development and static asset paths (/create, /tickets/**, /view/**, /css/**, /js/**, /images/**, /static/**) while preserving existing auth rules.
Ticket Controller
src/main/java/org/example/alfs/controllers/TicketController.java
Adds class-level @RequestMapping("/tickets"); createNewTicket(...) now accepts Model to repopulate on validation errors and redirects to /tickets/{id} after creation; view routes shortened (/token/{token}, /{id}) and assign/status redirects updated.
JTE Templates
src/main/jte/layout.jte, src/main/jte/create.jte, src/main/jte/view.jte, src/main/jte/placeholder.jte
Adds layout.jte, create.jte, and view.jte templates (declare ticket DTO params, use shared layout); deletes placeholder.jte.
Styling / Static
src/main/resources/static/css/style.css
Adds style.css with theme variables, body typography, and utility classes (.header-border, .btn-primary, .card); referenced by layout template.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Security as "SecurityConfig"
    participant Controller as "TicketController"
    participant Service as "TicketService"
    participant View as "JTE View"

    Client->>Security: Request (e.g., GET/POST /tickets/create)
    Security-->>Client: Permit or require auth
    Client->>Controller: POST /tickets/create (TicketCreateDTO)
    Controller->>Controller: Validate DTO
    alt Validation fails
        Controller->>View: Render create.jte with model (errors, ticket)
        View-->>Client: Form with validation messages
    else Validation succeeds
        Controller->>Service: createNewTicket(dto)
        Service-->>Controller: TicketViewDTO
        Controller-->>Client: Redirect to /tickets/{id}
    end

    Client->>Controller: GET /tickets/{id} or /tickets/token/{token}
    Controller->>Service: fetch ticket
    Service-->>Controller: TicketViewDTO
    Controller->>View: Render view.jte with TicketViewDTO
    View-->>Client: Ticket details page
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • addee1

Poem

🐰
A nibble of code, a hop and stitch,
Forms and layout found their niche,
CSS paints the fields so bright,
Controller guides each ticket's flight,
Hooray — the system's hopping light! 🎟️

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly summarizes the main change: introducing UI templates for creating and viewing tickets, which aligns with the primary objectives of the PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/create-ticket-view

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (1)
src/main/java/org/example/alfs/config/SecurityConfig.java (1)

48-49: Narrow the public /tickets/** matcher to explicit public routes.

/tickets/** currently includes unimplemented POST endpoints like POST /tickets/{id}/assign and POST /tickets/{id}/status. Additionally, the /view/** matcher is unused. Tightening these matchers reduces the attack surface and prevents accidental exposure when TODOs are implemented.

Suggested narrowing
+import org.springframework.http.HttpMethod;
...
-                        .requestMatchers("/create", "/tickets/**", "/view/**").permitAll()
+                        .requestMatchers(HttpMethod.GET, "/tickets/create", "/tickets/*", "/tickets/token/*").permitAll()
+                        .requestMatchers(HttpMethod.POST, "/tickets/create").permitAll()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/org/example/alfs/config/SecurityConfig.java` around lines 48 -
49, In SecurityConfig, tighten the public requestMatchers call: remove the broad
"/tickets/**" and the unused "/view/**" and instead list only the explicit
public endpoints (e.g., the create endpoint and only the GET ticket endpoints
you intend to expose such as "/tickets" and "/tickets/{id}" or specific paths
like "/tickets/{id}/public" if applicable) in the
.requestMatchers(...).permitAll() invocation; update the requestMatchers call in
the method where HttpSecurity is configured (the SecurityConfig class) to
explicitly enumerate allowed HTTP paths and methods rather than using the
wildcard "/tickets/**" so POST routes like "/tickets/{id}/assign" and
"/tickets/{id}/status" remain protected.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/java/org/example/alfs/controllers/TicketController.java`:
- Around line 42-43: The controller is logging raw user-submitted ticket
contents (ticketCreateDTO.getTitle() and ticketCreateDTO.getDescription()) which
can leak sensitive data; update the TicketController (where the
create/validation flow handles ticketCreateDTO) to stop logging raw
title/description on validation failure—either remove these log.info calls
entirely or replace them with non-sensitive metadata (e.g., log only field
lengths, a redacted/truncated placeholder, or a hash/ID) so
ticketCreateDTO.getTitle() and ticketCreateDTO.getDescription() are never
written verbatim to logs.

In `@src/main/jte/create.jte`:
- Around line 7-15: Bind the form fields to the Ticket model so user input
persists after validation: update the title input (name="title") to set its
value from the model's ticket.title (use a null-safe expression like
ticket?.title or a default empty string) and set the textarea content for
name="description" from ticket.description (e.g., ${ticket?.description} or
equivalent null-safe expression), ensuring proper escaping for both so the
controller-returned "create" view with ticket in the model shows the previous
user input.

In `@src/main/jte/layout.jte`:
- Line 31: The anchor in layout.jte uses a relative href "tickets/create" which
breaks on nested routes; change the link target for the Report anchor to an
absolute path (e.g., "/tickets/create") so the anchor element (<a
href="...">Report</a>) always resolves correctly from any route.
- Line 32: The template's anchor uses "/login" but AuthController maps POST to
"/login" while SecurityConfig only permits "/auth/login"; fix the mismatch by
making routes consistent—either update the layout.jte link to "/auth/login" and
change AuthController's `@PostMapping`("/login") to `@PostMapping`("/auth/login"),
or modify SecurityConfig's permitted endpoints to include "/login"; ensure the
chosen route is used consistently in layout.jte, AuthController, and
SecurityConfig.

In `@src/main/resources/static/css/style.css`:
- Line 8: The CSS rule using font-family currently wraps Georgia in quotes which
violates the Stylelint rule font-family-name-quotes; update the font-family
declaration (the font-family property that currently reads 'Georgia', serif) to
remove the quotes so it becomes Georgia, serif to satisfy the linter.

---

Nitpick comments:
In `@src/main/java/org/example/alfs/config/SecurityConfig.java`:
- Around line 48-49: In SecurityConfig, tighten the public requestMatchers call:
remove the broad "/tickets/**" and the unused "/view/**" and instead list only
the explicit public endpoints (e.g., the create endpoint and only the GET ticket
endpoints you intend to expose such as "/tickets" and "/tickets/{id}" or
specific paths like "/tickets/{id}/public" if applicable) in the
.requestMatchers(...).permitAll() invocation; update the requestMatchers call in
the method where HttpSecurity is configured (the SecurityConfig class) to
explicitly enumerate allowed HTTP paths and methods rather than using the
wildcard "/tickets/**" so POST routes like "/tickets/{id}/assign" and
"/tickets/{id}/status" remain protected.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8c821fa3-5461-48f9-8f80-cbf76fbf63e2

📥 Commits

Reviewing files that changed from the base of the PR and between 3fe0a9c and 2c9a57c.

📒 Files selected for processing (7)
  • src/main/java/org/example/alfs/config/SecurityConfig.java
  • src/main/java/org/example/alfs/controllers/TicketController.java
  • src/main/jte/create.jte
  • src/main/jte/layout.jte
  • src/main/jte/placeholder.jte
  • src/main/jte/view.jte
  • src/main/resources/static/css/style.css
💤 Files with no reviewable changes (1)
  • src/main/jte/placeholder.jte

Comment thread src/main/java/org/example/alfs/controllers/TicketController.java Outdated
Comment thread src/main/jte/create.jte Outdated
Comment thread src/main/jte/layout.jte Outdated
Comment thread src/main/jte/layout.jte Outdated
Comment thread src/main/resources/static/css/style.css Outdated

@addee1 addee1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall 👍
Ready to merge

@FionaSprinkles
FionaSprinkles merged commit da5c0c4 into main Apr 15, 2026
2 checks passed
This was referenced Apr 15, 2026
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.

2 participants