Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,25 @@ build/

### jte ###
/jte-classes/

# Environment variables
.env
.env.local
.env.*.local

# Logs
logs/
*.log

# OS files
.DS_Store
Thumbs.db

# temp
tmp/
temp/

# secrets
secrets/
*.key
*.pem
10 changes: 0 additions & 10 deletions .idea/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/project-backend-alfs.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# The ALFS Whistleblower Ticket System

### A secure case management system built with Spring Boot for handling whistleblower reports.
The system allows anonymous reporting, secure file uploads, role-based access control, and full audit logging.
Comment on lines +1 to +4
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Heading level skip detected.

Line 3 uses ### (h3) directly after # (h1), skipping h2. For proper document structure, consider using ## instead.

📝 Proposed fix
 # The ALFS Whistleblower Ticket System
 
-### A secure case management system built with Spring Boot for handling whistleblower reports.
+## A secure case management system built with Spring Boot for handling whistleblower reports.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# The ALFS Whistleblower Ticket System
### A secure case management system built with Spring Boot for handling whistleblower reports.
The system allows anonymous reporting, secure file uploads, role-based access control, and full audit logging.
# The ALFS Whistleblower Ticket System
## A secure case management system built with Spring Boot for handling whistleblower reports.
The system allows anonymous reporting, secure file uploads, role-based access control, and full audit logging.
🧰 Tools
🪛 markdownlint-cli2 (0.22.0)

[warning] 3-3: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 1 - 4, The README has a heading level skip: the main
title "# The ALFS Whistleblower Ticket System" is followed by "### A secure case
management system built with Spring Boot for handling whistleblower reports." —
change that "###" to "##" so the secondary heading "A secure case management
system built with Spring Boot for handling whistleblower reports." becomes an H2
(use "##") to maintain proper document structure and hierarchy.


#### Logs should look like this:
```text
action = HANDLER_ASSIGNED
fieldName = assignedHandler
oldValue = null
newValue = userId:5
createdAt = 2026-03-27
```

4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@
<artifactId>spring-boot-starter-webmvc-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
37 changes: 37 additions & 0 deletions src/main/java/org/example/alfs/entities/Attachment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.example.alfs.entities;

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/*
Represent a file uploaded with Ticket.
Stores metadata about the file and the file reference s3key.
*/
@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Attachment {

@Id
@GeneratedValue
private Long id;

private String fileName;

private String s3Key;

private LocalDateTime uploadedAt;

@PrePersist
public void prePersist() {
uploadedAt = LocalDateTime.now();
}

@ManyToOne
private Ticket ticket;
}
45 changes: 45 additions & 0 deletions src/main/java/org/example/alfs/entities/AuditLog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package org.example.alfs.entities;

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/*
Represents audit log for Ticket.
Logs all events such as status change, assignment and comments.
Should be written automatically.
*/
@Entity
@Table(name="audit_log")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AuditLog {

@Id
@GeneratedValue
private Long id;

private String action;

private String fieldName;

private String oldValue;

private String newValue;

private LocalDateTime createdAt;
@PrePersist
public void prePersist() {
createdAt = LocalDateTime.now();
}

@ManyToOne
private Ticket ticket;

@ManyToOne
private SystemUser user;
}
28 changes: 28 additions & 0 deletions src/main/java/org/example/alfs/entities/SystemUser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.example.alfs.entities;

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/*
Represents a system user.
Users have different roles such as admin or investigator.
*/
@Entity
@Table(name="system_user")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SystemUser {

@GeneratedValue
@Id
private Long id;

private String username;
private String password;

private String role;

}
47 changes: 47 additions & 0 deletions src/main/java/org/example/alfs/entities/Ticket.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package org.example.alfs.entities;

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


import java.time.LocalDateTime;
import java.util.List;

/*
Representing a whistleblower report.
The ticket can be followed by the anonymous reporter by using the reporterToken.
*/

@Entity
@Table(name="ticket")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Ticket {

@Id
@GeneratedValue
private Long id;

private String title;

private String description;

private String status;

private String reporterToken;

private LocalDateTime createdAt;
@PrePersist
public void prePersist() {
createdAt = LocalDateTime.now();
}

@OneToMany(mappedBy = "ticket")
private List<Attachment> attachment;

@ManyToOne
private SystemUser assignedHandler;
}
35 changes: 35 additions & 0 deletions src/main/java/org/example/alfs/entities/TicketComment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.example.alfs.entities;

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


import java.time.LocalDateTime;

/*
Represents comment on a ticket.
The comments are written by a SystemUser.
*/
@Entity
@Table(name="ticket_comment")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TicketComment {

@Id
@GeneratedValue
private Long id;

private String message;

private LocalDateTime createdAt;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Missing @PrePersist callback for createdAt.

Unlike Ticket, Attachment, and AuditLog, this entity lacks the @PrePersist method to auto-populate createdAt. This will result in null timestamps unless manually set before saving.

🐛 Proposed fix
     private LocalDateTime createdAt;
 
+    `@PrePersist`
+    public void prePersist() {
+        createdAt = LocalDateTime.now();
+    }
+
     `@ManyToOne`
     private Ticket ticket;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private LocalDateTime createdAt;
private LocalDateTime createdAt;
`@PrePersist`
public void prePersist() {
createdAt = LocalDateTime.now();
}
`@ManyToOne`
private Ticket ticket;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/org/example/alfs/entities/TicketComment.java` at line 28,
TicketComment is missing a `@PrePersist` lifecycle callback to populate the
createdAt field; add a private method annotated with `@PrePersist` (e.g.,
prePersist or setCreatedAtIfNull) inside the TicketComment class that sets
createdAt = LocalDateTime.now() when createdAt is null so new TicketComment
instances get an automatic timestamp before being persisted.


@ManyToOne
private Ticket ticket;

@ManyToOne
private SystemUser author;
}
1 change: 1 addition & 0 deletions src/main/jte/placeholder.jte
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%-- This is a placeholder jte file for CI test --%>