-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/entities #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
02a9056
1b0bc2b
1cbf5fd
7abc014
3d94f79
fd03ed2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| 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. | ||
|
|
||
| #### Logs should look like this: | ||
| ```text | ||
| action = HANDLER_ASSIGNED | ||
| fieldName = assignedHandler | ||
| oldValue = null | ||
| newValue = userId:5 | ||
| createdAt = 2026-03-27 | ||
| ``` | ||
|
|
||
| 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; | ||
| } |
| 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; | ||
| } |
| 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; | ||
|
|
||
| } |
| 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; | ||
| } |
| 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; | ||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing Unlike 🐛 Proposed fix private LocalDateTime createdAt;
+ `@PrePersist`
+ public void prePersist() {
+ createdAt = LocalDateTime.now();
+ }
+
`@ManyToOne`
private Ticket ticket;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| @ManyToOne | ||||||||||||||||||||||
| private Ticket ticket; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| @ManyToOne | ||||||||||||||||||||||
| private SystemUser author; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| <%-- This is a placeholder jte file for CI test --%> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heading level skip detected.
Line 3 uses
###(h3) directly after#(h1), skipping h2. For proper document structure, consider using##instead.📝 Proposed fix
📝 Committable suggestion
🧰 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