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
25 changes: 10 additions & 15 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,22 @@
name: Java CI with Maven

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'temurin'
cache: maven

# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
- name: Build
run: mvn -B package
2 changes: 2 additions & 0 deletions src/main/java/org/example/alfs/entities/Attachment.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ public class Attachment {
@GeneratedValue
private Long id;

@Column(nullable = false)
private String fileName;

@Column(nullable = false)
private String s3Key;

private LocalDateTime uploadedAt;
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/example/alfs/entities/AuditLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import jakarta.persistence.*;
import lombok.*;
import org.example.alfs.enums.AuditAction;

import java.time.LocalDateTime;

Expand All @@ -22,7 +23,9 @@ public class AuditLog {
@GeneratedValue
private Long id;

private String action;
@Enumerated(EnumType.STRING)
@Column(nullable = false, length = 50)
private AuditAction action;

private String fieldName;

Expand Down
27 changes: 24 additions & 3 deletions src/main/java/org/example/alfs/entities/Ticket.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import jakarta.persistence.*;
import lombok.*;
import org.example.alfs.enums.TicketStatus;


import java.time.LocalDateTime;
Expand All @@ -24,25 +25,45 @@ public class Ticket {
@GeneratedValue
private Long id;

@Column(nullable = false, length = 255)
private String title;

@Lob
@Basic(fetch = FetchType.LAZY)
private String description;

private String status;
@Enumerated(EnumType.STRING)
@Column(nullable = false, length = 32)
private TicketStatus status;

@Column(nullable = false, unique = true, length = 128, updatable = false)
private String reporterToken;

private LocalDateTime createdAt;

private LocalDateTime updatedAt;

@PrePersist
public void prePersist() {
createdAt = LocalDateTime.now();
if (status == null) {
status = TicketStatus.OPEN;
}
}

@PreUpdate
public void preUpdate() {
updatedAt = LocalDateTime.now();
}

@OneToMany(mappedBy = "ticket", cascade = CascadeType.ALL, orphanRemoval = true)
private List<Attachment> attachments;

@ManyToOne
private User assignedHandler;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "reporter_id", nullable = true) // null if anonymous
private User reporter;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "investigator_id", nullable = true)
private User investigator;
}
3 changes: 2 additions & 1 deletion src/main/java/org/example/alfs/entities/TicketComment.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
The comments are written by a User.
*/
@Entity
@Table(name="ticket_comment")
@Table(name = "ticket_comment")
@Getter
@Setter
@AllArgsConstructor
Expand All @@ -22,6 +22,7 @@ public class TicketComment {
@GeneratedValue
private Long id;

@Column(nullable = false, length = 2000)
private String message;

private LocalDateTime createdAt;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/example/alfs/entities/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import jakarta.persistence.*;
import lombok.*;
import org.example.alfs.Role;
import org.example.alfs.enums.Role;

/*
Represents a system user.
Expand All @@ -20,9 +20,10 @@ public class User {
@Id
private Long id;

@Column(nullable = false, unique = true, length = 100)
private String username;

@Column(name = "password_hash", nullable = false, length = 255)
@Column(nullable = false, length = 255)
private String passwordHash;

@Enumerated(EnumType.STRING)
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/example/alfs/enums/AuditAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.example.alfs.enums;

public enum AuditAction {
CREATED,
UPDATED,
ASSIGNED,
COMMENTED
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.example.alfs;
package org.example.alfs.enums;

public enum Role {
REPORTER,
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/example/alfs/enums/TicketStatus.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.example.alfs.enums;

public enum TicketStatus {
OPEN,
IN_PROGRESS,
RESOLVED,
CLOSED
}
Loading