Skip to content

Commit ab800a4

Browse files
Merge pull request #1 from ithsjava25/feature/entities
Feature/entities
2 parents d2e89f9 + 680c915 commit ab800a4

14 files changed

Lines changed: 251 additions & 39 deletions

File tree

.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,25 @@ build/
3434

3535
### jte ###
3636
/jte-classes/
37+
38+
# Environment variables
39+
.env
40+
.env.local
41+
.env.*.local
42+
43+
# Logs
44+
logs/
45+
*.log
46+
47+
# OS files
48+
.DS_Store
49+
Thumbs.db
50+
51+
# temp
52+
tmp/
53+
temp/
54+
55+
# secrets
56+
secrets/
57+
*.key
58+
*.pem

.idea/.gitignore

Lines changed: 0 additions & 10 deletions
This file was deleted.

.idea/misc.xml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.idea/project-backend-alfs.iml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.idea/vcs.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# The ALFS Whistleblower Ticket System
2+
3+
## A secure case management system built with Spring Boot for handling whistleblower reports.
4+
The system allows anonymous reporting, secure file uploads, role-based access control, and full audit logging.
5+
6+
### Logs should look like this:
7+
```text
8+
action = HANDLER_ASSIGNED
9+
fieldName = assignedHandler
10+
oldValue = null
11+
newValue = userId:5
12+
createdAt = 2026-03-27
13+
```
14+

pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@
8787
<artifactId>spring-boot-starter-webmvc-test</artifactId>
8888
<scope>test</scope>
8989
</dependency>
90+
<dependency>
91+
<groupId>org.springframework.boot</groupId>
92+
<artifactId>spring-boot-starter-data-jpa</artifactId>
93+
</dependency>
9094
</dependencies>
9195

9296
<build>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.example.alfs;
2+
3+
public enum Role {
4+
REPORTER,
5+
INVESTIGATOR,
6+
ADMIN
7+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package org.example.alfs.entities;
2+
3+
import jakarta.persistence.*;
4+
import lombok.*;
5+
6+
import java.time.LocalDateTime;
7+
8+
/*
9+
Represent a file uploaded with Ticket.
10+
Stores metadata about the file and the file reference s3key.
11+
*/
12+
@Entity
13+
@Getter
14+
@Setter
15+
@AllArgsConstructor
16+
@NoArgsConstructor
17+
public class Attachment {
18+
19+
@Id
20+
@GeneratedValue
21+
private Long id;
22+
23+
private String fileName;
24+
25+
private String s3Key;
26+
27+
private LocalDateTime uploadedAt;
28+
29+
@PrePersist
30+
public void prePersist() {
31+
uploadedAt = LocalDateTime.now();
32+
}
33+
34+
@ManyToOne
35+
private Ticket ticket;
36+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package org.example.alfs.entities;
2+
3+
import jakarta.persistence.*;
4+
import lombok.*;
5+
6+
import java.time.LocalDateTime;
7+
8+
/*
9+
Represents audit log for Ticket.
10+
Logs all events such as status change, assignment and comments.
11+
Should be written automatically.
12+
*/
13+
@Entity
14+
@Table(name = "audit_log")
15+
@Getter
16+
@Setter
17+
@NoArgsConstructor
18+
@AllArgsConstructor
19+
public class AuditLog {
20+
21+
@Id
22+
@GeneratedValue
23+
private Long id;
24+
25+
private String action;
26+
27+
private String fieldName;
28+
29+
@Column(length = 4000)
30+
private String oldValue;
31+
32+
@Column(length = 4000)
33+
private String newValue;
34+
35+
private LocalDateTime createdAt;
36+
37+
@PrePersist
38+
public void prePersist() {
39+
createdAt = LocalDateTime.now();
40+
}
41+
42+
@ManyToOne(fetch = FetchType.LAZY)
43+
@JoinColumn(name = "ticket_id")
44+
private Ticket ticket;
45+
46+
@ManyToOne(fetch = FetchType.LAZY)
47+
@JoinColumn(name = "user_id")
48+
private User user;
49+
}

0 commit comments

Comments
 (0)