Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package org.example.cyberwatch.features.form.model;

import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;

// Represents a file attachment linked to a case.
// Stores only metadata and S3-key (actual file in cloud storage).
// Access controlled per case authorization.
@Getter
@Setter
@Entity
public class Attachment {

Expand Down Expand Up @@ -34,62 +38,7 @@ public class Attachment {
@JoinColumn(name = "report_form_id", nullable = false)
ReportForm reportForm;

public Attachment() {
}

public String getContentType() {
return contentType;
}

public void setContentType(String contentType) {
this.contentType = contentType;
}

public String getFileName() {
return fileName;
}

public void setFileName(String fileName) {
this.fileName = fileName;
}

public Long getFileSize() {
return fileSize;
}

public void setFileSize(Long fileSize) {
this.fileSize = fileSize;
}

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public ReportForm getReportForm() {
return reportForm;
}

public void setReportForm(ReportForm reportForm) {
this.reportForm = reportForm;
}

public String getS3Key() {
return s3Key;
}

public void setS3Key(String s3Key) {
this.s3Key = s3Key;
}

public LocalDateTime getUploadDate() {
return uploadDate;
}

public void setUploadDate(LocalDateTime uploadDate) {
this.uploadDate = uploadDate;
public Attachment() {
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
package org.example.cyberwatch.features.form.model;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import org.example.cyberwatch.features.staff.model.Staff;
import org.example.cyberwatch.shared.model.enums.Department;
import org.example.cyberwatch.shared.model.enums.IssueType;
import org.example.cyberwatch.shared.model.enums.Priority;
import org.example.cyberwatch.shared.model.enums.Status;

import java.time.LocalDateTime;
import java.util.HashSet;
import java.util.Set;

@Getter
@Setter
@Entity
public class ReportForm {

Expand All @@ -32,82 +40,20 @@ public class ReportForm {
@Enumerated(EnumType.STRING)
IssueType issueType;

public ReportForm() {

}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public LocalDateTime getIssueFound() {
return issueFound;
}

public void setIssueFound(LocalDateTime issueFound) {
this.issueFound = issueFound;
}

public IssueType getIssueType() {
return issueType;
}

public void setIssueType(IssueType issueType) {
this.issueType = issueType;
}

public Priority getPriority() {
return priority;
}

public void setPriority(Priority priority) {
this.priority = priority;
}

public LocalDateTime getReportDate() {
return reportDate;
}

public void setReportDate(LocalDateTime reportDate) {
this.reportDate = reportDate;
}

public Status getStatus() {
return status;
}

public void setStatus(Status status) {
this.status = status;
}
@Enumerated(EnumType.STRING)
Department department;

public String getTitle() {
return title;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "staff_id", nullable = false)
@NotNull(message = "Staff cannot be null")
private Staff staff;
Comment thread
coderabbitai[bot] marked this conversation as resolved.

public void setTitle(String title) {
this.title = title;
}
@OneToMany(mappedBy = "reportForm", cascade = CascadeType.ALL, orphanRemoval = true)
@OrderColumn(name = "attachment_order")
private Set<Attachment> attachments = new HashSet<>();

@Enumerated(EnumType.STRING)
Department department;
public ReportForm() {

public Department getDepartment() {
return department;
}

public void setDepartment(Department department) {
this.department = department;
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package org.example.cyberwatch.features.staff.model;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import org.example.cyberwatch.shared.model.enums.Department;

// Represents a consultant/regular employee role profile linked 1:1 to Staff.
// Can create ReportForm, add comments and upload files to assigned cases.
@Getter
@Setter
@Entity
public class Consultant {

Expand All @@ -14,35 +19,14 @@ public class Consultant {

@OneToOne(optional = false)
@JoinColumn(name = "staff_id", nullable = false, unique = true)
@NotNull(message = "Staff cannot be null")
Staff staff;

@Enumerated(EnumType.STRING)
@NotNull(message = "Department cannot be null")
Department department;

public Consultant() {
}

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public Staff getStaff() {
return staff;
}

public void setStaff(Staff staff) {
this.staff = staff;
}

public Department getDepartment() {
return department;
}

public void setDepartment(Department department) {
this.department = department;
}
}
30 changes: 7 additions & 23 deletions src/main/java/org/example/cyberwatch/features/staff/model/HR.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package org.example.cyberwatch.features.staff.model;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import org.example.cyberwatch.shared.model.enums.Department;

// Represents an HR administrator role profile linked 1:1 to Staff.
// Can create EmploymentForm for new hires and manage case assignments (HR-only privilege).
@Getter
@Setter
@Entity
public class HR {
@Id
Expand All @@ -13,35 +18,14 @@ public class HR {

@OneToOne(optional = false)
@JoinColumn(name = "staff_id", nullable = false, unique = true)
@NotNull(message = "Staff cannot be null")
Staff staff;

@Enumerated(EnumType.STRING)
@NotNull(message = "Department cannot be null")
Department department;
Comment thread
coderabbitai[bot] marked this conversation as resolved.

public HR() {
}

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public Staff getStaff() {
return staff;
}

public void setStaff(Staff staff) {
this.staff = staff;
}

public Department getDepartment() {
return department;
}

public void setDepartment(Department department) {
this.department = department;
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package org.example.cyberwatch.features.staff.model;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import org.example.cyberwatch.shared.model.enums.Department;

// Represents a manager/supervisor role, role profile linked 1:1 to a Staff entity.
// Can approve and oversee cases assigned to their department.
@Getter
@Setter
@Entity
public class Management {

Expand All @@ -14,35 +19,14 @@ public class Management {

@OneToOne(optional = false)
@JoinColumn(name = "staff_id", nullable = false, unique = true)
@NotNull(message = "Staff cannot be null")
Staff staff;

@Enumerated(EnumType.STRING)
@NotNull(message = "Department cannot be null")
Department department;
Comment thread
coderabbitai[bot] marked this conversation as resolved.

public Management() {
}

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public Staff getStaff() {
return staff;
}

public void setStaff(Staff staff) {
this.staff = staff;
}

public Department getDepartment() {
return department;
}

public void setDepartment(Department department) {
this.department = department;
}
}
Loading