mockTasks = Arrays.asList(
- new TaskDTO(1, "Task Title 1", "Task 1 description", false, "Open", LocalDate.now(), null, 1, null, TaskPriority.MEDIUM),
- new TaskDTO(2, "Task Title 2", "Task 2 description", true, "Closed", LocalDate.now(), null, 1, null, TaskPriority.MEDIUM));
+ new TaskDTO(1, "Task Title 1", "Task 1 description", false, "Open", LocalDate.now(), null, 1, null, TaskPriority.MEDIUM, null),
+ new TaskDTO(2, "Task Title 2", "Task 2 description", true, "Closed", LocalDate.now(), null, 1, null, TaskPriority.MEDIUM, null));
when(teamMemberService.getAssignedTasks(1)).thenReturn(mockTasks);
mockMvc.perform(get("/api/members/actions/1/tasks"))
diff --git a/backend/task-manager/src/test/java/com/example/task_manager/service_tests/TeamMemberServiceTest.java b/backend/task-manager/src/test/java/com/example/task_manager/service_tests/TeamMemberServiceTest.java
index 5e0fe3db..cb1fe7e5 100644
--- a/backend/task-manager/src/test/java/com/example/task_manager/service_tests/TeamMemberServiceTest.java
+++ b/backend/task-manager/src/test/java/com/example/task_manager/service_tests/TeamMemberServiceTest.java
@@ -116,7 +116,8 @@ void testEditTask() {
null,
team.getTeamId(),
null,
- TaskPriority.LOW
+ TaskPriority.LOW,
+ team.getTeamName()
);
TaskDTO updatedTask = teamMemberService.editTask(task.getTaskId(), taskDTO);
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/AdminDTO.html b/coverageTesting/jacoco/com.example.task_manager.DTO/AdminDTO.html
deleted file mode 100644
index 861c7615..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/AdminDTO.html
+++ /dev/null
@@ -1 +0,0 @@
-AdminDTO AdminDTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/AdminDTO.java.html b/coverageTesting/jacoco/com.example.task_manager.DTO/AdminDTO.java.html
deleted file mode 100644
index c15fa514..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/AdminDTO.java.html
+++ /dev/null
@@ -1,51 +0,0 @@
-AdminDTO.java AdminDTO.java package com.example.task_manager.DTO;
-
-import com.example.task_manager.enums.RoleType;
-
-public class AdminDTO {
- private int accountId;
- private String userName;
- private String userEmail;
- private RoleType role;
-
- public AdminDTO(int accountId, String userName, String userEmail, RoleType role) {
- this.accountId = accountId;
- this.userName = userName;
- this.userEmail = userEmail;
- this.role = role;
- }
-
- //getters and setters
- public int getAccountId() {
- return accountId;
- }
-
- public void setAccountId(int accountId) {
- this.accountId = accountId;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public String getUserEmail() {
- return userEmail;
- }
-
- public void setUserEmail(String userEmail) {
- this.userEmail = userEmail;
- }
-
- public RoleType getRole() {
- return role;
- }
-
- public void setRole(RoleType role) {
- this.role = role;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/AdminRequestDTO.html b/coverageTesting/jacoco/com.example.task_manager.DTO/AdminRequestDTO.html
deleted file mode 100644
index d61e742a..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/AdminRequestDTO.html
+++ /dev/null
@@ -1 +0,0 @@
-AdminRequestDTO AdminRequestDTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/AdminRequestDTO.java.html b/coverageTesting/jacoco/com.example.task_manager.DTO/AdminRequestDTO.java.html
deleted file mode 100644
index f051fdf5..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/AdminRequestDTO.java.html
+++ /dev/null
@@ -1,41 +0,0 @@
-AdminRequestDTO.java AdminRequestDTO.java package com.example.task_manager.DTO;
-
-public class AdminRequestDTO {
- private String name;
- private String email;
- private String password;
-
- public AdminRequestDTO() {}
-
- public AdminRequestDTO(String name, String email, String password) {
- this.name = name;
- this.email = email;
- this.password = password;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/AuthInfoDTO.html b/coverageTesting/jacoco/com.example.task_manager.DTO/AuthInfoDTO.html
deleted file mode 100644
index fdaca73d..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/AuthInfoDTO.html
+++ /dev/null
@@ -1 +0,0 @@
-AuthInfoDTO AuthInfoDTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/AuthInfoDTO.java.html b/coverageTesting/jacoco/com.example.task_manager.DTO/AuthInfoDTO.java.html
deleted file mode 100644
index 1d19cb74..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/AuthInfoDTO.java.html
+++ /dev/null
@@ -1,49 +0,0 @@
-AuthInfoDTO.java AuthInfoDTO.java package com.example.task_manager.DTO;
-
-import com.example.task_manager.enums.RoleType;
-
-public class AuthInfoDTO {
- private int accountId;
- private String password;
- private String userName;
- private RoleType role;
-
- public AuthInfoDTO(int accountId, String userName, RoleType role) {
- this.accountId = accountId;
- this.userName = userName;
- this.role = role;
- }
-
- public int getAccountId() {
- return accountId;
- }
-
- public void setAccountId(int accountId) {
- this.accountId = accountId;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public RoleType getRole() {
- return role;
- }
-
- public void setRole(RoleType role) {
- this.role = role;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/ChangeRoleRequestDTO.html b/coverageTesting/jacoco/com.example.task_manager.DTO/ChangeRoleRequestDTO.html
deleted file mode 100644
index b5471d8e..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/ChangeRoleRequestDTO.html
+++ /dev/null
@@ -1 +0,0 @@
-ChangeRoleRequestDTO ChangeRoleRequestDTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/ChangeRoleRequestDTO.java.html b/coverageTesting/jacoco/com.example.task_manager.DTO/ChangeRoleRequestDTO.java.html
deleted file mode 100644
index a31b6fea..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/ChangeRoleRequestDTO.java.html
+++ /dev/null
@@ -1,23 +0,0 @@
-ChangeRoleRequestDTO.java ChangeRoleRequestDTO.java package com.example.task_manager.DTO;
-
-import com.example.task_manager.enums.RoleType;
-
-public class ChangeRoleRequestDTO {
- private RoleType role;
-
- public ChangeRoleRequestDTO() {
- }
-
- public ChangeRoleRequestDTO(RoleType role) {
- this.role = role;
- }
-
- public RoleType getRole() {
- return role;
- }
-
- public void setRole(RoleType role) {
- this.role = role;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/IsAssignedDTO.html b/coverageTesting/jacoco/com.example.task_manager.DTO/IsAssignedDTO.html
deleted file mode 100644
index ed871c63..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/IsAssignedDTO.html
+++ /dev/null
@@ -1 +0,0 @@
-IsAssignedDTO IsAssignedDTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/IsAssignedDTO.java.html b/coverageTesting/jacoco/com.example.task_manager.DTO/IsAssignedDTO.java.html
deleted file mode 100644
index 57d9b7f2..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/IsAssignedDTO.java.html
+++ /dev/null
@@ -1,59 +0,0 @@
-IsAssignedDTO.java IsAssignedDTO.java package com.example.task_manager.DTO;
-
-public class IsAssignedDTO {
- private int isAssignedId;
- private int taskId;
- private int teamMemberId;
- private int teamId;
-
- public IsAssignedDTO(int isAssignedId, int taskId, int teamMemberId, int teamId) {
- this.isAssignedId = isAssignedId;
- this.taskId = taskId;
- this.teamMemberId = teamMemberId;
- this.teamId = teamId;
- }
-
- @Override
- public String toString() {
- return "IsAssignedDTO{" +
- "isAssignedId=" + isAssignedId +
- ", taskId=" + taskId +
- ", teamMemberId=" + teamMemberId +
- ", teamId=" + teamId +
- '}';
- }
-
-
- public int getIsAssignedId() {
- return isAssignedId;
- }
-
- public void setIsAssignedId(int isAssignedId) {
- this.isAssignedId = isAssignedId;
- }
-
- public int getTaskId() {
- return taskId;
- }
-
- public void setTaskId(int taskId) {
- this.taskId = taskId;
- }
-
- public int getTeamMemberId() {
- return teamMemberId;
- }
-
- public void setTeamMemberId(int teamMemberId) {
- this.teamMemberId = teamMemberId;
- }
-
- public int getTeamId() {
- return teamId;
- }
-
- public void setTeamId(int teamId) {
- this.teamId = teamId;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/IsMemberOfDTO.html b/coverageTesting/jacoco/com.example.task_manager.DTO/IsMemberOfDTO.html
deleted file mode 100644
index 9b38361d..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/IsMemberOfDTO.html
+++ /dev/null
@@ -1 +0,0 @@
-IsMemberOfDTO IsMemberOfDTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/IsMemberOfDTO.java.html b/coverageTesting/jacoco/com.example.task_manager.DTO/IsMemberOfDTO.java.html
deleted file mode 100644
index 153581cb..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/IsMemberOfDTO.java.html
+++ /dev/null
@@ -1,38 +0,0 @@
-IsMemberOfDTO.java IsMemberOfDTO.java package com.example.task_manager.DTO;
-
-public class IsMemberOfDTO {
- private int isMemberOfId;
- private int teamMemberId;
- private int teamId;
-
- public IsMemberOfDTO(int isMemberOfId, int teamMemberId, int teamId) {
- this.isMemberOfId = isMemberOfId;
- this.teamMemberId = teamMemberId;
- this.teamId = teamId;
- }
-
- public int getIsMemberOfId() {
- return isMemberOfId;
- }
-
- public void setIsMemberOfId(int isMemberOfId) {
- this.isMemberOfId = isMemberOfId;
- }
-
- public int getTeamMemberId() {
- return teamMemberId;
- }
-
- public void setTeamMemberId(int teamMemberId) {
- this.teamMemberId = teamMemberId;
- }
-
- public int getTeamId() {
- return teamId;
- }
-
- public void setTeamId(int teamId) {
- this.teamId = teamId;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/NotificationDTO.html b/coverageTesting/jacoco/com.example.task_manager.DTO/NotificationDTO.html
deleted file mode 100644
index 7909450e..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/NotificationDTO.html
+++ /dev/null
@@ -1 +0,0 @@
-NotificationDTO NotificationDTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/NotificationDTO.java.html b/coverageTesting/jacoco/com.example.task_manager.DTO/NotificationDTO.java.html
deleted file mode 100644
index 2f98f28d..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/NotificationDTO.java.html
+++ /dev/null
@@ -1,85 +0,0 @@
-NotificationDTO.java NotificationDTO.java package com.example.task_manager.DTO;
-
-import java.time.LocalDateTime;
-
-import com.example.task_manager.enums.NotificationType;
-
-public class NotificationDTO {
- private int notificationId;
- private String message;
- private NotificationType type;
- private boolean isRead;
- private LocalDateTime createdAt;
- private int teamMemberId;
- private Integer taskId;
-
- public NotificationDTO(int notificationId, String message, NotificationType type, boolean isRead,
- LocalDateTime createdAt, int teamMemberId, Integer taskId) {
- this.notificationId = notificationId;
- this.message = message;
- this.type = type;
- this.isRead = isRead;
- this.createdAt = createdAt;
- this.teamMemberId = teamMemberId;
- this.taskId = taskId;
- }
-
- public int getNotificationId() {
- return notificationId;
- }
-
- public void setNotificationId(int notificationId) {
- this.notificationId = notificationId;
- }
-
- public NotificationType getType() {
- return type;
- }
-
- public void setType(NotificationType type) {
- this.type = type;
- }
-
- public boolean isIsRead() {
- return isRead;
- }
-
- public void setIsRead(boolean isRead) {
- this.isRead = isRead;
- }
-
- public LocalDateTime getCreatedAt() {
- return createdAt;
- }
-
- public void setCreatedAt(LocalDateTime createdAt) {
- this.createdAt = createdAt;
- }
-
- public int getTeamMemberId() {
- return teamMemberId;
- }
-
- public void setTeamMemberId(int teamMemberId) {
- this.teamMemberId = teamMemberId;
- }
-
- public Integer getTaskId() {
- return taskId;
- }
-
- public void setTaskId(Integer taskId) {
- this.taskId = taskId;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
-
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/PasswordChangeRequestDTO.html b/coverageTesting/jacoco/com.example.task_manager.DTO/PasswordChangeRequestDTO.html
deleted file mode 100644
index a5554c82..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/PasswordChangeRequestDTO.html
+++ /dev/null
@@ -1 +0,0 @@
-PasswordChangeRequestDTO PasswordChangeRequestDTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/PasswordChangeRequestDTO.java.html b/coverageTesting/jacoco/com.example.task_manager.DTO/PasswordChangeRequestDTO.java.html
deleted file mode 100644
index fac63e52..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/PasswordChangeRequestDTO.java.html
+++ /dev/null
@@ -1,40 +0,0 @@
-PasswordChangeRequestDTO.java PasswordChangeRequestDTO.java package com.example.task_manager.DTO;
-
-public class PasswordChangeRequestDTO {
- private int teamMemberId;
- private String oldPassword;
- private String newPassword;
-
- public PasswordChangeRequestDTO() {}
-
- public PasswordChangeRequestDTO(int teamMemberId, String oldPassword, String newPassword) {
- this.teamMemberId = teamMemberId;
- this.oldPassword = oldPassword;
- this.newPassword = newPassword;
- }
-
- public String getOldPassword() {
- return oldPassword;
- }
-
- public void setOldPassword(String oldPassword) {
- this.oldPassword = oldPassword;
- }
-
- public String getNewPassword() {
- return newPassword;
- }
-
- public void setNewPassword(String newPassword) {
- this.newPassword = newPassword;
- }
-
- public int getTeamMemberId() {
- return teamMemberId;
- }
-
- public void setTeamMemberId(int teamMemberId) {
- this.teamMemberId = teamMemberId;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/ResetPasswordRequestDTO.html b/coverageTesting/jacoco/com.example.task_manager.DTO/ResetPasswordRequestDTO.html
deleted file mode 100644
index d53b7c84..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/ResetPasswordRequestDTO.html
+++ /dev/null
@@ -1 +0,0 @@
-ResetPasswordRequestDTO ResetPasswordRequestDTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/ResetPasswordRequestDTO.java.html b/coverageTesting/jacoco/com.example.task_manager.DTO/ResetPasswordRequestDTO.java.html
deleted file mode 100644
index 1fef72af..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/ResetPasswordRequestDTO.java.html
+++ /dev/null
@@ -1,30 +0,0 @@
-ResetPasswordRequestDTO.java ResetPasswordRequestDTO.java package com.example.task_manager.DTO;
-
-public class ResetPasswordRequestDTO {
- private int teamMemberId;
- private String newPassword;
-
- public ResetPasswordRequestDTO() {}
-
- public ResetPasswordRequestDTO(int teamMemberId, String newPassword) {
- this.teamMemberId = teamMemberId;
- this.newPassword = newPassword;
- }
-
- public String getNewPassword() {
- return newPassword;
- }
-
- public void setNewPassword(String newPassword) {
- this.newPassword = newPassword;
- }
-
- public int getTeamMemberId() {
- return teamMemberId;
- }
-
- public void setTeamMemberId(int teamMemberId) {
- this.teamMemberId = teamMemberId;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/TaskDTO.html b/coverageTesting/jacoco/com.example.task_manager.DTO/TaskDTO.html
deleted file mode 100644
index c945e3b2..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/TaskDTO.html
+++ /dev/null
@@ -1 +0,0 @@
-TaskDTO TaskDTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/TaskDTO.java.html b/coverageTesting/jacoco/com.example.task_manager.DTO/TaskDTO.java.html
deleted file mode 100644
index a30d1628..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/TaskDTO.java.html
+++ /dev/null
@@ -1,115 +0,0 @@
-TaskDTO.java TaskDTO.java package com.example.task_manager.DTO;
-
-import java.time.LocalDate;
-import java.util.List;
-import com.example.task_manager.enums.TaskPriority;
-
-public class TaskDTO {
- private int taskId;
- private String title;
- private String description;
- private boolean isLocked;
- private String status;
- private LocalDate dateCreated;
- private LocalDate dueDate;
- private int teamId;
- private TaskPriority priority;
- private List<TeamMemberDTO> assignedMembers;
-
- public TaskDTO() {}
-
- public TaskDTO(int taskId, String title, String description, boolean isLocked, String status, LocalDate dateCreated, LocalDate dueDate, int teamId, List<TeamMemberDTO> assignedMembers, TaskPriority priority) {
- this.taskId = taskId;
- this.title = title;
- this.description = description;
- this.isLocked = isLocked;
- this.status = status;
- this.dateCreated = dateCreated;
- this.dueDate = dueDate;
- this.teamId = teamId;
- this.assignedMembers = assignedMembers;
- this.priority = priority;
- }
-
- //getters and setters
- public int getTaskId() {
- return taskId;
- }
-
- public void setTaskId(int taskId) {
- this.taskId = taskId;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public boolean getIsLocked() {
- return isLocked;
- }
-
- public void setLocked(boolean isLocked) {
- this.isLocked = isLocked;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public LocalDate getDueDate() {
- return dueDate;
- }
-
- public void setDueDate(LocalDate dueDate) {
- this.dueDate = dueDate;
- }
-
- public int getTeamId() {
- return teamId;
- }
-
- public void setTeamId(int teamId) {
- this.teamId = teamId;
- }
-
- public List<TeamMemberDTO> getAssignedMembers() {
- return assignedMembers;
- }
-
- public void setAssignedMembers(List<TeamMemberDTO> assignedMembers) {
- this.assignedMembers = assignedMembers;
- }
-
- public LocalDate getDateCreated() {
- return dateCreated;
- }
-
- public void setDateCreated(LocalDate dateCreated) {
- this.dateCreated = dateCreated;
- }
-
- public TaskPriority getPriority() {
- return priority;
- }
-
- public void setPriority(TaskPriority priority) {
- this.priority = priority;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/TaskRequestDTO.html b/coverageTesting/jacoco/com.example.task_manager.DTO/TaskRequestDTO.html
deleted file mode 100644
index 6c2e7ea0..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/TaskRequestDTO.html
+++ /dev/null
@@ -1 +0,0 @@
-TaskRequestDTO TaskRequestDTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/TaskRequestDTO.java.html b/coverageTesting/jacoco/com.example.task_manager.DTO/TaskRequestDTO.java.html
deleted file mode 100644
index c395a59b..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/TaskRequestDTO.java.html
+++ /dev/null
@@ -1,94 +0,0 @@
-TaskRequestDTO.java TaskRequestDTO.java package com.example.task_manager.DTO;
-
-import java.time.LocalDate;
-import java.util.List;
-import com.example.task_manager.enums.TaskPriority;
-
-public class TaskRequestDTO {
- private String title;
- private String description;
- private Boolean isLocked;
- private String status;
- private LocalDate dueDate;
- private List<Integer> assignedTo;
- private Integer teamId;
- private TaskPriority priority;
-
- public TaskRequestDTO() {}
-
- public TaskRequestDTO(String title, String description, Boolean isLocked, String status, LocalDate dueDate, List<Integer> assignedTo, Integer teamId, TaskPriority priority) {
- this.title = title;
- this.description = description;
- this.isLocked = isLocked;
- this.status = status;
- this.dueDate = dueDate;
- this.assignedTo = assignedTo;
- this.teamId = teamId;
- this.priority = priority;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Boolean getIsLocked() {
- return isLocked;
- }
-
- public void setIsLocked(Boolean isLocked) {
- this.isLocked = isLocked;
- }
-
- public LocalDate getDueDate() {
- return dueDate;
- }
-
- public void setDueDate(LocalDate dueDate) {
- this.dueDate = dueDate;
- }
-
- public List<Integer> getAssignedTo() {
- return assignedTo;
- }
-
- public void setAssignedTo(List<Integer> assignedTo) {
- this.assignedTo = assignedTo;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public Integer getTeamId() {
- return teamId;
- }
-
- public void setTeamId(Integer teamId) {
- this.teamId = teamId;
- }
-
- public TaskPriority getPriority() {
- return priority;
- }
-
- public void setPriority(TaskPriority priority) {
- this.priority = priority;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamDTO.html b/coverageTesting/jacoco/com.example.task_manager.DTO/TeamDTO.html
deleted file mode 100644
index 1f4c4059..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamDTO.html
+++ /dev/null
@@ -1 +0,0 @@
-TeamDTO TeamDTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamDTO.java.html b/coverageTesting/jacoco/com.example.task_manager.DTO/TeamDTO.java.html
deleted file mode 100644
index ec00613e..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamDTO.java.html
+++ /dev/null
@@ -1,40 +0,0 @@
-TeamDTO.java TeamDTO.java package com.example.task_manager.DTO;
-
-public class TeamDTO {
- private int teamId;
- private String teamName;
- private int teamLeadId;
-
- public TeamDTO(){}
-
- public TeamDTO(int teamId, String teamName, int teamLeadId) {
- this.teamId = teamId;
- this.teamName = teamName;
- this.teamLeadId = teamLeadId;
- }
-
- public int getTeamId() {
- return teamId;
- }
-
- public void setTeamId(int teamId) {
- this.teamId = teamId;
- }
-
- public String getTeamName() {
- return teamName;
- }
-
- public void setTeamName(String teamName) {
- this.teamName = teamName;
- }
-
- public int getTeamLeadId() {
- return teamLeadId;
- }
-
- public void setTeamLeadId(int teamLeadId) {
- this.teamLeadId = teamLeadId;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamMemberDTO.html b/coverageTesting/jacoco/com.example.task_manager.DTO/TeamMemberDTO.html
deleted file mode 100644
index 52f4842e..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamMemberDTO.html
+++ /dev/null
@@ -1 +0,0 @@
-TeamMemberDTO TeamMemberDTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamMemberDTO.java.html b/coverageTesting/jacoco/com.example.task_manager.DTO/TeamMemberDTO.java.html
deleted file mode 100644
index 2f109209..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamMemberDTO.java.html
+++ /dev/null
@@ -1,52 +0,0 @@
-TeamMemberDTO.java TeamMemberDTO.java package com.example.task_manager.DTO;
-
-import com.example.task_manager.enums.RoleType;
-
-public class TeamMemberDTO {
- private int accountId;
- private String userName;
- private String userEmail;
- private RoleType role;
-
- public TeamMemberDTO(int accountId, String userName, String userEmail, RoleType role) {
- this.accountId = accountId;
- this.userName = userName;
- this.userEmail = userEmail;
- this.role = role;
- }
-
- //getters and setters
- public int getAccountId() {
- return accountId;
- }
-
- public void setAccountId(int accountId) {
- this.accountId = accountId;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public String getUserEmail() {
- return userEmail;
- }
-
- public void setUserEmail(String userEmail) {
- this.userEmail = userEmail;
- }
-
- public RoleType getRole() {
- return role;
- }
-
- public void setRole(RoleType role) {
- this.role = role;
- }
-
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamMemberInTeamDTO.html b/coverageTesting/jacoco/com.example.task_manager.DTO/TeamMemberInTeamDTO.html
deleted file mode 100644
index 4066000a..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamMemberInTeamDTO.html
+++ /dev/null
@@ -1 +0,0 @@
-TeamMemberInTeamDTO TeamMemberInTeamDTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamMemberInTeamDTO.java.html b/coverageTesting/jacoco/com.example.task_manager.DTO/TeamMemberInTeamDTO.java.html
deleted file mode 100644
index f2e07778..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamMemberInTeamDTO.java.html
+++ /dev/null
@@ -1,61 +0,0 @@
-TeamMemberInTeamDTO.java TeamMemberInTeamDTO.java package com.example.task_manager.DTO;
-
-import com.example.task_manager.enums.RoleType;
-
-public class TeamMemberInTeamDTO {
- private int accountId;
- private String userName;
- private String userEmail;
- private RoleType role;
- private boolean isTeamLead;
-
- public TeamMemberInTeamDTO(int accountId, String userName, String userEmail, RoleType role, boolean isTeamLead) {
- this.accountId = accountId;
- this.userName = userName;
- this.userEmail = userEmail;
- this.role = role;
- this.isTeamLead = isTeamLead;
- }
-
- //getters and setters
- public int getAccountId() {
- return accountId;
- }
-
- public void setAccountId(int accountId) {
- this.accountId = accountId;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public String getUserEmail() {
- return userEmail;
- }
-
- public void setUserEmail(String userEmail) {
- this.userEmail = userEmail;
- }
-
- public RoleType getRole() {
- return role;
- }
-
- public void setRole(RoleType role) {
- this.role = role;
- }
-
- public boolean isIsTeamLead() {
- return isTeamLead;
- }
-
- public void setIsTeamLead(boolean isTeamLead) {
- this.isTeamLead = isTeamLead;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamMemberWithTeamLeadDTO.html b/coverageTesting/jacoco/com.example.task_manager.DTO/TeamMemberWithTeamLeadDTO.html
deleted file mode 100644
index 6257243a..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamMemberWithTeamLeadDTO.html
+++ /dev/null
@@ -1 +0,0 @@
-TeamMemberWithTeamLeadDTO TeamMemberWithTeamLeadDTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamMemberWithTeamLeadDTO.java.html b/coverageTesting/jacoco/com.example.task_manager.DTO/TeamMemberWithTeamLeadDTO.java.html
deleted file mode 100644
index 3a3f7635..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamMemberWithTeamLeadDTO.java.html
+++ /dev/null
@@ -1,83 +0,0 @@
-TeamMemberWithTeamLeadDTO.java TeamMemberWithTeamLeadDTO.java package com.example.task_manager.DTO;
-
-import java.util.List;
-
-import com.example.task_manager.enums.RoleType;
-
-public class TeamMemberWithTeamLeadDTO {
- private int accountId;
- private String userName;
- private String userEmail;
- private RoleType role;
- private boolean isTeamLead;
- private List<Integer> teamLeadOfId;
- private List<String> teamLeadOfName;
-
- public TeamMemberWithTeamLeadDTO(int accountId, String userName, String userEmail, RoleType role, boolean isTeamLead, List<Integer> teamLeadOfId, List<String> teamLeadOfName) {
- this.accountId = accountId;
- this.userName = userName;
- this.userEmail = userEmail;
- this.role = role;
- this.isTeamLead = isTeamLead;
- this.teamLeadOfId = teamLeadOfId;
- this.teamLeadOfName = teamLeadOfName;
- }
-
- //getters and setters
- public int getAccountId() {
- return accountId;
- }
-
- public void setAccountId(int accountId) {
- this.accountId = accountId;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public String getUserEmail() {
- return userEmail;
- }
-
- public void setUserEmail(String userEmail) {
- this.userEmail = userEmail;
- }
-
- public RoleType getRole() {
- return role;
- }
-
- public void setRole(RoleType role) {
- this.role = role;
- }
-
- public boolean isIsTeamLead() {
- return isTeamLead;
- }
-
- public void setIsTeamLead(boolean isTeamLead) {
- this.isTeamLead = isTeamLead;
- }
-
- public List<Integer> getTeamLeadOfId() {
- return teamLeadOfId;
- }
-
- public void setTeamLeadOfId(List<Integer> teamLeadOfId) {
- this.teamLeadOfId = teamLeadOfId;
- }
-
- public List<String> getTeamLeadOfName() {
- return teamLeadOfName;
- }
-
- public void setTeamLeadOfName(List<String> teamLeadOfName) {
- this.teamLeadOfName = teamLeadOfName;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamRequestDTO.html b/coverageTesting/jacoco/com.example.task_manager.DTO/TeamRequestDTO.html
deleted file mode 100644
index 429d992a..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamRequestDTO.html
+++ /dev/null
@@ -1 +0,0 @@
-TeamRequestDTO TeamRequestDTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamRequestDTO.java.html b/coverageTesting/jacoco/com.example.task_manager.DTO/TeamRequestDTO.java.html
deleted file mode 100644
index 7891a6ea..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/TeamRequestDTO.java.html
+++ /dev/null
@@ -1,41 +0,0 @@
-TeamRequestDTO.java TeamRequestDTO.java package com.example.task_manager.DTO;
-
-public class TeamRequestDTO {
- private int teamId;
- private String teamName;
- private int teamLeadId;
-
- public TeamRequestDTO() {
- }
-
- public TeamRequestDTO(int teamId, String teamName, int teamLeadId) {
- this.teamId = teamId;
- this.teamName = teamName;
- this.teamLeadId = teamLeadId;
- }
-
- public String getTeamName() {
- return teamName;
- }
-
- public void setTeamName(String teamName) {
- this.teamName = teamName;
- }
-
- public int getTeamLeadId() {
- return teamLeadId;
- }
-
- public void setTeamLeadId(int teamLeadId) {
- this.teamLeadId = teamLeadId;
- }
-
- public int getTeamId() {
- return teamId;
- }
-
- public void setTeamId(int teamId) {
- this.teamId = teamId;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/UpdateEmailRequestDTO.html b/coverageTesting/jacoco/com.example.task_manager.DTO/UpdateEmailRequestDTO.html
deleted file mode 100644
index c489a910..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/UpdateEmailRequestDTO.html
+++ /dev/null
@@ -1 +0,0 @@
-UpdateEmailRequestDTO UpdateEmailRequestDTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/UpdateEmailRequestDTO.java.html b/coverageTesting/jacoco/com.example.task_manager.DTO/UpdateEmailRequestDTO.java.html
deleted file mode 100644
index 7e5567ef..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/UpdateEmailRequestDTO.java.html
+++ /dev/null
@@ -1,21 +0,0 @@
-UpdateEmailRequestDTO.java UpdateEmailRequestDTO.java package com.example.task_manager.DTO;
-
-public class UpdateEmailRequestDTO {
- private String newEmail;
-
- public UpdateEmailRequestDTO() {
- }
-
- public UpdateEmailRequestDTO(String newEmail) {
- this.newEmail = newEmail;
- }
-
- public String getNewEmail() {
- return newEmail;
- }
-
- public void setNewEmail(String newEmail) {
- this.newEmail = newEmail;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/UpdateNameRequestDTO.html b/coverageTesting/jacoco/com.example.task_manager.DTO/UpdateNameRequestDTO.html
deleted file mode 100644
index 5efaf2ef..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/UpdateNameRequestDTO.html
+++ /dev/null
@@ -1 +0,0 @@
-UpdateNameRequestDTO UpdateNameRequestDTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/UpdateNameRequestDTO.java.html b/coverageTesting/jacoco/com.example.task_manager.DTO/UpdateNameRequestDTO.java.html
deleted file mode 100644
index 70326127..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/UpdateNameRequestDTO.java.html
+++ /dev/null
@@ -1,21 +0,0 @@
-UpdateNameRequestDTO.java UpdateNameRequestDTO.java package com.example.task_manager.DTO;
-
-public class UpdateNameRequestDTO {
- private String newName;
-
- public UpdateNameRequestDTO() {
- }
-
- public UpdateNameRequestDTO(String newName) {
- this.newName = newName;
- }
-
- public String getNewName() {
- return newName;
- }
-
- public void setNewName(String newName) {
- this.newName = newName;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/index.html b/coverageTesting/jacoco/com.example.task_manager.DTO/index.html
deleted file mode 100644
index 38f4ae75..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/index.html
+++ /dev/null
@@ -1 +0,0 @@
-com.example.task_manager.DTO com.example.task_manager.DTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.DTO/index.source.html b/coverageTesting/jacoco/com.example.task_manager.DTO/index.source.html
deleted file mode 100644
index 4afd2b2e..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.DTO/index.source.html
+++ /dev/null
@@ -1 +0,0 @@
-com.example.task_manager.DTO com.example.task_manager.DTO
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.config/WebConfig$1.html b/coverageTesting/jacoco/com.example.task_manager.config/WebConfig$1.html
deleted file mode 100644
index 51ad2fdd..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.config/WebConfig$1.html
+++ /dev/null
@@ -1 +0,0 @@
-WebConfig.new WebMvcConfigurer() {...} WebConfig.new WebMvcConfigurer() {...} Element Missed Instructions Cov. Missed Branches Cov. Missed Cxty Missed Lines Missed Methods Total 0 of 52 100% 0 of 0 n/a 0 2 0 8 0 2 addCorsMappings(CorsRegistry) 100% n/a 0 1 0 7 0 1 {...} 100% n/a 0 1 0 1 0 1
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.config/WebConfig.html b/coverageTesting/jacoco/com.example.task_manager.config/WebConfig.html
deleted file mode 100644
index 6b73b441..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.config/WebConfig.html
+++ /dev/null
@@ -1 +0,0 @@
-WebConfig WebConfig Element Missed Instructions Cov. Missed Branches Cov. Missed Cxty Missed Lines Missed Methods Total 0 of 8 100% 0 of 0 n/a 0 2 0 2 0 2 corsConfigurer() 100% n/a 0 1 0 1 0 1 WebConfig() 100% n/a 0 1 0 1 0 1
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.config/WebConfig.java.html b/coverageTesting/jacoco/com.example.task_manager.config/WebConfig.java.html
deleted file mode 100644
index d739753f..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.config/WebConfig.java.html
+++ /dev/null
@@ -1,25 +0,0 @@
-WebConfig.java WebConfig.java package com.example.task_manager.config;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.CorsRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
-@Configuration
-public class WebConfig {
- @Bean
- public WebMvcConfigurer corsConfigurer() {
- return new WebMvcConfigurer() {
- @Override
- public void addCorsMappings(CorsRegistry corsRegistry) {
- corsRegistry.addMapping("/**")
- .allowedOrigins("http://localhost:3000", "http://localhost:3005") //frontend domain
- .allowedMethods("GET", "PUT", "POST", "DELETE")
- .allowedHeaders("*") //allows all headers
- .allowCredentials(true)
- .maxAge(3600); //CORS response has 1 hour
- }
- };
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.config/index.html b/coverageTesting/jacoco/com.example.task_manager.config/index.html
deleted file mode 100644
index 5d101242..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.config/index.html
+++ /dev/null
@@ -1 +0,0 @@
-com.example.task_manager.config com.example.task_manager.config
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.config/index.source.html b/coverageTesting/jacoco/com.example.task_manager.config/index.source.html
deleted file mode 100644
index d1f933cf..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.config/index.source.html
+++ /dev/null
@@ -1 +0,0 @@
-com.example.task_manager.config com.example.task_manager.config Element Missed Instructions Cov. Missed Branches Cov. Missed Cxty Missed Lines Missed Methods Missed Classes Total 0 of 60 100% 0 of 0 n/a 0 4 0 9 0 4 0 2 WebConfig.java 100% n/a 0 4 0 9 0 4 0 2
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/AdminAccountController.html b/coverageTesting/jacoco/com.example.task_manager.controller/AdminAccountController.html
deleted file mode 100644
index 0c1ba5ec..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/AdminAccountController.html
+++ /dev/null
@@ -1 +0,0 @@
-AdminAccountController AdminAccountController
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/AdminAccountController.java.html b/coverageTesting/jacoco/com.example.task_manager.controller/AdminAccountController.java.html
deleted file mode 100644
index 5a15891c..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/AdminAccountController.java.html
+++ /dev/null
@@ -1,88 +0,0 @@
-AdminAccountController.java AdminAccountController.java package com.example.task_manager.controller;
-
-import java.util.NoSuchElementException;
-
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-import com.example.task_manager.DTO.AdminDTO;
-import com.example.task_manager.DTO.AdminRequestDTO;
-import com.example.task_manager.DTO.UpdateEmailRequestDTO;
-import com.example.task_manager.DTO.UpdateNameRequestDTO;
-import com.example.task_manager.service.AdminService;
-
-@RestController
-@RequestMapping("/api/admins")
-public class AdminAccountController {
- private final AdminService adminService;
-
- public AdminAccountController(AdminService adminService) {
- this.adminService = adminService;
- }
-
- // Create Admin entity
- @PostMapping
- public ResponseEntity<?> createAdmin(@RequestBody AdminRequestDTO request) {
- try {
- System.out.println("enter try");
- AdminDTO createAdmin = adminService.createAdmin(
- request.getName(),
- request.getEmail(),
- request.getPassword()
- );
- return ResponseEntity.ok(createAdmin);
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- // Delete Admin
- @DeleteMapping("/{adminId}")
- public ResponseEntity<?> deleteAdmin(@PathVariable int adminId) {
- try {
- System.out.println("enter try");
- adminService.deleteAdmin(adminId);
- return ResponseEntity.noContent().build();
- } catch (Exception e) {
- return ResponseEntity.status(404).body("Admin not found");
- }
- }
-
- // Modify Admin Name
- @PutMapping("/{adminId}/name")
- public ResponseEntity<?> updateAdminName(@PathVariable int adminId, @RequestBody UpdateNameRequestDTO request) {
- try {
- System.out.println("enter try");
- AdminDTO updatedAdmin = adminService.modifyAdminName(adminId, request.getNewName());
- return ResponseEntity.ok(updatedAdmin);
- } catch (Exception e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- // Modify Admin Email
- @PutMapping("/{adminId}/email")
- public ResponseEntity<?> updateAdminEmail(@PathVariable int adminId, @RequestBody UpdateEmailRequestDTO request) {
- try {
- System.out.println("enter try");
- AdminDTO updatedAdmin = adminService.modifyAdminEmail(adminId, request.getNewEmail());
- return ResponseEntity.ok(updatedAdmin);
- } catch (NoSuchElementException e) {
- return ResponseEntity.status(404).body("Admin not found");
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- @GetMapping("/{adminId}")
- public ResponseEntity<?> getAdminById(@PathVariable int adminId) {
- try {
- System.out.println("enter try");
- AdminDTO admin = adminService.getAdminById(adminId);
- return ResponseEntity.ok(admin);
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/AdminController.html b/coverageTesting/jacoco/com.example.task_manager.controller/AdminController.html
deleted file mode 100644
index 2ca772e0..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/AdminController.html
+++ /dev/null
@@ -1 +0,0 @@
-AdminController AdminController
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/AdminController.java.html b/coverageTesting/jacoco/com.example.task_manager.controller/AdminController.java.html
deleted file mode 100644
index 7771bee8..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/AdminController.java.html
+++ /dev/null
@@ -1,93 +0,0 @@
-AdminController.java AdminController.java package com.example.task_manager.controller;
-
-import com.example.task_manager.DTO.AdminDTO;
-import com.example.task_manager.DTO.ChangeRoleRequestDTO;
-import com.example.task_manager.DTO.ResetPasswordRequestDTO;
-import com.example.task_manager.service.AdminService;
-import com.example.task_manager.service.TeamMemberService;
-
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-@RestController
-@RequestMapping("/api/admins/actions")
-public class AdminController {
-
- private final AdminService adminService;
- private final TeamMemberService teamMemberService;
-
- public AdminController(AdminService adminService, TeamMemberService teamMemberService) {
- this.adminService = adminService;
- this.teamMemberService = teamMemberService;
- }
-
- // Assign Team Member to Team
- @PostMapping("/team-member/{teamMemberId}/assign-to-team/{teamId}")
- public ResponseEntity<?> assignToTeam(@PathVariable int teamMemberId, @PathVariable int teamId) {
- try {
- return ResponseEntity.ok(adminService.assignToTeam(teamMemberId, teamId));
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- //change the role (promote/demote) of a team member
- @PostMapping("/{teamMemberId}/role")
- public ResponseEntity<?> changeRole(@PathVariable int teamMemberId, @RequestBody ChangeRoleRequestDTO request) {
- try {
- return ResponseEntity.ok(adminService.changeRole(teamMemberId, request.getRole()));
- }
- catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- // Lock Task
- @PutMapping("/tasks/{taskId}/lock")
- public ResponseEntity<?> lockTask(@PathVariable int taskId) {
- try {
- adminService.lockTask(taskId);
- return ResponseEntity.ok().build();
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- // Unlock Task
- @PutMapping("/tasks/{taskId}/unlock")
- public ResponseEntity<?> unlockTask(@PathVariable int taskId) {
- try {
- adminService.unlockTask(taskId);
- return ResponseEntity.ok().build();
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- //get all admins
- @GetMapping
- public ResponseEntity<?> getAdmins() {
- try {
- List<AdminDTO> admins = adminService.getAllAdmins();
- return ResponseEntity.ok(admins);
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- //Reset Password
- @PostMapping("/{teamMemberId}/reset-password")
- public ResponseEntity<?> resetPassword(@PathVariable int teamMemberId,
- @RequestBody ResetPasswordRequestDTO request) {
- try {
- teamMemberService.resetPassword(teamMemberId, request.getNewPassword());
- return ResponseEntity.noContent().build();
- }
- catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/AuthController.html b/coverageTesting/jacoco/com.example.task_manager.controller/AuthController.html
deleted file mode 100644
index aa898525..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/AuthController.html
+++ /dev/null
@@ -1 +0,0 @@
-AuthController AuthController
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/AuthController.java.html b/coverageTesting/jacoco/com.example.task_manager.controller/AuthController.java.html
deleted file mode 100644
index 0ef58548..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/AuthController.java.html
+++ /dev/null
@@ -1,55 +0,0 @@
-AuthController.java AuthController.java package com.example.task_manager.controller;
-
-import com.example.task_manager.DTO.AuthInfoDTO;
-import com.example.task_manager.enums.RoleType;
-import com.example.task_manager.service.AuthInfoService;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-@RestController
-@RequestMapping("/api/auth")
-public class AuthController {
-
- private final AuthInfoService authInfoService;
-
- public AuthController(AuthInfoService authInfoService) {
- this.authInfoService = authInfoService;
- }
-
- /*
- * Endpoint for authenticating a user.
- * Expects a JSON request body with `teamMemberId` and `password`.
- */
- @PostMapping("/login")
- public ResponseEntity<AuthInfoDTO> login(@RequestBody AuthInfoDTO loginRequest) {
- try {
- AuthInfoDTO authInfo = authInfoService.authenticateUser(
- loginRequest.getAccountId(),
- loginRequest.getPassword()
- );
-
- return ResponseEntity.ok(authInfo);
- } catch (RuntimeException e) {
- return ResponseEntity.status(401).body(null); // 401 Unauthorized
- }
- }
-
- /*
- * Endpoint for figuring out is a user is an admin
- * Takes `teamMemberId` as a path variable
- */
- @GetMapping("/{teamMemberId}/is-admin")
- public ResponseEntity<?> isAdmin(@PathVariable int teamMemberId) {
- try {
- RoleType role = authInfoService.isAdmin(teamMemberId);
- return ResponseEntity.ok(role);
- }
- catch (RuntimeException e) {
- if (e.getMessage().contains("not found")) {
- return ResponseEntity.status(404).body(null);
- }
- return ResponseEntity.status(500).body(null);
- }
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/IsAssignedController.html b/coverageTesting/jacoco/com.example.task_manager.controller/IsAssignedController.html
deleted file mode 100644
index b45f8d19..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/IsAssignedController.html
+++ /dev/null
@@ -1 +0,0 @@
-IsAssignedController IsAssignedController
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/IsAssignedController.java.html b/coverageTesting/jacoco/com.example.task_manager.controller/IsAssignedController.java.html
deleted file mode 100644
index c3df47ea..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/IsAssignedController.java.html
+++ /dev/null
@@ -1,44 +0,0 @@
-IsAssignedController.java IsAssignedController.java package com.example.task_manager.controller;
-
-import com.example.task_manager.service.IsAssignedService;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-
-@RestController
-@RequestMapping("/api/assignments")
-public class IsAssignedController {
-
- private final IsAssignedService isAssignedService;
-
- public IsAssignedController(IsAssignedService isAssignedService) {
- this.isAssignedService = isAssignedService;
- }
-
- // Assign a team member to a task
- @PostMapping("/{teamMemberId}/task/{taskId}")
- public ResponseEntity<?> assignToTask(@PathVariable int teamMemberId, @PathVariable int taskId) {
- try {
- return ResponseEntity.ok(isAssignedService.assignToTask(teamMemberId, taskId));
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- // Unassign a team member from a task
- @DeleteMapping("/{teamMemberId}/task/{taskId}")
- public ResponseEntity<?> unassignFromTask(@PathVariable int teamMemberId, @PathVariable int taskId) {
- try {
- return ResponseEntity.ok(isAssignedService.unassignFromTask(teamMemberId, taskId));
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- // Check if Assigned
- @GetMapping("/{teamMemberId}/task/{taskId}")
- public ResponseEntity<?> isAssignedToTask(@PathVariable int teamMemberId, @PathVariable int taskId) {
- return ResponseEntity.ok(isAssignedService.isAssignedToTask(teamMemberId, taskId));
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/IsMemberOfController.html b/coverageTesting/jacoco/com.example.task_manager.controller/IsMemberOfController.html
deleted file mode 100644
index 6bd38174..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/IsMemberOfController.html
+++ /dev/null
@@ -1 +0,0 @@
-IsMemberOfController IsMemberOfController
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/IsMemberOfController.java.html b/coverageTesting/jacoco/com.example.task_manager.controller/IsMemberOfController.java.html
deleted file mode 100644
index 52e9cf71..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/IsMemberOfController.java.html
+++ /dev/null
@@ -1,44 +0,0 @@
-IsMemberOfController.java IsMemberOfController.java package com.example.task_manager.controller;
-
-import com.example.task_manager.service.IsMemberOfService;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-
-@RestController
-@RequestMapping("/api/memberships")
-public class IsMemberOfController {
-
- private final IsMemberOfService isMemberOfService;
-
- public IsMemberOfController(IsMemberOfService isMemberOfService) {
- this.isMemberOfService = isMemberOfService;
- }
-
- // Add Member to a Team
- @PostMapping("/{teamMemberId}/team/{teamId}")
- public ResponseEntity<?> addMemberToTeam(@PathVariable int teamMemberId, @PathVariable int teamId) {
- try {
- return ResponseEntity.ok(isMemberOfService.addMemberToTeam(teamMemberId, teamId));
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- // Remove Member from Team
- @DeleteMapping("/{teamMemberId}/team/{teamId}")
- public ResponseEntity<?> removeMemberFromTeam(@PathVariable int teamMemberId, @PathVariable int teamId) {
- try {
- return ResponseEntity.ok(isMemberOfService.removeMemberFromTeam(teamMemberId, teamId));
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- // Check if Member of Team
- @GetMapping("/{teamMemberId}/team/{teamId}")
- public ResponseEntity<?> isMemberOfTeam(@PathVariable int teamMemberId, @PathVariable int teamId) {
- return ResponseEntity.ok(isMemberOfService.isMemberOfTeam(teamMemberId, teamId));
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/NotificationController.html b/coverageTesting/jacoco/com.example.task_manager.controller/NotificationController.html
deleted file mode 100644
index 9ebb83e6..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/NotificationController.html
+++ /dev/null
@@ -1 +0,0 @@
-NotificationController NotificationController
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/NotificationController.java.html b/coverageTesting/jacoco/com.example.task_manager.controller/NotificationController.java.html
deleted file mode 100644
index 3878a554..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/NotificationController.java.html
+++ /dev/null
@@ -1,74 +0,0 @@
-NotificationController.java NotificationController.java package com.example.task_manager.controller;
-
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-import com.example.task_manager.service.NotificationService;
-
-@RestController
-@RequestMapping("/api/notifications")
-public class NotificationController {
-
- private NotificationService notifService;
-
- public NotificationController(NotificationService notifService) {
- this.notifService = notifService;
- }
-
- //Get all notifications marked as read for a specific team member
- @GetMapping("/{teamMemberId}/read")
- public ResponseEntity<?> getReadNotifications(@PathVariable int teamMemberId) {
- try {
- return ResponseEntity.ok(notifService.getReadNotifications(teamMemberId));
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().build();
- }
- }
-
- //Get all notifications marked as unread for a specific team member
- @GetMapping("/{teamMemberId}/unread")
- public ResponseEntity<?> getUnreadNotifications(@PathVariable int teamMemberId) {
- try {
- return ResponseEntity.ok(notifService.getUnreadNotifications(teamMemberId));
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().build();
- }
- }
-
- //Mark a specific notification as read
- @PutMapping("/{notificationId}/mark-as-read")
- public ResponseEntity<?> markAsRead(@PathVariable int notificationId) {
- try {
- notifService.markAsRead(notificationId);
- return ResponseEntity.ok("Notification marked as read.");
- }
- catch (Exception e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- //Mark a specific notification as unread
- @PutMapping("/{notificationId}/mark-as-unread")
- public ResponseEntity<?> markAsUnread(@PathVariable int notificationId) {
- try {
- notifService.markAsUnread(notificationId);
- return ResponseEntity.ok("Notification marked as unread.");
- }
- catch (Exception e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- //Delete a notification
- @DeleteMapping("/{notificationId}")
- public ResponseEntity<?> deleteNotification(@PathVariable int notificationId) {
- try {
- notifService.deleteNotification(notificationId);
- return ResponseEntity.noContent().build();
- }
- catch (Exception e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/TaskController.html b/coverageTesting/jacoco/com.example.task_manager.controller/TaskController.html
deleted file mode 100644
index 9fba662b..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/TaskController.html
+++ /dev/null
@@ -1 +0,0 @@
-TaskController TaskController
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/TaskController.java.html b/coverageTesting/jacoco/com.example.task_manager.controller/TaskController.java.html
deleted file mode 100644
index 113a7f8d..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/TaskController.java.html
+++ /dev/null
@@ -1,55 +0,0 @@
-TaskController.java TaskController.java package com.example.task_manager.controller;
-
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-import com.example.task_manager.DTO.TaskDTO;
-import com.example.task_manager.DTO.TaskRequestDTO;
-import com.example.task_manager.service.TeamMemberService;
-
-@RestController
-@RequestMapping("/api/tasks")
-public class TaskController {
-
- private final TeamMemberService teamMemberService;
-
- public TaskController(TeamMemberService teamMemberService) {
- this.teamMemberService = teamMemberService;
- }
-
- // Create a Task
- @PostMapping
- public ResponseEntity<?> createTask(@RequestBody TaskRequestDTO request) {
- try {
- TaskDTO task = teamMemberService.createTask(request);
- return ResponseEntity.ok(task);
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- // Delete Task
- @DeleteMapping("/{taskId}")
- public ResponseEntity<?> deleteTask(@PathVariable int taskId) {
- try {
- teamMemberService.deleteTask(taskId);
- return ResponseEntity.noContent().build();
- } catch (Exception e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- // Edit Task
- @PutMapping("/{taskId}")
- public ResponseEntity<?> editTask(@PathVariable int taskId,
- @RequestBody TaskDTO taskDTO) {
- try {
- TaskDTO updatedTask = teamMemberService.editTask(taskId, taskDTO);
- return ResponseEntity.ok(updatedTask);
- }
- catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/TeamController.html b/coverageTesting/jacoco/com.example.task_manager.controller/TeamController.html
deleted file mode 100644
index e1141b5a..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/TeamController.html
+++ /dev/null
@@ -1 +0,0 @@
-TeamController TeamController
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/TeamController.java.html b/coverageTesting/jacoco/com.example.task_manager.controller/TeamController.java.html
deleted file mode 100644
index dfb71213..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/TeamController.java.html
+++ /dev/null
@@ -1,91 +0,0 @@
-TeamController.java TeamController.java package com.example.task_manager.controller;
-
-import com.example.task_manager.DTO.TeamDTO;
-import com.example.task_manager.DTO.TeamMemberInTeamDTO;
-import com.example.task_manager.DTO.TeamRequestDTO;
-import com.example.task_manager.service.AdminService;
-import com.example.task_manager.service.TeamService;
-
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-import com.example.task_manager.DTO.TaskDTO;
-
-@RestController
-@RequestMapping("/api/teams")
-public class TeamController {
-
- private final TeamService teamService;
- private final AdminService adminService;
-
- public TeamController(TeamService teamService, AdminService adminService) {
- this.teamService = teamService;
- this.adminService = adminService;
- }
-
- // Create a Team
- @PostMapping
- public ResponseEntity<?> createTeam(@RequestBody TeamRequestDTO request) {
- try {
- TeamDTO team = teamService.createTeam(request.getTeamName(), request.getTeamLeadId());
- return ResponseEntity.ok(team);
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- // Delete Team
- @DeleteMapping("/{teamId}")
- public ResponseEntity<?> deleteTeam(@PathVariable int teamId) {
- try {
- teamService.deleteTeam(teamId);
- return ResponseEntity.noContent().build();
- } catch (Exception e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- // Change Team Lead
- @PutMapping("/{teamId}/change-lead")
- public ResponseEntity<?> changeTeamLead(@PathVariable int teamId, @RequestBody TeamRequestDTO request) {
- try {
- TeamDTO updatedTeam = teamService.changeTeamLead(teamId, request.getTeamName(), request.getTeamLeadId());
- return ResponseEntity.ok(updatedTeam);
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- @GetMapping
- public ResponseEntity<?> getAllTeams() {
- try {
- List<TeamDTO> teams = adminService.getAllTeams();
- return ResponseEntity.ok(teams);
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- // Get team members for a specific team
- @GetMapping("/{teamId}/members")
- public ResponseEntity<List<TeamMemberInTeamDTO>> getTeamMembers(@PathVariable int teamId) {
- try {
- return ResponseEntity.ok(teamService.getTeamMembers(teamId));
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().build();
- }
- }
-
- // Get all tasks assigned to a team
- @GetMapping("/{teamId}/tasks")
- public ResponseEntity<List<TaskDTO>> getTeamTasks(@PathVariable int teamId) {
- try {
- return ResponseEntity.ok(teamService.getTeamTasks(teamId));
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().build();
- }
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/TeamMemberAccountController.html b/coverageTesting/jacoco/com.example.task_manager.controller/TeamMemberAccountController.html
deleted file mode 100644
index bbaf4e71..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/TeamMemberAccountController.html
+++ /dev/null
@@ -1 +0,0 @@
-TeamMemberAccountController TeamMemberAccountController
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/TeamMemberAccountController.java.html b/coverageTesting/jacoco/com.example.task_manager.controller/TeamMemberAccountController.java.html
deleted file mode 100644
index bcb4e19f..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/TeamMemberAccountController.java.html
+++ /dev/null
@@ -1,101 +0,0 @@
-TeamMemberAccountController.java TeamMemberAccountController.java package com.example.task_manager.controller;
-
-import java.util.List;
-import java.util.NoSuchElementException;
-
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-import com.example.task_manager.DTO.AdminRequestDTO;
-import com.example.task_manager.DTO.TeamMemberDTO;
-import com.example.task_manager.DTO.TeamMemberWithTeamLeadDTO;
-import com.example.task_manager.DTO.UpdateEmailRequestDTO;
-import com.example.task_manager.DTO.UpdateNameRequestDTO;
-import com.example.task_manager.service.AdminService;
-
-@RestController
-@RequestMapping("/api/members")
-public class TeamMemberAccountController {
- private final AdminService adminService;
-
- public TeamMemberAccountController(AdminService adminService) {
- this.adminService = adminService;
- }
-
- // Create Team Member
- @PostMapping
- public ResponseEntity<?> createTeamMember(@RequestBody AdminRequestDTO request) {
- try {
- System.out.println("enter try");
- TeamMemberDTO createTeamMember = adminService.createTeamMember(
- request.getName(),
- request.getEmail(),
- request.getPassword()
- );
- return ResponseEntity.ok(createTeamMember);
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- // Delete Team Member
- @DeleteMapping("/{teamMemberId}")
- public ResponseEntity<?> deleteTeamMember(@PathVariable int teamMemberId) {
- try {
- System.out.println("enter try");
- adminService.deleteTeamMember(teamMemberId);
- return ResponseEntity.noContent().build();
- } catch (RuntimeException e) {
- return ResponseEntity.status(404).body("Team member not found");
- }
- }
-
- // Modify Team Member Name
- @PutMapping("/{teamMemberId}/name")
- public ResponseEntity<?> modifyTeamMemberName(@PathVariable int teamMemberId, @RequestBody UpdateNameRequestDTO request) {
- try {
- System.out.println("enter try");
- return ResponseEntity.ok(adminService.modifyTeamMemberName(teamMemberId, request.getNewName()));
- } catch (Exception e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- // Modify Team Member Email
- @PutMapping("/{teamMemberId}/email")
- public ResponseEntity<?> modifyTeamMemberEmail(@PathVariable int teamMemberId, @RequestBody UpdateEmailRequestDTO request) {
- try {
- System.out.println("enter try");
- return ResponseEntity.ok(adminService.modifyTeamMemberEmail(teamMemberId, request.getNewEmail()));
- } catch (NoSuchElementException e) {
- return ResponseEntity.status(404).body("Team member not found");
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- // Get a team member's info with their ID
- @GetMapping("/{teamMemberId}")
- public ResponseEntity<?> getTeamMemberById(@PathVariable int teamMemberId) {
- try {
- System.out.println("enter try");
- TeamMemberDTO teamMember = adminService.getTeamMemberById(teamMemberId);
- return ResponseEntity.ok(teamMember);
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- //get all team members
- @GetMapping
- public ResponseEntity<?> getTeamMembers() {
- try {
- System.out.println("enter try");
- List<TeamMemberWithTeamLeadDTO> teamMembers = adminService.getAllTeamMembers();
- return ResponseEntity.ok(teamMembers);
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/TeamMemberController.html b/coverageTesting/jacoco/com.example.task_manager.controller/TeamMemberController.html
deleted file mode 100644
index 4634400e..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/TeamMemberController.html
+++ /dev/null
@@ -1 +0,0 @@
-TeamMemberController TeamMemberController
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/TeamMemberController.java.html b/coverageTesting/jacoco/com.example.task_manager.controller/TeamMemberController.java.html
deleted file mode 100644
index 11535921..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/TeamMemberController.java.html
+++ /dev/null
@@ -1,80 +0,0 @@
-TeamMemberController.java TeamMemberController.java package com.example.task_manager.controller;
-
-import com.example.task_manager.DTO.IsAssignedDTO;
-import com.example.task_manager.DTO.PasswordChangeRequestDTO;
-import com.example.task_manager.DTO.TaskDTO;
-import com.example.task_manager.DTO.TeamDTO;
-import com.example.task_manager.service.TeamMemberService;
-import com.example.task_manager.service.AdminService;
-
-import java.util.List;
-
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-@RestController
-@RequestMapping("/api/members/actions")
-public class TeamMemberController {
-
- private final TeamMemberService teamMemberService;
-
- public TeamMemberController(TeamMemberService teamMemberService) {
- this.teamMemberService = teamMemberService;
- }
-
- // Assign Member to Task
- @PostMapping("/{taskId}/assign/{teamMemberId}")
- public ResponseEntity<?> assignToTask(@PathVariable int taskId, @PathVariable int teamMemberId) {
- try {
- IsAssignedDTO assignedDTO = teamMemberService.assignToTask(taskId, teamMemberId);
- return ResponseEntity.ok(assignedDTO);
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- // Assign many members to a task
- @PostMapping("/{taskId}/mass-assign")
- public ResponseEntity<?> massAssignToTask(@PathVariable int taskId, @RequestBody List<Integer> teamMemberIds) {
- try {
- List<IsAssignedDTO> isAssignedDTOs = teamMemberService.massAssignToTask(taskId, teamMemberIds);
- return ResponseEntity.ok(isAssignedDTOs);
- }
- catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- // Change Password (Placeholder)
- @PostMapping("/{teamMemberId}/change-password")
- public ResponseEntity<?> changePassword(@PathVariable int teamMemberId,
- @RequestBody PasswordChangeRequestDTO request) {
- try {
- teamMemberService.changePassword(teamMemberId, request.getOldPassword(), request.getNewPassword());
- return ResponseEntity.noContent().build();
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- @GetMapping("/{teamMemberId}/teams")
- public ResponseEntity<?> getTeamsForMember(@PathVariable int teamMemberId) {
- try {
- List<TeamDTO> teams = teamMemberService.getTeamsForMember(teamMemberId);
- return ResponseEntity.ok(teams);
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-
- @GetMapping("/{teamMemberId}/tasks")
- public ResponseEntity<?> getAssignedTasks(@PathVariable int teamMemberId) {
- try {
- List<TaskDTO> tasks = teamMemberService.getAssignedTasks(teamMemberId);
- return ResponseEntity.ok(tasks);
- } catch (RuntimeException e) {
- return ResponseEntity.badRequest().body(e.getMessage());
- }
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/index.html b/coverageTesting/jacoco/com.example.task_manager.controller/index.html
deleted file mode 100644
index 79613c2a..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/index.html
+++ /dev/null
@@ -1 +0,0 @@
-com.example.task_manager.controller com.example.task_manager.controller
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.controller/index.source.html b/coverageTesting/jacoco/com.example.task_manager.controller/index.source.html
deleted file mode 100644
index 50829060..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.controller/index.source.html
+++ /dev/null
@@ -1 +0,0 @@
-com.example.task_manager.controller com.example.task_manager.controller
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.entity/Admin.html b/coverageTesting/jacoco/com.example.task_manager.entity/Admin.html
deleted file mode 100644
index f230bf44..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.entity/Admin.html
+++ /dev/null
@@ -1 +0,0 @@
-Admin Admin
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.entity/Admin.java.html b/coverageTesting/jacoco/com.example.task_manager.entity/Admin.java.html
deleted file mode 100644
index 3e440354..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.entity/Admin.java.html
+++ /dev/null
@@ -1,24 +0,0 @@
-Admin.java Admin.java package com.example.task_manager.entity;
-
-import com.example.task_manager.enums.RoleType;
-
-import jakarta.persistence.*;
-
-@Entity
-public class Admin extends TeamMember {
-
- public Admin() {}
-
- public Admin(String userName, String userEmail, String userPassword) {
- super(userName, userEmail, userPassword);
- this.setRole(RoleType.ADMIN);
- }
-
- public Admin(String userName, String userEmail) {
- super(userName, userEmail); // this constructor must exist in TeamMember
- this.setRole(RoleType.ADMIN);
- }
-
- //inherits all attributes from TeamMember
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.entity/AuthInfo.html b/coverageTesting/jacoco/com.example.task_manager.entity/AuthInfo.html
deleted file mode 100644
index c2821eb4..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.entity/AuthInfo.html
+++ /dev/null
@@ -1 +0,0 @@
-AuthInfo AuthInfo
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.entity/AuthInfo.java.html b/coverageTesting/jacoco/com.example.task_manager.entity/AuthInfo.java.html
deleted file mode 100644
index c6656374..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.entity/AuthInfo.java.html
+++ /dev/null
@@ -1,81 +0,0 @@
-AuthInfo.java AuthInfo.java package com.example.task_manager.entity;
-
-import jakarta.persistence.*;
-
-
-@Entity
-public class AuthInfo {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private int accountId;
-
- @Column(nullable = false)
- private String hashedPassword;
-
- @Column(nullable = false)
- private String salt;
-
- @OneToOne
- @MapsId //links AuthInfo to TeamMember using the same primary key (accountId)
- @JoinColumn(name = "accountId") //specifies the foreign key column in AuthInfo
- private TeamMember teamMember;
-
- public AuthInfo() {}
-
- public AuthInfo(String hashedPassword, String salt, TeamMember teamMember) {
- /*
- * To be used when creating a new instance of authinfo, for a team member
- * or admin whose authinfo already exists
- */
- this.hashedPassword = hashedPassword;
- this.salt = salt;
- this.teamMember = teamMember;
- }
-
- //getters and setters
- public String getHashedPassword() {
- return hashedPassword;
- }
-
- public void setHashedPassword(String hashedPassword) {
- if (hashedPassword == null || hashedPassword.trim().isEmpty()) {
- throw new IllegalArgumentException("Hashed password cannot be null or empty.");
- }
- this.hashedPassword = hashedPassword;
- }
-
- public TeamMember getTeamMember() {
- return teamMember;
- }
-
- public void setTeamMember(TeamMember teamMember) {
- // if (teamMember == null) {
- // throw new IllegalArgumentException("TeamMember cannot be null.");
- // }
- this.teamMember = teamMember;
- }
-
- public String getSalt() {
- return salt;
- }
-
- public void setSalt(String salt) {
- if (salt == null || salt.trim().isEmpty()) {
- throw new IllegalArgumentException("Salt cannot be null or empty.");
- }
- this.salt = salt;
- }
-
- public int getAccountId() {
- return accountId;
- }
-
- public void setAccountId(int accountId) {
- if (accountId < 0) {
- throw new IllegalArgumentException("Account ID cannot be negative.");
- }
- this.accountId = accountId;
- }
-
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.entity/IsAssigned.html b/coverageTesting/jacoco/com.example.task_manager.entity/IsAssigned.html
deleted file mode 100644
index e3728844..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.entity/IsAssigned.html
+++ /dev/null
@@ -1 +0,0 @@
-IsAssigned IsAssigned
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.entity/IsAssigned.java.html b/coverageTesting/jacoco/com.example.task_manager.entity/IsAssigned.java.html
deleted file mode 100644
index b2efe52a..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.entity/IsAssigned.java.html
+++ /dev/null
@@ -1,76 +0,0 @@
-IsAssigned.java IsAssigned.java package com.example.task_manager.entity;
-
-import jakarta.persistence.*;
-
-@Entity
-public class IsAssigned {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private int id;
-
- @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH, CascadeType.DETACH})
- @JoinColumn(name = "taskId", nullable = true)
- private Task task;
-
- @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH, CascadeType.DETACH})
- @JoinColumn(name = "accountId", nullable = false)
- private TeamMember teamMember;
-
- @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH, CascadeType.DETACH})
- @JoinColumn(name = "teamId", nullable = false)
- private Team team;
-
- public IsAssigned() {}
-
- public IsAssigned(Task task, TeamMember teamMember, Team team) {
- this.task = task;
- this.teamMember = teamMember;
- this.team = team;
- }
-
- // Getters & Setters
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- if (id < 0) {
- throw new IllegalArgumentException("ID cannot be less than 0.");
- }
- this.id = id;
- }
-
- public Task getTask() {
- return task;
- }
-
- public void setTask(Task task) {
- if (task == null) {
- throw new IllegalArgumentException("Task cannot be null.");
- }
- this.task = task;
- }
-
- public TeamMember getTeamMember() {
- return teamMember;
- }
-
- public void setTeamMember(TeamMember teamMember) {
- // if (teamMember == null) {
- // throw new IllegalArgumentException("TeamMember cannot be null.");
- // }
- this.teamMember = teamMember;
- }
-
- public Team getTeam() {
- return team;
- }
-
- public void setTeam(Team team) {
- if (team == null) {
- throw new IllegalArgumentException("Team cannot be null.");
- }
- this.team = team;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.entity/IsMemberOf.html b/coverageTesting/jacoco/com.example.task_manager.entity/IsMemberOf.html
deleted file mode 100644
index 1ee0d4db..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.entity/IsMemberOf.html
+++ /dev/null
@@ -1 +0,0 @@
-IsMemberOf IsMemberOf
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.entity/IsMemberOf.java.html b/coverageTesting/jacoco/com.example.task_manager.entity/IsMemberOf.java.html
deleted file mode 100644
index b2c87657..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.entity/IsMemberOf.java.html
+++ /dev/null
@@ -1,60 +0,0 @@
-IsMemberOf.java IsMemberOf.java package com.example.task_manager.entity;
-
-import jakarta.persistence.*;
-
-@Entity
-public class IsMemberOf {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private int id;
-
- @ManyToOne
- @JoinColumn(name = "accountId", nullable = false)
- private TeamMember teamMember;
-
- @ManyToOne
- @JoinColumn(name = "teamId", nullable = true)
- private Team team;
-
- public IsMemberOf() {}
-
- public IsMemberOf(TeamMember teamMember, Team team) {
- this.teamMember = teamMember;
- this.team = team;
- }
-
- //getters and setters
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- if (id < 0) {
- throw new IllegalArgumentException("ID cannot be less than 0.");
- }
- this.id = id;
- }
-
- public Team getTeam() {
- return team;
- }
-
- public void setTeam(Team team) {
- if (team == null) {
- throw new IllegalArgumentException("Team cannot be null.");
- }
- this.team = team;
- }
-
- public TeamMember getTeamMember() {
- return teamMember;
- }
-
- public void setTeamMember(TeamMember teamMember) {
- // if (teamMember == null) {
- // throw new IllegalArgumentException("TeamMember cannot be null.");
- // }
- this.teamMember = teamMember;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.entity/Notification.html b/coverageTesting/jacoco/com.example.task_manager.entity/Notification.html
deleted file mode 100644
index 0b7898b7..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.entity/Notification.html
+++ /dev/null
@@ -1 +0,0 @@
-Notification Notification
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.entity/Notification.java.html b/coverageTesting/jacoco/com.example.task_manager.entity/Notification.java.html
deleted file mode 100644
index 837ef71d..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.entity/Notification.java.html
+++ /dev/null
@@ -1,106 +0,0 @@
-Notification.java Notification.java package com.example.task_manager.entity;
-
-import java.time.LocalDateTime;
-
-import com.example.task_manager.enums.NotificationType;
-
-import jakarta.persistence.*;
-
-@Entity
-public class Notification {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private int notificationId;
-
- @Column(nullable = false)
- private String message;
-
- @Column(nullable = false, updatable = false)
- private LocalDateTime createdAt;
-
- @Column(nullable = false)
- private boolean isRead = false;
-
- @ManyToOne
- @JoinColumn(name = "task_id", nullable = true)
- private Task task;
-
- @ManyToOne
- @JoinColumn(name = "team_member_id", referencedColumnName = "accountId", nullable = false)
- private TeamMember teamMember;
-
- @Enumerated(EnumType.STRING)
- @Column(nullable = false, length = 50)
- private NotificationType type; //predefined messages, so the user does not decide what the message says
-
- @PrePersist
- protected void onCreate() {
- this.createdAt = LocalDateTime.now();
- }
-
- public Notification() {}
-
- public Notification(NotificationType type, String message, Task task, TeamMember teamMember) {
- this.type = type;
- this.message = message;
- this.task = task;
- this.teamMember = teamMember;
- }
-
- public int getNotificationId() {
- return notificationId;
- }
-
- public void setNotificationId(int notificationId) {
- this.notificationId = notificationId;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public LocalDateTime getCreatedAt() {
- return createdAt;
- }
-
- public void setCreatedAt(LocalDateTime createdAt) {
- this.createdAt = createdAt;
- }
-
- public boolean getIsRead() {
- return isRead;
- }
-
- public void setIsRead(boolean isRead) {
- this.isRead = isRead;
- }
-
- public Task getTask() {
- return task;
- }
-
- public void setTask(Task task) {
- this.task = task;
- }
-
- public TeamMember getTeamMember() {
- return teamMember;
- }
-
- public void setTeamMember(TeamMember teamMember) {
- this.teamMember = teamMember;
- }
-
- public NotificationType getType() {
- return type;
- }
-
- public void setType(NotificationType type) {
- this.type = type;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.entity/Task.html b/coverageTesting/jacoco/com.example.task_manager.entity/Task.html
deleted file mode 100644
index f1f60907..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.entity/Task.html
+++ /dev/null
@@ -1 +0,0 @@
-Task Task
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.entity/Task.java.html b/coverageTesting/jacoco/com.example.task_manager.entity/Task.java.html
deleted file mode 100644
index a50e1a36..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.entity/Task.java.html
+++ /dev/null
@@ -1,171 +0,0 @@
-Task.java Task.java package com.example.task_manager.entity;
-
-import java.time.LocalDate;
-import java.util.HashSet;
-import java.util.Set;
-import com.example.task_manager.enums.TaskPriority;
-
-import jakarta.persistence.*;
-
-@Entity
-public class Task {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private int taskId;
-
- @Column(nullable = false)
- private String title;
-
- private String description;
-
- @Column(nullable = false)
- private boolean isLocked;
-
- @Column(nullable = false)
- private String status;
-
- @Enumerated(EnumType.STRING)
- @Column(nullable = false)
- private TaskPriority priority;
-
- @Column(nullable = false)
- private LocalDate dateCreated;
-
- private LocalDate expectedCompletionDate;
- private LocalDate dueDate;
-
- @ManyToOne()
- @JoinColumn(name = "teamId", nullable = true)
- private Team team;
-
- @OneToMany(mappedBy = "task", cascade = {CascadeType.ALL}, orphanRemoval = true)
- private Set<IsAssigned> assignedMembers = new HashSet<>();
-
- public Task() {}
-
- public Task(String title, String description, Team team, boolean isLocked, String status, LocalDate dateCreated, TaskPriority priority) {
- this.title = title;
- this.description = description;
- this.team = team;
- this.isLocked = isLocked;
- this.status = status;
- this.dateCreated = dateCreated;
- this.priority = priority;
- }
-
-
- public int getTaskId() {
- return taskId;
- }
-
- public void setTaskId(int taskId) {
- if (taskId < 0) {
- throw new IllegalArgumentException("Task ID cannot be less than 0.");
- }
- this.taskId = taskId;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- if (title == null || title.trim().isEmpty()) {
- throw new IllegalArgumentException("Title cannot be empty or null.");
- }
- this.title = title;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- if (description == null || description.trim().isEmpty()) {
- throw new IllegalArgumentException("Description cannot be empty or null.");
- }
- this.description = description;
- }
-
- public boolean isLocked() {
- return isLocked;
- }
-
- public void setIsLocked(boolean isLocked) {
-
- this.isLocked = isLocked;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- if (status == null || status.trim().isEmpty()) {
- throw new IllegalArgumentException("Status cannot be empty or null.");
- }
- this.status = status;
- }
-
- public LocalDate getDateCreated() {
- return dateCreated;
- }
-
- public void setDateCreated(LocalDate dateCreated) {
- if (dateCreated == null) {
- throw new IllegalArgumentException("Date created cannot be null.");
- }
- if (dateCreated.isAfter(LocalDate.now())) {
- throw new IllegalArgumentException("Date created cannot be in the future");
- }
- this.dateCreated = dateCreated;
- }
-
- public LocalDate getExpectedCompletionDate() {
- return expectedCompletionDate;
- }
-
- public void setExpectedCompletionDate(LocalDate expectedCompletionDate) {
- this.expectedCompletionDate = expectedCompletionDate;
- }
-
- public LocalDate getDueDate() {
- return dueDate;
- }
-
- public void setDueDate(LocalDate dueDate) {
- this.dueDate = dueDate;
- }
-
- public Team getTeam() {
- return team;
- }
-
- public void setTeam(Team team) {
- if (team == null) {
- throw new IllegalArgumentException("Team cannot be null.");
- }
- this.team = team;
- }
-
- public Set<IsAssigned> getAssignedMembers() {
- return assignedMembers;
- }
-
- /*
- * If assignedMembers is null it initializes an empty set
- * There can be no members assigned, so an empty set, but it cannot be null
- */
- public void setAssignedMembers(Set<IsAssigned> assignedMembers) {
- this.assignedMembers = (assignedMembers != null) ? assignedMembers : new HashSet<>();
- }
-
- public TaskPriority getPriority() {
- return priority;
- }
-
- public void setPriority(TaskPriority priority) {
- this.priority = priority;
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.entity/Team.html b/coverageTesting/jacoco/com.example.task_manager.entity/Team.html
deleted file mode 100644
index 865bef50..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.entity/Team.html
+++ /dev/null
@@ -1 +0,0 @@
-Team Team
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.entity/Team.java.html b/coverageTesting/jacoco/com.example.task_manager.entity/Team.java.html
deleted file mode 100644
index e514264d..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.entity/Team.java.html
+++ /dev/null
@@ -1,100 +0,0 @@
-Team.java Team.java package com.example.task_manager.entity;
-
-import jakarta.persistence.*;
-
-import java.util.HashSet;
-import java.util.Set;
-
-@Entity
-public class Team {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private int teamId;
-
- @Column(nullable = false, unique = true)
- private String teamName;
-
- @ManyToOne
- @JoinColumn(name = "teamLeadId", referencedColumnName = "accountId", nullable = true)
- private TeamMember teamLead;
-
- @OneToMany(mappedBy = "team", cascade = CascadeType.ALL, orphanRemoval = true) //deleting a team removes all IsMemberOf records
- private Set<IsMemberOf> members = new HashSet<>();
-
- @OneToMany(mappedBy = "team", cascade = CascadeType.ALL, orphanRemoval = true) //deleting a team removes all its tasks
- private Set<Task> tasks = new HashSet<>();
-
- @OneToMany(mappedBy = "team", cascade = CascadeType.ALL, orphanRemoval = true) //deleting a team removes all IsAssigned records
- private Set<IsAssigned> assignedTasks = new HashSet<>();
-
- public Team() {}
-
- public Team(String teamName, TeamMember teamLead) {
- this.teamName = teamName;
- this.teamLead = teamLead;
- }
-
- //getters and setters
-
- public int getTeamId() {
- return teamId;
- }
-
- public void setTeamId(int teamId) {
- if (teamId < 0) {
- throw new IllegalArgumentException("Team ID cannot be less than 0.");
- }
- this.teamId = teamId;
- }
-
- public String getTeamName() {
- return teamName;
- }
-
- public void setTeamName(String teamName) {
- if (teamName == null || teamName.trim().isEmpty()) {
- throw new IllegalArgumentException("Team name cannot be null or empty.");
- }
- this.teamName = teamName;
- }
-
- public TeamMember getTeamLead() {
- return teamLead;
- }
-
- //Team lead CAN be empty
- public void setTeamLead(TeamMember teamLead) {
- this.teamLead = teamLead;
- }
-
- public Set<IsMemberOf> getMembers() {
- return members;
- }
-
- //members can be empty but not null
- //if members is null, an empty set is initialized
- public void setMembers(Set<IsMemberOf> members) {
- this.members = (members != null) ? members : new HashSet<>();
- }
-
- public Set<IsAssigned> getAssignedTasks() {
- return assignedTasks;
- }
-
- //assignedTasks can be empty but not null
- //if assignedTasks is null, an empty set is initialized
- public void setAssignedTasks(Set<IsAssigned> assignedTasks) {
- this.assignedTasks = (assignedTasks != null) ? assignedTasks : new HashSet<>();
- }
-
- public Set<Task> getTasks() {
- return tasks;
- }
-
- //tasks can be empty but not null
- //if tasks is null, an empty set is initialized
- public void setTasks(Set<Task> tasks) {
- this.tasks = (tasks != null) ? tasks : new HashSet<>();
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.entity/TeamMember.html b/coverageTesting/jacoco/com.example.task_manager.entity/TeamMember.html
deleted file mode 100644
index d217319d..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.entity/TeamMember.html
+++ /dev/null
@@ -1 +0,0 @@
-TeamMember TeamMember
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.entity/TeamMember.java.html b/coverageTesting/jacoco/com.example.task_manager.entity/TeamMember.java.html
deleted file mode 100644
index 61c4175d..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.entity/TeamMember.java.html
+++ /dev/null
@@ -1,148 +0,0 @@
-TeamMember.java TeamMember.java package com.example.task_manager.entity;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import com.example.task_manager.enums.RoleType;
-import com.example.task_manager.service.AuthInfoService;
-
-import jakarta.persistence.*;
-
-@Entity
-@Inheritance(strategy = InheritanceType.JOINED)
-public class TeamMember {
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private int accountId;
-
- @Column(nullable = false, unique = true)
- private String userName;
-
- @Column(nullable = false, unique = true)
- private String userEmail;
-
- @Enumerated(EnumType.STRING)
- @Column(nullable = false)
- private RoleType role;
-
- @OneToOne(mappedBy = "teamMember", cascade = CascadeType.ALL, orphanRemoval = true)
- private AuthInfo authInfo;
-
- @OneToMany(mappedBy = "teamMember", cascade = CascadeType.ALL, orphanRemoval = true)
- private Set<IsMemberOf> teams = new HashSet<>();
-
- @OneToMany(mappedBy = "teamMember", cascade = CascadeType.ALL, orphanRemoval = true)
- private Set<IsAssigned> assignedTasks = new HashSet<>();
-
- @OneToMany(mappedBy = "teamMember", cascade = CascadeType.ALL, orphanRemoval = true)
- private Set<Notification> notifications = new HashSet<>();
-
- public TeamMember() {}
-
- public TeamMember(String userName, String userEmail, String rawPassword) {
- this.userName = userName;
- this.userEmail = userEmail;
- this.role = RoleType.TEAM_MEMBER;
- String userSalt = AuthInfoService.generateSalt();
- this.authInfo = new AuthInfo(AuthInfoService.hashPassword(rawPassword, userSalt), userSalt, this);
- this.teams = new HashSet<>();
- this.assignedTasks = new HashSet<>();
- }
-
- public TeamMember(String userName, String userEmail) {
- this.userName = userName;
- this.userEmail = userEmail;
- this.role = RoleType.TEAM_MEMBER;
- this.teams = new HashSet<>();
- this.assignedTasks = new HashSet<>();
- this.notifications = new HashSet<>();
- }
-
- //getters and setters
- public int getAccountId() {
- return accountId;
- }
-
- public void setAccountId(int accountId) {
- if (accountId < 0) {
- throw new IllegalArgumentException("Account ID cannot be less than 0.");
- }
- this.accountId = accountId;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- if (userName == null || userName.trim().isEmpty()) {
- throw new IllegalArgumentException("User name cannot be null or empty.");
- }
- this.userName = userName;
- }
-
- public String getUserEmail() {
- return userEmail;
- }
-
- public void setUserEmail(String userEmail) {
- if (userEmail == null || userEmail.trim().isEmpty()) {
- throw new IllegalArgumentException("Email cannot be null or empty.");
- }
- this.userEmail = userEmail;
- }
-
- public AuthInfo getAuthInfo() {
- return authInfo;
- }
-
- public void setAuthInfo(AuthInfo authInfo) {
- // if (authInfo == null) {
- // throw new IllegalArgumentException("Auth Info cannot be null.");
- // }
- this.authInfo = authInfo;
- }
-
- public Set<IsMemberOf> getTeams() {
- return teams;
- }
-
- //teams can be empty but not null
- //if teams is null, an empty set is initialized
- public void setTeams(Set<IsMemberOf> teams) {
- this.teams = (teams != null) ? teams : new HashSet<>();
- }
-
- public Set<IsAssigned> getAssignedTasks() {
- return assignedTasks;
- }
-
- //assignedTasks can be empty but not null
- //if assignedTasks is null, an empty set is initialized
- public void setAssignedTasks(Set<IsAssigned> assignedTasks) {
- this.assignedTasks = (assignedTasks != null) ? assignedTasks : new HashSet<>();
- }
-
- public RoleType getRole() {
- return role;
- }
-
- public void setRole(RoleType role) {
- this.role = role;
- }
-
- public Set<Notification> getNotifications() {
- return notifications;
- }
-
- public void setNotifications(Set<Notification> notifications) {
- this.notifications = notifications;
- }
-
- public void addNotification(Notification notification) {
- this.notifications.add(notification);
- notification.setTeamMember(this);
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.entity/index.html b/coverageTesting/jacoco/com.example.task_manager.entity/index.html
deleted file mode 100644
index cdea9541..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.entity/index.html
+++ /dev/null
@@ -1 +0,0 @@
-com.example.task_manager.entity com.example.task_manager.entity Element Missed Instructions Cov. Missed Branches Cov. Missed Cxty Missed Lines Missed Methods Missed Classes Total 230 of 798 71% 46 of 68 32% 55 140 66 246 21 106 0 8 Task 73% 45% 13 35 10 58 2 24 0 1 Team 61% 16% 10 20 11 30 4 14 0 1 TeamMember 81% 35% 10 27 9 54 3 20 0 1 IsAssigned 42% 0% 7 13 14 24 4 10 0 1 AuthInfo 66% 40% 7 15 7 24 2 10 0 1 Notification 74% n/a 5 17 10 31 5 17 0 1 IsMemberOf 65% 25% 3 10 5 18 1 8 0 1 Admin 100% n/a 0 3 0 7 0 3 0 1
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.entity/index.source.html b/coverageTesting/jacoco/com.example.task_manager.entity/index.source.html
deleted file mode 100644
index 462d24b8..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.entity/index.source.html
+++ /dev/null
@@ -1 +0,0 @@
-com.example.task_manager.entity com.example.task_manager.entity
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.enums/NotificationType.html b/coverageTesting/jacoco/com.example.task_manager.enums/NotificationType.html
deleted file mode 100644
index 8d498fcf..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.enums/NotificationType.html
+++ /dev/null
@@ -1 +0,0 @@
-NotificationType NotificationType Element Missed Instructions Cov. Missed Branches Cov. Missed Cxty Missed Lines Missed Methods Total 0 of 57 100% 0 of 0 n/a 0 1 0 10 0 1 static {...} 100% n/a 0 1 0 10 0 1
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.enums/NotificationType.java.html b/coverageTesting/jacoco/com.example.task_manager.enums/NotificationType.java.html
deleted file mode 100644
index 2c5ca306..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.enums/NotificationType.java.html
+++ /dev/null
@@ -1,14 +0,0 @@
-NotificationType.java NotificationType.java package com.example.task_manager.enums;
-
-public enum NotificationType {
- TASK_TITLE_EDITED,
- TASK_DESCRIPTION_EDITED,
- TASK_STATUS_EDITED,
- TASK_DUE_DATE_EDITED,
- TASK_LOCK_STATUS_CHANGED,
- TASK_ASSIGNED,
- TASK_UNASSIGNED,
- TEAM_ASSIGNED,
- TEAM_UNASSIGNED
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.enums/RoleType.html b/coverageTesting/jacoco/com.example.task_manager.enums/RoleType.html
deleted file mode 100644
index 38650b73..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.enums/RoleType.html
+++ /dev/null
@@ -1 +0,0 @@
-RoleType RoleType Element Missed Instructions Cov. Missed Branches Cov. Missed Cxty Missed Lines Missed Methods Total 0 of 15 100% 0 of 0 n/a 0 1 0 3 0 1 static {...} 100% n/a 0 1 0 3 0 1
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.enums/RoleType.java.html b/coverageTesting/jacoco/com.example.task_manager.enums/RoleType.java.html
deleted file mode 100644
index 311526b7..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.enums/RoleType.java.html
+++ /dev/null
@@ -1,7 +0,0 @@
-RoleType.java RoleType.java package com.example.task_manager.enums;
-
-public enum RoleType {
- TEAM_MEMBER,
- ADMIN
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.enums/TaskPriority.html b/coverageTesting/jacoco/com.example.task_manager.enums/TaskPriority.html
deleted file mode 100644
index 556f9f4c..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.enums/TaskPriority.html
+++ /dev/null
@@ -1 +0,0 @@
-TaskPriority TaskPriority Element Missed Instructions Cov. Missed Branches Cov. Missed Cxty Missed Lines Missed Methods Total 0 of 21 100% 0 of 0 n/a 0 1 0 4 0 1 static {...} 100% n/a 0 1 0 4 0 1
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.enums/TaskPriority.java.html b/coverageTesting/jacoco/com.example.task_manager.enums/TaskPriority.java.html
deleted file mode 100644
index 5bdf75bd..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.enums/TaskPriority.java.html
+++ /dev/null
@@ -1,8 +0,0 @@
-TaskPriority.java TaskPriority.java package com.example.task_manager.enums;
-
-public enum TaskPriority {
- LOW,
- MEDIUM,
- HIGH;
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.enums/index.html b/coverageTesting/jacoco/com.example.task_manager.enums/index.html
deleted file mode 100644
index 9835f48b..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.enums/index.html
+++ /dev/null
@@ -1 +0,0 @@
-com.example.task_manager.enums com.example.task_manager.enums Element Missed Instructions Cov. Missed Branches Cov. Missed Cxty Missed Lines Missed Methods Missed Classes Total 0 of 93 100% 0 of 0 n/a 0 3 0 17 0 3 0 3 NotificationType 100% n/a 0 1 0 10 0 1 0 1 TaskPriority 100% n/a 0 1 0 4 0 1 0 1 RoleType 100% n/a 0 1 0 3 0 1 0 1
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.enums/index.source.html b/coverageTesting/jacoco/com.example.task_manager.enums/index.source.html
deleted file mode 100644
index fa1224db..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.enums/index.source.html
+++ /dev/null
@@ -1 +0,0 @@
-com.example.task_manager.enums com.example.task_manager.enums
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.service/AdminService.html b/coverageTesting/jacoco/com.example.task_manager.service/AdminService.html
deleted file mode 100644
index 496ced05..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.service/AdminService.html
+++ /dev/null
@@ -1 +0,0 @@
-AdminService AdminService Element Missed Instructions Cov. Missed Branches Cov. Missed Cxty Missed Lines Missed Methods Total 209 of 899 76% 8 of 18 55% 25 55 27 188 17 46 modifyTeamMemberEmail(int, String) 0% n/a 1 1 5 5 1 1 getAdminById(int) 0% n/a 1 1 3 3 1 1 getTeamMemberById(int) 0% n/a 1 1 4 4 1 1 promoteToAdmin(int) 87% 50% 2 3 4 30 0 1 demoteToTeamMember(int) 87% 50% 2 3 4 30 0 1 lambda$getAllAdmins$13(Admin) 0% n/a 1 1 2 2 1 1 getAllAdmins() 0% n/a 1 1 3 3 1 1 removeIfTeamLead(int) 71% 50% 1 2 2 7 0 1 changeRole(int, RoleType) 63% 75% 1 3 1 5 0 1 lambda$connectOldTasks$7(TeamMember, Task) 0% n/a 1 1 1 1 1 1 lambda$unlockTask$12(int) 0% n/a 1 1 1 1 1 1 lambda$assignToTeam$10(int) 0% n/a 1 1 1 1 1 1 lambda$connectOldTeams$8(TeamMember, Team) 0% n/a 1 1 1 1 1 1 lambda$demoteToTeamMember$6(int) 0% n/a 1 1 1 1 1 1 lambda$promoteToAdmin$5(int) 0% n/a 1 1 1 1 1 1 lambda$modifyTeamMemberEmail$4(int) 0% n/a 1 1 1 1 1 1 lambda$modifyTeamMemberName$3(int) 0% n/a 1 1 1 1 1 1 lambda$modifyAdminEmail$2(int) 0% n/a 1 1 1 1 1 1 lambda$deleteAdmin$0(int) 0% n/a 1 1 1 1 1 1 lambda$getTeamMemberById$16() 0% n/a 1 1 1 1 1 1 lambda$getAdminById$15() 0% n/a 1 1 1 1 1 1 lambda$getAllTeamMembers$17(TeamMember) 97% 50% 1 2 0 13 0 1 lambda$getAllTeams$14(Team) 93% 50% 1 2 0 4 0 1 assignToTeam(int, int) 100% n/a 0 1 0 10 0 1 clearMemberRelations(TeamMember) 100% n/a 0 1 0 13 0 1 modifyAdminName(int, String) 100% n/a 0 1 0 5 0 1 modifyAdminEmail(int, String) 100% n/a 0 1 0 5 0 1 modifyTeamMemberName(int, String) 100% n/a 0 1 0 5 0 1 AdminService(AdminRepository, TeamMemberRepository, TeamRepository, IsMemberOfRepository, TaskRepository, IsAssignedRepository, AuthInfoService, NotificationService, NotificationRepository, AuthInfoRepository) 100% n/a 0 1 0 5 0 1 createAdmin(String, String, String) 100% n/a 0 1 0 4 0 1 createTeamMember(String, String, String) 100% n/a 0 1 0 4 0 1 lockTask(int) 100% n/a 0 1 0 5 0 1 unlockTask(int) 100% n/a 0 1 0 5 0 1 deleteAdmin(int) 100% n/a 0 1 0 4 0 1 convertToDTO(Admin) 100% n/a 0 1 0 1 0 1 convertToDTO(TeamMember) 100% n/a 0 1 0 2 0 1 getAllTeamMembers() 100% n/a 0 1 0 3 0 1 getAllTeams() 100% n/a 0 1 0 3 0 1 extractTasks(TeamMember) 100% n/a 0 1 0 1 0 1 extractTeams(TeamMember) 100% n/a 0 1 0 1 0 1 connectOldTasks(TeamMember, Set) 100% n/a 0 1 0 3 0 1 connectOldTeams(TeamMember, Set) 100% n/a 0 1 0 3 0 1 deleteTeamMember(int) 100% n/a 0 1 0 2 0 1 lambda$lockTask$11(int) 100% n/a 0 1 0 1 0 1 lambda$assignToTeam$9(int) 100% n/a 0 1 0 1 0 1 lambda$modifyAdminName$1(int) 100% n/a 0 1 0 1 0 1
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.service/AdminService.java.html b/coverageTesting/jacoco/com.example.task_manager.service/AdminService.java.html
deleted file mode 100644
index 9493d5b5..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.service/AdminService.java.html
+++ /dev/null
@@ -1,394 +0,0 @@
-AdminService.java AdminService.java package com.example.task_manager.service;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.example.task_manager.DTO.AdminDTO;
-import com.example.task_manager.DTO.TeamDTO;
-import com.example.task_manager.DTO.TeamMemberDTO;
-import com.example.task_manager.DTO.TeamMemberWithTeamLeadDTO;
-import com.example.task_manager.entity.*;
-import com.example.task_manager.enums.RoleType;
-import com.example.task_manager.repository.*;
-
-import jakarta.transaction.Transactional;
-
-@Service // Marks this class as a Spring service, allowing it to be managed as a Spring bean
-@Transactional
-public class AdminService extends TeamMemberService {
-
- private final AdminRepository adminRepository;
- private final NotificationRepository notificationRepository;
- private final AuthInfoRepository authInfoRepository;
-
- // Constructor injection for required repositories
- public AdminService(AdminRepository adminRepository,
- TeamMemberRepository teamMemberRepository,
- TeamRepository teamRepository,
- IsMemberOfRepository isMemberOfRepository,
- TaskRepository taskRepository,
- IsAssignedRepository isAssignedRepository,
- AuthInfoService authInfoService,
- NotificationService notifService,
- NotificationRepository notificationRepository,
- AuthInfoRepository authInfoRepository) {
- super(teamMemberRepository, teamRepository, taskRepository, isMemberOfRepository, isAssignedRepository,
- authInfoService, notifService, notificationRepository);
- this.adminRepository = adminRepository;
- this.notificationRepository = notificationRepository;
- this.authInfoRepository = authInfoRepository;
- }
-
- // Creates and saves a new Admin entity
- public AdminDTO createAdmin(String adminName, String adminEmail, String adminPassword) {
- Admin admin = new Admin(adminName, adminEmail, adminPassword);
- admin.setRole(RoleType.ADMIN);
- admin = adminRepository.save(admin);
- return convertToDTO(admin);
- }
-
- // Deletes an Admin by ID
- public void deleteAdmin(int adminId) {
- Admin admin = adminRepository.findById(adminId)
- .orElseThrow(() -> new RuntimeException("Admin not found with ID: " + adminId));
- adminRepository.delete(admin);
- }
-
- // Updates an Admin's username
- public AdminDTO modifyAdminName(int adminId, String newAdminName) {
- Admin admin = adminRepository.findById(adminId)
- .orElseThrow(() -> new RuntimeException("Admin not found with ID: " + adminId));
-
- admin.setUserName(newAdminName);
- admin = adminRepository.save(admin);
- return convertToDTO(admin);
- }
-
- // Updates an Admin's email
- public AdminDTO modifyAdminEmail(int adminId, String newAdminEmail) {
- Admin admin = adminRepository.findById(adminId)
- .orElseThrow(() -> new RuntimeException("Admin not found with ID: " + adminId));
-
- admin.setUserEmail(newAdminEmail);
- admin = adminRepository.save(admin);
- return convertToDTO(admin);
- }
-
- // Creates and saves a new TeamMember entity
- public TeamMemberDTO createTeamMember(String userName, String userEmail, String userPassword) {
- TeamMember teamMember = new TeamMember(userName, userEmail, userPassword);
- teamMember.setRole(RoleType.TEAM_MEMBER);
- teamMember = teamMemberRepository.save(teamMember);
- return convertToDTO(teamMember);
- }
-
- // Deletes a TeamMember by ID
- public void deleteTeamMember(int accountId) {
- teamMemberRepository.deleteById(accountId);
- }
-
- // Updates a TeamMember's username
- public TeamMemberDTO modifyTeamMemberName(int userId, String newUserName) {
- TeamMember teamMember = teamMemberRepository.findById(userId)
- .orElseThrow(() -> new RuntimeException("Team Member not found with ID: " + userId));
-
- teamMember.setUserName(newUserName);
- teamMember = teamMemberRepository.save(teamMember);
- return convertToDTO(teamMember);
- }
-
- // Updates a TeamMember's email
- public TeamMemberDTO modifyTeamMemberEmail(int userId, String newUserEmail) {
- TeamMember teamMember = teamMemberRepository.findById(userId)
- .orElseThrow(() -> new RuntimeException("Team Member not found with ID: " + userId));
-
- teamMember.setUserEmail(newUserEmail);
- teamMember = teamMemberRepository.save(teamMember);
- return convertToDTO(teamMember);
- }
-
- // Changes the role of a member
- public Object changeRole(int memberId, RoleType newRole) {
- if (newRole == RoleType.TEAM_MEMBER) {
- return demoteToTeamMember(memberId);
- } else if (newRole == RoleType.ADMIN) {
- return promoteToAdmin(memberId);
- } else {
- throw new IllegalArgumentException("Unsupported role: " + newRole + "\nRoles available: \n" + RoleType.ADMIN
- + "\n" + RoleType.TEAM_MEMBER);
- }
- }
-
- @Transactional
- public AdminDTO promoteToAdmin(int teamMemberId) {
- TeamMember teamMember = teamMemberRepository.findById(teamMemberId)
- .orElseThrow(() -> new RuntimeException("Team Member not found with ID: " + teamMemberId));
-
- // Find all teams led by this member
- removeIfTeamLead(teamMemberId);
-
- // Extract info
- String oldName = teamMember.getUserName();
- String oldEmail = teamMember.getUserEmail();
- String oldHashedPassword = teamMember.getAuthInfo().getHashedPassword();
- String oldSalt = teamMember.getAuthInfo().getSalt();
-
- //extract memberships and assigned tasks
- Set<Task> oldTasks = extractTasks(teamMember);
- Set<Team> oldTeams = extractTeams(teamMember);
-
- clearMemberRelations(teamMember);
-
- // Delete old TeamMember safely
- deleteTeamMember(teamMember.getAccountId());
- teamMemberRepository.flush();
-
- // now create the new Admin safely
- Admin newAdmin = new Admin(oldName, oldEmail);
-
- Set<IsAssigned> newAssignments = connectOldTasks(newAdmin, oldTasks);
- Set<IsMemberOf> newMemberships = connectOldTeams(newAdmin, oldTeams);
-
- // Set new AuthInfo
- AuthInfo newAuthInfo = new AuthInfo();
- newAuthInfo.setHashedPassword(oldHashedPassword);
- newAuthInfo.setSalt(oldSalt);
- newAuthInfo.setTeamMember(newAdmin);
- newAdmin.setAuthInfo(newAuthInfo);
-
- // Save new Admin entity
- Admin savedAdmin = adminRepository.save(newAdmin);
-
- for (IsAssigned isAssigned : newAssignments) {
- isAssigned.setTeamMember(savedAdmin);
- }
-
- for (IsMemberOf isMemberOf : newMemberships) {
- isMemberOf.setTeamMember(savedAdmin);
- }
-
- isAssignedRepository.saveAll(newAssignments);
- isMemberOfRepository.saveAll(newMemberships);
-
- return convertToDTO(savedAdmin);
- }
-
- @Transactional
- public TeamMemberDTO demoteToTeamMember(int adminId) {
- Admin admin = adminRepository.findById(adminId)
- .orElseThrow(() -> new RuntimeException("Admin not found with ID: " + adminId));
-
- // Find all teams led by this member
- removeIfTeamLead(adminId);
-
- // Extract info
- String oldName = admin.getUserName();
- String oldEmail = admin.getUserEmail();
- String oldHashedPassword = admin.getAuthInfo().getHashedPassword();
- String oldSalt = admin.getAuthInfo().getSalt();
-
- //extract memberships and assigned tasks
- Set<Task> oldTasks = extractTasks(admin);
- Set<Team> oldTeams = extractTeams(admin);
-
- clearMemberRelations(admin);
-
- // Delete old Admin safely
- deleteAdmin(admin.getAccountId());
- adminRepository.flush();
-
- // create the new TeamMember safely
- TeamMember newTeamMember = new TeamMember(oldName, oldEmail);
-
- // Set new relationships as empty sets initially (you can add if needed)
- Set<IsAssigned> newAssignments = connectOldTasks(newTeamMember, oldTasks);
- Set<IsMemberOf> newMemberships = connectOldTeams(newTeamMember, oldTeams);
-
- // Set new AuthInfo
- AuthInfo newAuthInfo = new AuthInfo();
- newAuthInfo.setHashedPassword(oldHashedPassword);
- newAuthInfo.setSalt(oldSalt);
- newAuthInfo.setTeamMember(newTeamMember);
- newTeamMember.setAuthInfo(newAuthInfo);
-
- // Save new TeamMember entity
- TeamMember savedTeamMember = teamMemberRepository.save(newTeamMember);
-
- for (IsAssigned isAssigned : newAssignments) {
- isAssigned.setTeamMember(savedTeamMember);
- }
-
- for (IsMemberOf isMemberOf : newMemberships) {
- isMemberOf.setTeamMember(savedTeamMember);
- }
-
- isAssignedRepository.saveAll(newAssignments);
- isMemberOfRepository.saveAll(newMemberships);
-
- return convertToDTO(savedTeamMember);
- }
-
- private void removeIfTeamLead(int memberId) {
- List<Team> teamsLed = teamRepository.findByTeamLead_AccountId(memberId);
-
- for (Team team : teamsLed) {
- team.setTeamLead(null);
- }
-
- teamRepository.saveAll(teamsLed);
- teamRepository.flush();
- }
-
- private void clearMemberRelations(TeamMember member) {
- //delete and clear every relation explicitly
-
- notificationRepository.deleteAll(member.getNotifications());
- member.getNotifications().clear();
-
- isAssignedRepository.deleteAll(member.getAssignedTasks());
- member.getAssignedTasks().clear();
-
- isMemberOfRepository.deleteAll(member.getTeams());
- member.getTeams().clear();
-
- authInfoRepository.delete(member.getAuthInfo());
- member.setAuthInfo(null);
-
- notificationRepository.flush();
- isAssignedRepository.flush();
- isMemberOfRepository.flush();
- authInfoRepository.flush();
- }
-
- private Set<Task> extractTasks(TeamMember member) {
- return member.getAssignedTasks().stream().map(IsAssigned::getTask).collect(Collectors.toSet());
- }
-
- private Set<Team> extractTeams(TeamMember member) {
- return member.getTeams().stream().map(IsMemberOf::getTeam).collect(Collectors.toSet());
- }
-
- private Set<IsAssigned> connectOldTasks(TeamMember member, Set<Task> tasks) {
- return tasks.stream()
- .map(task -> new IsAssigned(task, member, task.getTeam()))
- .collect(Collectors.toSet());
- }
-
- private Set<IsMemberOf> connectOldTeams(TeamMember member, Set<Team> teams) {
- return teams.stream()
- .map(team -> new IsMemberOf(member, team))
- .collect(Collectors.toSet());
- }
-
- // Assigns a TeamMember to a Team by creating an IsMemberOf entry
- public TeamMemberDTO assignToTeam(int teamMemberId, int teamId) {
- Team team = teamRepository.findById(teamId)
- .orElseThrow(() -> new RuntimeException("Team not found with ID: " + teamId));
-
- TeamMember teamMember = teamMemberRepository.findById(teamMemberId)
- .orElseThrow(() -> new RuntimeException("Team Member not found with ID: " + teamMemberId));
-
- IsMemberOf isMemberOf = new IsMemberOf();
- isMemberOf.setTeam(team);
- isMemberOf.setTeamMember(teamMember);
-
- isMemberOfRepository.save(isMemberOf);
-
- // Ensures the association is also reflected in the TeamMember entity
- teamMember.getTeams().add(isMemberOf);
- return convertToDTO(teamMemberRepository.save(teamMember));
- }
-
- // Locks a Task by setting its isLocked property to true
- public void lockTask(int taskId) {
- Task task = taskRepository.findById(taskId)
- .orElseThrow(() -> new RuntimeException("Task not found with ID: " + taskId));
-
- task.setIsLocked(true);
- taskRepository.save(task);
- }
-
- // Unlocks a Task by setting its isLocked property to false
- public void unlockTask(int taskId) {
- Task task = taskRepository.findById(taskId)
- .orElseThrow(() -> new RuntimeException("Task not found with ID: " + taskId));
-
- task.setIsLocked(false);
- taskRepository.save(task);
- }
-
- //get all admins
- public List<AdminDTO> getAllAdmins() {
- return adminRepository.findAll().stream()
- .map(admin -> new AdminDTO(admin.getAccountId(), admin.getUserName(), admin.getUserEmail(),
- admin.getRole()))
- .collect(Collectors.toList());
- }
-
- //get all teams
- public List<TeamDTO> getAllTeams() {
- return teamRepository.findAll().stream()
- .map(team -> new TeamDTO(
- team.getTeamId(),
- team.getTeamName(),
- team.getTeamLead() != null ? team.getTeamLead().getAccountId() : -1 // 👈 use sentinel
- ))
- .collect(Collectors.toList());
- }
-
- //get a single admin
- public AdminDTO getAdminById(int adminId) {
- Admin admin = adminRepository.findById(adminId)
- .orElseThrow(() -> new RuntimeException("Admin not found"));
- return new AdminDTO(admin.getAccountId(), admin.getUserName(), admin.getUserEmail(), admin.getRole());
- }
-
- //get a single team member
- public TeamMemberDTO getTeamMemberById(int teamMemberId) {
- TeamMember teamMember = teamMemberRepository.findById(teamMemberId)
- .orElseThrow(() -> new RuntimeException("Team Member not found"));
- return new TeamMemberDTO(teamMember.getAccountId(), teamMember.getUserName(), teamMember.getUserEmail(),
- teamMember.getRole());
- }
-
- private AdminDTO convertToDTO(Admin admin) {
- return new AdminDTO(admin.getAccountId(), admin.getUserName(), admin.getUserEmail(), admin.getRole());
- }
-
- //get all team members
- public List<TeamMemberWithTeamLeadDTO> getAllTeamMembers() {
- return teamMemberRepository.findAll().stream()
- .map(teamMember -> {
- List<Team> teamLeadOf = teamRepository.findByTeamLead_AccountId(teamMember.getAccountId());
- List<Integer> teamsLedIds = teamLeadOf.stream()
- .map(Team::getTeamId)
- .collect(Collectors.toList());
- List<String> teamsLedNames = teamLeadOf.stream()
- .map(Team::getTeamName)
- .collect(Collectors.toList());
- boolean isTeamLead = !teamsLedNames.isEmpty();
-
- return new TeamMemberWithTeamLeadDTO(
- teamMember.getAccountId(),
- teamMember.getUserName(),
- teamMember.getUserEmail(),
- teamMember.getRole(),
- isTeamLead,
- teamsLedIds,
- teamsLedNames);
- })
- .collect(Collectors.toList());
- }
-
- private TeamMemberDTO convertToDTO(TeamMember teamMember) {
- return new TeamMemberDTO(teamMember.getAccountId(), teamMember.getUserName(), teamMember.getUserEmail(),
- teamMember.getRole());
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.service/AuthInfoService.html b/coverageTesting/jacoco/com.example.task_manager.service/AuthInfoService.html
deleted file mode 100644
index d901c2bb..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.service/AuthInfoService.html
+++ /dev/null
@@ -1 +0,0 @@
-AuthInfoService AuthInfoService
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.service/AuthInfoService.java.html b/coverageTesting/jacoco/com.example.task_manager.service/AuthInfoService.java.html
deleted file mode 100644
index e1531daa..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.service/AuthInfoService.java.html
+++ /dev/null
@@ -1,119 +0,0 @@
-AuthInfoService.java AuthInfoService.java package com.example.task_manager.service;
-
-import java.nio.charset.StandardCharsets;
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.generators.Argon2BytesGenerator;
-import org.bouncycastle.crypto.params.Argon2Parameters;
-//import org.springframework.security.crypto.argon2.Argon2PasswordEncoder;
-import org.springframework.stereotype.Service;
-
-import com.example.task_manager.DTO.AuthInfoDTO;
-import com.example.task_manager.entity.TeamMember;
-import com.example.task_manager.enums.RoleType;
-import com.example.task_manager.repository.TeamMemberRepository;
-
-
-@Service
-public class AuthInfoService {
-
- protected final TeamMemberRepository teamMemberRepository;
-
- // Constructor for required repositories
- public AuthInfoService(TeamMemberRepository teamMemberRepository){
- this.teamMemberRepository = teamMemberRepository;
- }
-
- public boolean approveLogin(int teamMemberId, String enteredPassword) {
- boolean isSuccess = false;
- TeamMember teamMember = teamMemberRepository.findById(teamMemberId)
- .orElseThrow(() -> new RuntimeException("Team Member not found with ID: " + teamMemberId));
- String TMHashedPassword = teamMember.getAuthInfo().getHashedPassword();
- String TMSalt = teamMember.getAuthInfo().getSalt();
- String enteredHashedPassword = hashPassword(enteredPassword, TMSalt);
- if (enteredHashedPassword.equals(TMHashedPassword)) {
- isSuccess = true;
- }
- return isSuccess;
- }
-
- public boolean approveLoginWithoutPassword(int teamMemberId, String enteredPassword) {
- boolean isSuccess = false;
-
-
-
- return isSuccess;
- }
-
- public AuthInfoDTO authenticateUser(int teamMemberId, String enteredPassword) {
- TeamMember teamMember = teamMemberRepository.findById(teamMemberId)
- .orElseThrow(() -> new RuntimeException("Team Member not found with ID: " + teamMemberId));
-
- if (!approveLogin(teamMemberId, enteredPassword)) {
- throw new RuntimeException("Invalid Credentials");
- }
-
- return new AuthInfoDTO(
- teamMember.getAccountId(),
- teamMember.getUserName(),
- teamMember.getRole()
- );
- }
-
- public RoleType isAdmin(int teamMemberId) {
- TeamMember teamMember = teamMemberRepository.findById(teamMemberId)
- .orElseThrow(() -> new RuntimeException("Team Member not found with ID: " + teamMemberId));
-
- return teamMember.getRole();
- }
-
- public static String hashPassword(String plainTextPassword, String saltString){
- /*This method takes a user and the password that the user enters to log into their
- account, and returns the password hash associated with that user and password.
- */
- if (saltString.length() != 16 || saltString == null){
- throw new RuntimeException("Invalid salt entered");
- }
- byte[] salt = saltString.getBytes(java.nio.charset.StandardCharsets.ISO_8859_1);
- int hashLength = 32;
-
- Argon2Parameters.Builder builder = new Argon2Parameters.Builder(Argon2Parameters.ARGON2_id)
- .withVersion(Argon2Parameters.ARGON2_VERSION_13)
- .withIterations(12) //number of iterations
- .withMemoryAsKB(6000) //uses this many kb or memory to hash
- .withParallelism(1) //only uses one thread to create the hash
- .withSalt(salt); //uses the salt we provide it
-
- Argon2BytesGenerator generate = new Argon2BytesGenerator();
- generate.init(builder.build());
- byte[] resultByteString = new byte[hashLength];
- generate.generateBytes(plainTextPassword.getBytes(StandardCharsets.UTF_8), resultByteString, 0, resultByteString.length);
- //generates an array of bytes as long as the hash length we specified
-
- String result = byteArrayToHexString(resultByteString);
- return result;
- }
-
- public static String byteArrayToHexString(byte[] byteArray){
- StringBuilder hexString = new StringBuilder();
- for (byte b : byteArray){
- hexString.append(String.format("%02X", b));
- }
- return hexString.toString();
- }
-
- public static String generateSalt(){
- /*
- * Uses the SecureRandom class to generate a cryptographically secure random
- * string of bytes, which is returned as a string
- */
- SecureRandom secureRandom = new SecureRandom();
- int lengthOfSalt = 16;
- byte[] saltBytes = new byte[lengthOfSalt];
- secureRandom.nextBytes(saltBytes);
- String salt = new String(saltBytes, java.nio.charset.StandardCharsets.ISO_8859_1);
- //the charset above encodes 1 byte as 1 character, unlike utf_8
- return salt.toString();
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.service/IsAssignedService.html b/coverageTesting/jacoco/com.example.task_manager.service/IsAssignedService.html
deleted file mode 100644
index 8d7a276a..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.service/IsAssignedService.html
+++ /dev/null
@@ -1 +0,0 @@
-IsAssignedService IsAssignedService
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.service/IsAssignedService.java.html b/coverageTesting/jacoco/com.example.task_manager.service/IsAssignedService.java.html
deleted file mode 100644
index 03c531fd..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.service/IsAssignedService.java.html
+++ /dev/null
@@ -1,112 +0,0 @@
-IsAssignedService.java IsAssignedService.java package com.example.task_manager.service;
-
-import org.springframework.stereotype.Service;
-
-import com.example.task_manager.DTO.IsAssignedDTO;
-import com.example.task_manager.entity.IsAssigned;
-import com.example.task_manager.entity.Task;
-import com.example.task_manager.entity.TeamMember;
-import com.example.task_manager.repository.IsAssignedRepository;
-import com.example.task_manager.repository.TaskRepository;
-import com.example.task_manager.repository.TeamMemberRepository;
-
-import jakarta.transaction.Transactional;
-
-@Service // Marks this class as a Spring service, allowing it to be injected where needed
-@Transactional
-public class IsAssignedService {
-
- private final TaskRepository taskRepository;
- private final TeamMemberRepository teamMemberRepository;
- private final IsAssignedRepository isAssignedRepository;
- private final NotificationService notifService;
-
- // Constructor injection for required repositories
- public IsAssignedService(TaskRepository taskRepository,
- TeamMemberRepository teamMemberRepository,
- IsAssignedRepository isAssignedRepository,
- NotificationService notifService) {
- this.taskRepository = taskRepository;
- this.teamMemberRepository = teamMemberRepository;
- this.isAssignedRepository = isAssignedRepository;
- this.notifService = notifService;
- }
-
- /**
- * Assigns a TeamMember to a Task.
- * Prevents duplicate assignments by checking if the member is already assigned.
- *
- * @param teamMemberId The ID of the team member to be assigned.
- * @param taskId The ID of the task to assign the member to.
- */
- public IsAssignedDTO assignToTask(int teamMemberId, int taskId) {
- Task task = taskRepository.findById(taskId)
- .orElseThrow(() -> new RuntimeException("Task not found with ID: " + taskId));
-
- TeamMember teamMember = teamMemberRepository.findById(teamMemberId)
- .orElseThrow(() -> new RuntimeException("Team Member not found with ID: " + teamMemberId));
-
- // Check if the member is already assigned to this task
- boolean alreadyAssigned = isAssignedRepository.existsByTeamMember_AccountIdAndTask_TaskId(teamMemberId, taskId);
- if (alreadyAssigned) {
- throw new RuntimeException("Team Member is already assigned to this task. No action needed.");
- }
-
- // Create assignment entry
- IsAssigned isAssigned = new IsAssigned(task, teamMember, task.getTeam());
- isAssigned = isAssignedRepository.save(isAssigned);
-
- //call notification method
- notifService.notifyTaskAssignment(teamMember, task);
-
- // Return assignment details as DTO
- return convertToDTO(isAssigned);
- }
-
- /**
- * Unassigns a TeamMember from a Task.
- * If the member is not assigned to the task, no changes are made.
- *
- * @param teamMemberId The ID of the team member to be unassigned.
- * @param taskId The ID of the task from which the member should be unassigned.
- */
- public IsAssignedDTO unassignFromTask(int teamMemberId, int taskId) {
- TeamMember teamMember = teamMemberRepository.findById(teamMemberId)
- .orElseThrow(() -> new RuntimeException("Team Member not found with ID: " + teamMemberId));
-
- Task task = taskRepository.findById(taskId)
- .orElseThrow(() -> new RuntimeException("Task not found with ID: " + taskId));
-
- // Find the existing assignment
- IsAssigned toRemove = isAssignedRepository.findByTeamMemberAndTask(teamMember, task)
- .orElseThrow(() -> new RuntimeException("Assignment not found."));
-
- isAssignedRepository.delete(toRemove);
-
- //call unassign notification method
- notifService.notifyTaskUnassignment(teamMember, task);
-
- return convertToDTO(toRemove);
- }
-
- /**
- * Checks if a TeamMember is assigned to a specific Task.
- *
- * @param teamMemberId The ID of the team member.
- * @param taskId The ID of the task.
- * @return true if the team member is assigned to the task, false otherwise.
- */
- public boolean isAssignedToTask(int teamMemberId, int taskId) {
- return isAssignedRepository.existsByTeamMember_AccountIdAndTask_TaskId(teamMemberId, taskId);
- }
-
- private IsAssignedDTO convertToDTO(IsAssigned isAssigned) {
- return new IsAssignedDTO(
- isAssigned.getId(),
- isAssigned.getTask().getTaskId(),
- isAssigned.getTeamMember().getAccountId(),
- isAssigned.getTeam().getTeamId()
- );
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.service/IsMemberOfService.html b/coverageTesting/jacoco/com.example.task_manager.service/IsMemberOfService.html
deleted file mode 100644
index 4e1a2dc0..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.service/IsMemberOfService.html
+++ /dev/null
@@ -1 +0,0 @@
-IsMemberOfService IsMemberOfService
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.service/IsMemberOfService.java.html b/coverageTesting/jacoco/com.example.task_manager.service/IsMemberOfService.java.html
deleted file mode 100644
index a86e0300..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.service/IsMemberOfService.java.html
+++ /dev/null
@@ -1,130 +0,0 @@
-IsMemberOfService.java IsMemberOfService.java package com.example.task_manager.service;
-
-import org.springframework.stereotype.Service;
-
-import com.example.task_manager.DTO.IsMemberOfDTO;
-import com.example.task_manager.entity.IsMemberOf;
-import com.example.task_manager.entity.Team;
-import com.example.task_manager.entity.TeamMember;
-import com.example.task_manager.repository.IsMemberOfRepository;
-import com.example.task_manager.repository.TeamMemberRepository;
-import com.example.task_manager.repository.TeamRepository;
-
-import jakarta.transaction.Transactional;
-
-@Service // Marks this class as a Spring service, making it eligible for dependency injection
-@Transactional
-public class IsMemberOfService {
-
- private final IsMemberOfRepository isMemberOfRepository;
- private final TeamRepository teamRepository;
- private final TeamMemberRepository teamMemberRepository;
- private final NotificationService notifService;
-
- // Constructor injection for required repositories
- public IsMemberOfService(IsMemberOfRepository isMemberOfRepository,
- TeamRepository teamRepository,
- TeamMemberRepository teamMemberRepository,
- NotificationService notifService) {
- this.isMemberOfRepository = isMemberOfRepository;
- this.teamRepository = teamRepository;
- this.teamMemberRepository = teamMemberRepository;
- this.notifService = notifService;
- }
-
- /**
- * Adds a TeamMember to a Team.
- * Prevents duplicate assignments by checking if the member is already in the team.
- *
- * @param teamMemberId The ID of the team member to be added.
- * @param teamId The ID of the team to which the member should be added.
- * @return
- */
- public IsMemberOfDTO addMemberToTeam(int teamMemberId, int teamId) {
- System.out.println("BELLO it is running yay");
-
- Team team = teamRepository.findById(teamId)
- .orElseThrow(() -> new RuntimeException("Team not found with ID: " + teamId));
-
- TeamMember teamMember = teamMemberRepository.findById(teamMemberId)
- .orElseThrow(() -> new RuntimeException("Team Member not found with ID: " + teamMemberId));
-
- System.out.println("MINIONS");
-
- // Check if the member is already in the team
- boolean alreadyMember = isMemberOfRepository.existsByTeamMemberAccountIdAndTeamTeamId(teamMemberId, teamId);
- if (alreadyMember) {
- throw new RuntimeException("Team Member is already in this team. No action needed.");
- }
-
- System.out.println("TONIGHT!!! WE! ARE GOING! TO STEAL! THE MOON!!");
-
-
- // Create membership
- IsMemberOf isMemberOf = new IsMemberOf(teamMember, team);
- isMemberOf = isMemberOfRepository.save(isMemberOf);
- isMemberOfRepository.flush();
-
- System.out.println("DOCTOR NEFARIO");
-
- team = teamRepository.findById(teamId).orElseThrow(() -> new RuntimeException("RAHHHH can't find it"));
- System.out.println("bruh");
-
- //call assigned to team notification method
- notifService.notifyTeamAssignment(teamMember, team);
-
- // Return DTO
- return convertToDTO(isMemberOf);
- }
-
- /**
- * Removes a TeamMember from a Team.
- * If the member is not part of the team, no changes are made.
- *
- * @param teamMemberId The ID of the team member to be removed.
- * @param teamId The ID of the team from which the member should be removed.
- * @return
- */
- public IsMemberOfDTO removeMemberFromTeam(int teamMemberId, int teamId) {
- Team team = teamRepository.findById(teamId)
- .orElseThrow(() -> new RuntimeException("Team not found with ID: " + teamId));
-
- TeamMember teamMember = teamMemberRepository.findById(teamMemberId)
- .orElseThrow(() -> new RuntimeException("Team Member not found with ID: " + teamMemberId));
-
- // Find the membership record
- IsMemberOf isMemberOf = isMemberOfRepository.findByTeamMemberAndTeam(teamMember, team)
- .orElseThrow(() -> new RuntimeException("Membership not found."));
-
- isMemberOfRepository.delete(isMemberOf);
-
- //call unassigned from team notification method
- notifService.notifyTeamUnassignment(teamMember, team);
-
- // Return removed membership as DTO
- return convertToDTO(isMemberOf);
- }
-
- /**
- * Checks if a TeamMember is a part of a specific Team.
- *
- * @param teamMemberId The ID of the team member.
- * @param teamId The ID of the team.
- * @return true if the team member is part of the team, false otherwise.
- */
- public boolean isMemberOfTeam(int teamMemberId, int teamId) {
- return isMemberOfRepository.existsByTeamMemberAccountIdAndTeamTeamId(teamMemberId, teamId);
- }
-
- /**
- * Converts IsMemberOf entity to IsMemberOfDTO.
- */
- private IsMemberOfDTO convertToDTO(IsMemberOf isMemberOf) {
- return new IsMemberOfDTO(
- isMemberOf.getId(),
- isMemberOf.getTeam().getTeamId(),
- isMemberOf.getTeamMember().getAccountId()
- );
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.service/NotificationService.html b/coverageTesting/jacoco/com.example.task_manager.service/NotificationService.html
deleted file mode 100644
index bebf44a2..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.service/NotificationService.html
+++ /dev/null
@@ -1 +0,0 @@
-NotificationService NotificationService Element Missed Instructions Cov. Missed Branches Cov. Missed Cxty Missed Lines Missed Methods Total 46 of 352 86% 2 of 12 83% 4 27 8 88 2 21 notifyTaskLockChange(Task, boolean) 40% 50% 1 2 4 7 0 1 notifyTaskStatusChange(Task, String) 40% 50% 1 2 4 7 0 1 lambda$markAsUnread$3() 0% n/a 1 1 1 1 1 1 lambda$markAsRead$2() 0% n/a 1 1 1 1 1 1 notifyTaskTitleChange(Task, String) 100% 100% 0 2 0 7 0 1 notifyTaskDescriptionChange(Task, String) 100% 100% 0 2 0 7 0 1 notifyTaskDueDateChange(Task, LocalDate) 100% 100% 0 2 0 7 0 1 convertToDTO(Notification) 100% 100% 0 2 0 8 0 1 getUnreadNotifications(int) 100% n/a 0 1 0 6 0 1 getReadNotifications(int) 100% n/a 0 1 0 6 0 1 createNotification(TeamMember, Task, NotificationType, String) 100% n/a 0 1 0 4 0 1 markAsRead(int) 100% n/a 0 1 0 5 0 1 markAsUnread(int) 100% n/a 0 1 0 5 0 1 NotificationService(NotificationRepository, IsAssignedRepository, TeamMemberRepository) 100% n/a 0 1 0 5 0 1 notifyTaskAssignment(TeamMember, Task) 100% n/a 0 1 0 3 0 1 notifyTaskUnassignment(TeamMember, Task) 100% n/a 0 1 0 3 0 1 notifyTeamAssignment(TeamMember, Team) 100% n/a 0 1 0 3 0 1 notifyTeamUnassignment(TeamMember, Team) 100% n/a 0 1 0 3 0 1 deleteNotification(int) 100% n/a 0 1 0 2 0 1 lambda$getReadNotifications$1() 100% n/a 0 1 0 1 0 1 lambda$getUnreadNotifications$0() 100% n/a 0 1 0 1 0 1
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.service/NotificationService.java.html b/coverageTesting/jacoco/com.example.task_manager.service/NotificationService.java.html
deleted file mode 100644
index a8f23eb9..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.service/NotificationService.java.html
+++ /dev/null
@@ -1,201 +0,0 @@
-NotificationService.java NotificationService.java package com.example.task_manager.service;
-
-import java.time.LocalDate;
-import java.util.Collection;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.springframework.stereotype.Service;
-
-import com.example.task_manager.DTO.NotificationDTO;
-import com.example.task_manager.entity.IsAssigned;
-import com.example.task_manager.entity.Notification;
-import com.example.task_manager.entity.Task;
-import com.example.task_manager.entity.Team;
-import com.example.task_manager.entity.TeamMember;
-import com.example.task_manager.enums.NotificationType;
-import com.example.task_manager.repository.IsAssignedRepository;
-import com.example.task_manager.repository.NotificationRepository;
-import com.example.task_manager.repository.TeamMemberRepository;
-
-import jakarta.transaction.Transactional;
-
-@Service
-@Transactional
-public class NotificationService {
- private final NotificationRepository notifRepository;
- private final IsAssignedRepository isAssignedRepository;
- private final TeamMemberRepository teamMemberRepository;
-
- public NotificationService(NotificationRepository notifRepository, IsAssignedRepository isAssignedRepository, TeamMemberRepository teamMemberRepository) {
- this.notifRepository = notifRepository;
- this.isAssignedRepository = isAssignedRepository;
- this.teamMemberRepository = teamMemberRepository;
- }
-
- //helper method for creating notifications
- private NotificationDTO createNotification(TeamMember teamMember, Task task, NotificationType type,
- String message) {
- Notification notif = new Notification(type, message, task, teamMember);
- teamMember.addNotification(notif);
- notifRepository.save(notif);
- return convertToDTO(notif);
- }
-
- //notify members that the task title was changed
- public void notifyTaskTitleChange(Task updatedTask, String oldTitle) {
- Collection<IsAssigned> assignedMembers = isAssignedRepository.findByTask(updatedTask);
- for (IsAssigned isAssigned : assignedMembers) {
- TeamMember teamMember = isAssigned.getTeamMember();
-
- createNotification(
- teamMember,
- updatedTask,
- NotificationType.TASK_TITLE_EDITED,
- "Task Update: The title of a task was changed from \"" + oldTitle + "\" to \"" + updatedTask.getTitle() + "\""
- );
- }
- }
-
- //notify members that the task description was changed
- public void notifyTaskDescriptionChange(Task updatedTask, String oldDescription) {
- Collection<IsAssigned> assignedMembers = isAssignedRepository.findByTask(updatedTask);
- for (IsAssigned isAssigned : assignedMembers) {
- TeamMember teamMember = isAssigned.getTeamMember();
-
- createNotification(
- teamMember,
- updatedTask,
- NotificationType.TASK_DESCRIPTION_EDITED,
- "Task Update: The description of a task was changed from \"" + oldDescription + "\" to \"" + updatedTask.getDescription() + "\""
- );
- }
- }
-
- //notify members that the task lcoked status was changed
- public void notifyTaskLockChange(Task updatedTask, boolean oldLockStatus) {
- Collection<IsAssigned> assignedMembers = isAssignedRepository.findByTask(updatedTask);
- for (IsAssigned isAssigned : assignedMembers) {
- TeamMember teamMember = isAssigned.getTeamMember();
-
- createNotification(
- teamMember,
- updatedTask,
- NotificationType.TASK_LOCK_STATUS_CHANGED,
- "Task Update: The lock status of a task was changed from \"" + oldLockStatus + "\" to \"" + updatedTask.isLocked() + "\""
- );
- }
- }
-
- //notify members that the task due date was changed
- public void notifyTaskDueDateChange(Task updatedTask, LocalDate oldDueDate) {
- Collection<IsAssigned> assignedMembers = isAssignedRepository.findByTask(updatedTask);
- for (IsAssigned isAssigned : assignedMembers) {
- TeamMember teamMember = isAssigned.getTeamMember();
-
- createNotification(
- teamMember,
- updatedTask,
- NotificationType.TASK_DUE_DATE_EDITED,
- "Task Update: The due date of a task was changed from \"" + oldDueDate + "\" to \"" + updatedTask.getDueDate()
- + "\"");
- }
- }
-
- //notify members that the task status was changed
- public void notifyTaskStatusChange(Task updatedTask, String oldStatus) {
- Collection<IsAssigned> assignedMembers = isAssignedRepository.findByTask(updatedTask);
- for (IsAssigned isAssigned : assignedMembers) {
- TeamMember teamMember = isAssigned.getTeamMember();
-
- createNotification(
- teamMember,
- updatedTask,
- NotificationType.TASK_STATUS_EDITED,
- "Task Update: The status of a task was changed from \"" + oldStatus + "\" to \"" + updatedTask.getStatus() + "\""
- );
- }
- }
-
- //notify member when task is assigned
- public void notifyTaskAssignment(TeamMember teamMember, Task task) {
- createNotification(teamMember, task, NotificationType.TASK_ASSIGNED,
- "You have been assigned to a task: \"" + task.getTitle());
- }
-
- //notify member when task is unassigned
- public void notifyTaskUnassignment(TeamMember teamMember, Task task) {
- createNotification(teamMember, task, NotificationType.TASK_UNASSIGNED,
- "You have been unassigned from a task: \"" + task.getTitle());
- }
-
- //notify member when they are added to a team
- public void notifyTeamAssignment(TeamMember teamMember, Team team) {
- createNotification(teamMember, null, NotificationType.TEAM_ASSIGNED,
- "You have been assigned to a team: \"" + team.getTeamName());
- }
-
- //notify member when they are removed from a team
- public void notifyTeamUnassignment(TeamMember teamMember, Team team) {
- createNotification(teamMember, null, NotificationType.TEAM_UNASSIGNED,
- "You have been unassigned from a team: \"" + team.getTeamName());
- }
-
- //get unread notifications for a team member
- public List<NotificationDTO> getUnreadNotifications(int teamMemberId) {
- TeamMember teamMember = teamMemberRepository.findById(teamMemberId)
- .orElseThrow(() -> new RuntimeException("TeamMember not found"));
-
- return notifRepository.findByTeamMemberIdAndIsReadFalse(teamMemberId)
- .stream()
- .map(this::convertToDTO)
- .collect(Collectors.toList());
- }
-
- //get read notifications for a team member
- public List<NotificationDTO> getReadNotifications(int teamMemberId) {
- TeamMember teamMember = teamMemberRepository.findById(teamMemberId)
- .orElseThrow(() -> new RuntimeException("TeamMember not found"));
-
- return notifRepository.findByTeamMemberIdAndIsReadTrue(teamMemberId)
- .stream()
- .map(this::convertToDTO)
- .collect(Collectors.toList());
- }
-
- //mark notification as read
- public void markAsRead(int notificationId) {
- Notification notif = notifRepository.findById(notificationId)
- .orElseThrow(() -> new RuntimeException("Notification not found."));
-
- notif.setIsRead(true);
- notifRepository.save(notif);
- }
-
- //mark notification as unread
- public void markAsUnread(int notificationId) {
- Notification notif = notifRepository.findById(notificationId)
- .orElseThrow(() -> new RuntimeException("Notification not found."));
-
- notif.setIsRead(false);
- notifRepository.save(notif);
- }
-
- //delete a notification
- public void deleteNotification(int notificationId) {
- notifRepository.deleteById(notificationId);
- }
-
- private NotificationDTO convertToDTO(Notification notification) {
- return new NotificationDTO(
- notification.getNotificationId(),
- notification.getMessage(),
- notification.getType(),
- notification.getIsRead(),
- notification.getCreatedAt(),
- notification.getTeamMember().getAccountId(),
- notification.getTask() != null ? notification.getTask().getTaskId() : null
- );
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.service/TaskService.html b/coverageTesting/jacoco/com.example.task_manager.service/TaskService.html
deleted file mode 100644
index 306eaff6..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.service/TaskService.html
+++ /dev/null
@@ -1 +0,0 @@
-TaskService TaskService Element Missed Instructions Cov. Missed Branches Cov. Missed Cxty Missed Lines Missed Methods Total 0 of 3 100% 0 of 0 n/a 0 1 0 1 0 1 TaskService() 100% n/a 0 1 0 1 0 1
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.service/TaskService.java.html b/coverageTesting/jacoco/com.example.task_manager.service/TaskService.java.html
deleted file mode 100644
index fcf403a0..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.service/TaskService.java.html
+++ /dev/null
@@ -1,13 +0,0 @@
-TaskService.java TaskService.java package com.example.task_manager.service;
-
-import org.springframework.stereotype.Service;
-
-
-import jakarta.transaction.Transactional;
-
-@Service // Marks this class as a Spring service, allowing it to be injected where needed
-@Transactional
-public class TaskService {
-}
-
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.service/TeamMemberService.html b/coverageTesting/jacoco/com.example.task_manager.service/TeamMemberService.html
deleted file mode 100644
index d4a40967..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.service/TeamMemberService.html
+++ /dev/null
@@ -1 +0,0 @@
-TeamMemberService TeamMemberService Element Missed Instructions Cov. Missed Branches Cov. Missed Cxty Missed Lines Missed Methods Total 132 of 714 81% 22 of 52 57% 36 55 15 159 14 29 editTask(int, TaskDTO) 87% 50% 9 10 4 29 0 1 getTeamMember(int) 0% n/a 1 1 3 3 1 1 convertToDTO(TeamMember) 0% n/a 1 1 5 5 1 1 lambda$getTeamsForMember$12(int) 0% n/a 1 1 1 1 1 1 lambda$getAssignedTasks$10(Object) 0% n/a 1 1 1 1 1 1 lambda$getTeamMember$9(int) 0% n/a 1 1 1 1 1 1 lambda$resetPassword$8(int) 0% n/a 1 1 1 1 1 1 lambda$changePassword$7(int) 0% n/a 1 1 1 1 1 1 lambda$massAssignToTask$6(Integer) 0% n/a 1 1 1 1 1 1 lambda$massAssignToTask$5(int) 0% n/a 1 1 1 1 1 1 lambda$assignToTask$4(int) 0% n/a 1 1 1 1 1 1 lambda$assignToTask$3(int) 0% n/a 1 1 1 1 1 1 lambda$editTask$2(int) 0% n/a 1 1 1 1 1 1 assignToTask(int, int) 90% 50% 1 2 1 10 0 1 changePassword(int, String, String) 89% 66% 2 4 1 12 0 1 resetPassword(int, String) 89% 50% 2 3 1 10 0 1 lambda$convertToDTO$14(IsAssigned) 0% n/a 1 1 1 1 1 1 lambda$createTask$0() 0% n/a 1 1 1 1 1 1 lambda$getAssignedTasks$11(IsAssigned) 89% 50% 1 2 0 8 0 1 createTask(TaskRequestDTO) 98% 66% 4 7 0 20 0 1 convertToDTO(Task) 97% 50% 1 2 0 14 0 1 lambda$getTeamsForMember$13(IsMemberOf) 95% 50% 1 2 0 4 0 1 massAssignToTask(int, List) 100% 75% 1 3 0 15 0 1 TeamMemberService(TeamMemberRepository, TeamRepository, TaskRepository, IsMemberOfRepository, IsAssignedRepository, AuthInfoService, NotificationService, NotificationRepository) 100% n/a 0 1 0 10 0 1 deleteTask(int) 100% n/a 0 1 0 6 0 1 getTeamsForMember(int) 100% n/a 0 1 0 5 0 1 convertToDTO(IsAssigned) 100% n/a 0 1 0 5 0 1 getAssignedTasks(int) 100% n/a 0 1 0 3 0 1 lambda$deleteTask$1(int) 100% n/a 0 1 0 1 0 1
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.service/TeamMemberService.java.html b/coverageTesting/jacoco/com.example.task_manager.service/TeamMemberService.java.html
deleted file mode 100644
index 919ab33f..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.service/TeamMemberService.java.html
+++ /dev/null
@@ -1,381 +0,0 @@
-TeamMemberService.java TeamMemberService.java package com.example.task_manager.service;
-
-import java.time.LocalDate;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.springframework.stereotype.Service;
-
-import com.example.task_manager.DTO.IsAssignedDTO;
-import com.example.task_manager.DTO.TaskDTO;
-import com.example.task_manager.DTO.TaskRequestDTO;
-import com.example.task_manager.DTO.TeamDTO;
-import com.example.task_manager.DTO.TeamMemberDTO;
-import com.example.task_manager.entity.IsAssigned;
-import com.example.task_manager.entity.Task;
-import com.example.task_manager.entity.Team;
-import com.example.task_manager.entity.TeamMember;
-import com.example.task_manager.repository.IsAssignedRepository;
-import com.example.task_manager.repository.IsMemberOfRepository;
-import com.example.task_manager.repository.NotificationRepository;
-import com.example.task_manager.repository.TaskRepository;
-import com.example.task_manager.repository.TeamMemberRepository;
-import com.example.task_manager.repository.TeamRepository;
-import com.example.task_manager.enums.TaskPriority;
-
-import jakarta.transaction.Transactional;
-
-@Service // Marks this class as a Spring service, making it eligible for dependency injection
-@Transactional // Ensures all methods run within a transactional context
-public class TeamMemberService {
-
- protected final TeamMemberRepository teamMemberRepository;
- protected final TeamRepository teamRepository;
- protected final IsMemberOfRepository isMemberOfRepository;
- protected final TaskRepository taskRepository;
- protected final IsAssignedRepository isAssignedRepository;
- protected final NotificationRepository notifRepository;
- protected final AuthInfoService authInfoService;
- protected final NotificationService notifService;
-
- // Constructor for required repositories
- public TeamMemberService(TeamMemberRepository teamMemberRepository,
- TeamRepository teamRepository,
- TaskRepository taskRepository,
- IsMemberOfRepository isMemberOfRepository,
- IsAssignedRepository isAssignedRepository,
- AuthInfoService authInfoService,
- NotificationService notifService,
- NotificationRepository notifRepository) {
- this.teamMemberRepository = teamMemberRepository;
- this.teamRepository = teamRepository;
- this.isMemberOfRepository = isMemberOfRepository;
- this.taskRepository = taskRepository;
- this.isAssignedRepository = isAssignedRepository;
- this.authInfoService = authInfoService;
- this.notifService = notifService;
- this.notifRepository = notifRepository;
- }
-
- /**
- * Creates and saves a new Task.
- * Allows optional parameters such as description, expected completion date, and due date.
- *
- * @param title The title of the task.
- * @param description The task description (nullable).
- * @param isLocked Indicates if the task is locked (nullable).
- * @param status The current status of the task.
- * @param expectedCompletionDate Expected completion date (nullable).
- * @param dueDate The due date of the task (nullable).
- * @param team The team responsible for the task.
- * @param assignedMembers The set of assigned members (nullable).
- * @return The created Task entity.
- */
- public TaskDTO createTask(TaskRequestDTO request) {
-
- if (request.getTitle() == null || request.getTitle().trim().isEmpty()) {
- throw new RuntimeException("Task title cannot be null or empty");
- }
-
- if (request.getTeamId() == null) {
- throw new RuntimeException("Task must be assigned to a team");
- }
-
- Team team = teamRepository.findById(request.getTeamId())
- .orElseThrow(() -> new RuntimeException("Task must be assigned to a valid team"));
-
- TaskPriority priority = request.getPriority() != null ? request.getPriority() : TaskPriority.LOW;
-
- Task task = new Task();
- task.setTitle(request.getTitle());
- task.setIsLocked(request.getIsLocked());
- task.setStatus(request.getStatus());
- task.setDateCreated(LocalDate.now());
- task.setTeam(team);
- task.setPriority(priority);
-
- if (request.getDescription() != null) {
- task.setDescription(request.getDescription());
- }
- if (request.getDueDate() != null) {
- task.setExpectedCompletionDate(request.getDueDate());
- }
-
- task = taskRepository.save(task);
- return convertToDTO(task);
- }
-
- /**
- * Deletes a task by ID.
- * Explicitly removes associated assignments before deleting the task.
- *
- * @param taskId The ID of the task to be deleted.
- */
- public void deleteTask(int taskId) {
- Task task = taskRepository.findById(taskId)
- .orElseThrow(() -> new RuntimeException("Task not found with ID: " + taskId));
-
- // Ensure all assignments are removed before deleting the task
- isAssignedRepository.deleteAllByTask_TaskId(taskId);
- notifRepository.deleteAllByTask_TaskId(taskId); // 👈 add this
-
- taskRepository.delete(task);
- }
-
- /**
- * Edits the details of an existing Task.
- * Allows partial updates; only non-null and non-empty values are updated.
- *
- * @param taskId The ID of the task to be updated.
- * @param newTitle The new title (nullable).
- * @param newDescription The new description (nullable).
- * @param isLocked The lock status (nullable).
- * @param newStatus The updated task status (nullable).
- * @param newExpectedCompletionDate New expected completion date (nullable).
- * @param newDueDate The new due date (nullable).
- * @return The updated Task entity.
- */
- public TaskDTO editTask(int taskId, TaskDTO taskDTO) {
- Task task = taskRepository.findById(taskId)
- .orElseThrow(() -> new RuntimeException("Task not found with ID: " + taskId));
-
- String oldTitle = task.getTitle();
- String oldDescription = task.getDescription();
- boolean oldLockStatus = task.isLocked();
- String oldStatus = task.getStatus();
- LocalDate oldDueDate = task.getDueDate();
-
- if (taskDTO.getTitle() != null && !taskDTO.getTitle().isEmpty()) {
- task.setTitle(taskDTO.getTitle());
-
- //call notif method
- notifService.notifyTaskTitleChange(task, oldTitle);
- }
-
- if (taskDTO.getDescription() != null && !taskDTO.getDescription().isEmpty()) {
- task.setDescription(taskDTO.getDescription());
-
- //call notif method
- notifService.notifyTaskDescriptionChange(task, oldDescription);
- }
-
- if (taskDTO.getIsLocked() != task.isLocked()) {
- task.setIsLocked(taskDTO.getIsLocked());
-
- //call notif method
- notifService.notifyTaskLockChange(task, oldLockStatus);
- }
-
- if (taskDTO.getStatus() != null && !taskDTO.getStatus().isEmpty()) {
- task.setStatus(taskDTO.getStatus());
-
- //call notif method
- notifService.notifyTaskStatusChange(task, oldStatus);
- }
-
- if (taskDTO.getDueDate() != null) {
- task.setDueDate(taskDTO.getDueDate());
-
- //call notif method
- notifService.notifyTaskDueDateChange(task, oldDueDate);
- }
-
- if (taskDTO.getPriority() != null) {
- try {
- task.setPriority(taskDTO.getPriority());
- } catch (IllegalArgumentException e) {
- throw new RuntimeException("Invalid priority value. Use: LOW, MEDIUM, or HIGH.");
- }
- }
-
- task = taskRepository.save(task);
-
- return convertToDTO(task);
- }
-
- /**
- * Assigns a TeamMember to a Task.
- * Ensures that a member cannot be assigned to the same task more than once.
- *
- * @param taskId The ID of the task.
- * @param teamMemberId The ID of the team member to be assigned.
- */
- public IsAssignedDTO assignToTask(int taskId, int teamMemberId) {
- Task task = taskRepository.findById(taskId)
- .orElseThrow(() -> new RuntimeException("Task not found with ID: " + taskId));
-
- TeamMember teamMember = teamMemberRepository.findById(teamMemberId)
- .orElseThrow(() -> new RuntimeException("Team Member not found with ID: " + teamMemberId));
-
- // Ensure that the member is not already assigned to this task
- boolean alreadyAssigned = isAssignedRepository.existsByTeamMember_AccountIdAndTask_TaskId(teamMemberId, taskId);
- if (alreadyAssigned) {
- throw new RuntimeException("Team Member is already assigned to this task.");
- }
-
- IsAssigned isAssigned = new IsAssigned(task, teamMember, task.getTeam());
- isAssigned = isAssignedRepository.save(isAssigned);
-
- return convertToDTO(isAssigned);
- }
-
- public List<IsAssignedDTO> massAssignToTask(int taskId, List<Integer> teamMemberIds) {
- Task task = taskRepository.findById(taskId)
- .orElseThrow(() -> new RuntimeException("Task not found with ID: " + taskId));
-
- List<IsAssigned> newAssignments = new ArrayList<>();
-
- for (Integer teamMemberId : teamMemberIds) {
- TeamMember teamMember = teamMemberRepository.findById(teamMemberId)
- .orElseThrow(() -> new RuntimeException("Team Member not found with ID: " + teamMemberId));
-
- boolean alreadyAssigned = isAssignedRepository.existsByTeamMember_AccountIdAndTask_TaskId(teamMemberId,
- taskId);
-
- if (!alreadyAssigned) {
- IsAssigned isAssigned = new IsAssigned(task, teamMember, task.getTeam());
- newAssignments.add(isAssigned);
- }
- }
-
- List<IsAssigned> savedAssignments = isAssignedRepository.saveAll(newAssignments);
-
- return savedAssignments.stream()
- .map(this::convertToDTO)
- .collect(Collectors.toList());
- }
-
- /**
- * Changes the password for a TeamMember.
- * Currently, this method is a placeholder for future implementation.
- *
- * @param teamMemberId The ID of the team member.
- * @param oldPassword The current password (not yet implemented).
- * @param newPassword The new password to set (not yet implemented).
- */
- public void changePassword(int teamMemberId, String oldPassword, String newPassword) {
- if (newPassword == null || newPassword.isEmpty()) {
- throw new RuntimeException("Cannot change password to null or empty string");
- }
- TeamMember teamMember = teamMemberRepository.findById(teamMemberId)
- .orElseThrow(() -> new RuntimeException("Team Member not found with ID: " + teamMemberId));
-
- boolean isOldPasswordVerified = authInfoService.approveLogin(teamMember.getAccountId(), oldPassword);
- if (isOldPasswordVerified) {
- String salt = teamMember.getAuthInfo().getSalt();
- String newHashedPassword = AuthInfoService.hashPassword(newPassword, salt);
- teamMember.getAuthInfo().setHashedPassword(newHashedPassword);
- }else{
- throw new RuntimeException("password is incorrect" + oldPassword);
- }
- }
-
- public void resetPassword(int teamMemberId, String newPassword) {
- //check if password is valid
- if (newPassword == null || newPassword.isEmpty()) {
- throw new RuntimeException("Cannot change password to null or empty string");
- }
-
- //ensure the team member exists
- TeamMember teamMember = teamMemberRepository.findById(teamMemberId)
- .orElseThrow(() -> new RuntimeException("Team Member not found with ID: " + teamMemberId));
-
- //create new salt and new password
- String newSalt = authInfoService.generateSalt();
- String newHashedPassword = authInfoService.hashPassword(newPassword, newSalt);
-
- //set the new salt and hashed password
- teamMember.getAuthInfo().setSalt(newSalt);
- teamMember.getAuthInfo().setHashedPassword(newHashedPassword);
-
- teamMemberRepository.save(teamMember);
- }
-
- public TeamMemberDTO getTeamMember(int accountId) {
- TeamMember teamMember = teamMemberRepository.findById(accountId)
- .orElseThrow(() -> new RuntimeException("Team Member not found with ID: " + accountId));
-
- return convertToDTO(teamMember);
- }
-
- public List<TaskDTO> getAssignedTasks(int teamMemberId) {
- return isAssignedRepository.findByTeamMember_AccountId(teamMemberId).stream()
- .map(isAssigned -> {
- Task task = isAssigned.getTask();
-
- List<TeamMemberDTO> assignedMembers = (task.getAssignedMembers() != null ? task.getAssignedMembers() : new ArrayList<>())
- .stream()
- .map(assignment -> convertToDTO(((IsAssigned) assignment).getTeamMember()))
- .collect(Collectors.toList());
-
- TaskDTO taskDTO = convertToDTO(task);
- taskDTO.setAssignedMembers(assignedMembers);
-
- return taskDTO;
- })
- .collect(Collectors.toList());
- }
-
- public List<TeamDTO> getTeamsForMember(int teamMemberId) {
- TeamMember teamMember = teamMemberRepository.findById(teamMemberId)
- .orElseThrow(() -> new RuntimeException("Team Member not found with ID: " + teamMemberId));
-
- return teamMember.getTeams().stream()
- .map(isMemberOf -> {
- Team team = isMemberOf.getTeam();
- TeamMember lead = team.getTeamLead();
- int leadId = (lead != null) ? lead.getAccountId() : -1; // 👈 sentinel for no lead
- return new TeamDTO(team.getTeamId(), team.getTeamName(), leadId);
- })
- .collect(Collectors.toList());
- }
-
- /*
- * Converts TeamMember entity to a TeamMemberDTO
- */
- private TeamMemberDTO convertToDTO(TeamMember teamMember) {
- return new TeamMemberDTO(
- teamMember.getAccountId(),
- teamMember.getUserName(),
- teamMember.getUserEmail(),
- teamMember.getRole()
- );
- }
-
- /**
- * Converts a Task entity to a TaskDTO.
- */
- private TaskDTO convertToDTO(Task task) {
- List<TeamMemberDTO> assignedMembers = task.getAssignedMembers()
- .stream()
- .map(assignment -> convertToDTO(assignment.getTeamMember()))
- .collect(Collectors.toList());
-
- return new TaskDTO(
- task.getTaskId(),
- task.getTitle(),
- task.getDescription(),
- task.isLocked(),
- task.getStatus(),
- task.getDateCreated(),
- task.getDueDate(),
- task.getTeam().getTeamId(),
- assignedMembers,
- task.getPriority() != null ? task.getPriority() : TaskPriority.LOW
- );
- }
-
- /**
- * Converts an IsAssigned entity to an IsAssignedDTO.
- */
- private IsAssignedDTO convertToDTO(IsAssigned isAssigned) {
- return new IsAssignedDTO(
- isAssigned.getId(),
- isAssigned.getTask().getTaskId(),
- isAssigned.getTeamMember().getAccountId(),
- isAssigned.getTeam().getTeamId()
- );
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.service/TeamService.html b/coverageTesting/jacoco/com.example.task_manager.service/TeamService.html
deleted file mode 100644
index 93c54a0f..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.service/TeamService.html
+++ /dev/null
@@ -1 +0,0 @@
-TeamService TeamService
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.service/TeamService.java.html b/coverageTesting/jacoco/com.example.task_manager.service/TeamService.java.html
deleted file mode 100644
index d0e9a89b..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.service/TeamService.java.html
+++ /dev/null
@@ -1,203 +0,0 @@
-TeamService.java TeamService.java package com.example.task_manager.service;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.springframework.stereotype.Service;
-
-import com.example.task_manager.DTO.TaskDTO;
-import com.example.task_manager.DTO.TeamDTO;
-import com.example.task_manager.DTO.TeamMemberDTO;
-import com.example.task_manager.DTO.TeamMemberInTeamDTO;
-import com.example.task_manager.entity.IsAssigned;
-import com.example.task_manager.entity.IsMemberOf;
-import com.example.task_manager.entity.Task;
-import com.example.task_manager.entity.Team;
-import com.example.task_manager.entity.TeamMember;
-import com.example.task_manager.repository.IsMemberOfRepository;
-import com.example.task_manager.repository.TaskRepository;
-import com.example.task_manager.repository.TeamMemberRepository;
-import com.example.task_manager.repository.TeamRepository;
-import com.sun.source.util.TaskListener;
-
-import jakarta.transaction.Transactional;
-
-@Service // Marks this class as a Spring service, allowing it to be injected where needed
-@Transactional
-public class TeamService {
-
- private final TaskRepository taskRepository;
- private final TeamMemberRepository teamMemberRepository;
- private final TeamRepository teamRepository;
- private final IsMemberOfRepository isMemberOfRepository;
-
- // Constructor injection for required repositories
- public TeamService(TaskRepository taskRepository, TeamMemberRepository teamMemberRepository,
- TeamRepository teamRepository,
- IsMemberOfRepository isMemberOfRepository) {
- this.taskRepository = taskRepository;
- this.teamMemberRepository = teamMemberRepository;
- this.teamRepository = teamRepository;
- this.isMemberOfRepository = isMemberOfRepository;
- }
-
- /**
- * Creates a new team with the specified team name and team lead.
- *
- * @param teamName The name of the team.
- * @param teamLeadId The ID of the team lead.
- * @return The created Team entity.
- */
- public TeamDTO createTeam(String teamName, int teamLeadId) {
- if (teamName == null || teamName.trim().isEmpty()) {
- throw new RuntimeException("Team name cannot be empty");
- }
-
- TeamMember teamLead = teamMemberRepository.findById(teamLeadId)
- .orElseThrow(() -> new RuntimeException("Team Lead not found with ID: " + teamLeadId));
-
- Team team = new Team();
- team.setTeamName(teamName);
- team.setTeamLead(teamLead);
-
- team = teamRepository.save(team);
-
- IsMemberOf isMemberOf = new IsMemberOf(teamLead, team);
- isMemberOfRepository.save(isMemberOf);
-
- return convertToDTO(team);
- }
-
- /**
- * Deletes a team by its ID.
- *
- * @param teamId The ID of the team to delete.
- */
- public void deleteTeam(int teamId) {
- Team team = teamRepository.findById(teamId)
- .orElseThrow(() -> new RuntimeException("Team not found with ID: " + teamId));
-
- teamRepository.delete(team);
- }
-
- /**
- * Changes the team lead of an existing team.
- *
- * @param teamId The ID of the team whose lead should be changed.
- * @param teamLeadId The ID of the new team lead.
- */
- public TeamDTO changeTeamLead(int teamId, String teamName, int teamLeadId) {
- Team team = teamRepository.findById(teamId)
- .orElseThrow(() -> new RuntimeException("Team not found with ID: " + teamId));
-
- TeamMember teamMember = teamMemberRepository.findById(teamLeadId)
- .orElseThrow(() -> new RuntimeException("Team Lead not found with ID: " + teamLeadId));
-
- team.setTeamLead(teamMember);
- team.setTeamName(teamName);
- teamRepository.save(team);
-
- return new TeamDTO(team.getTeamId(), team.getTeamName(), team.getTeamLead().getAccountId());
- }
-
- /**
- * Retrieves all members of a specified team.
- *
- * @param teamId The ID of the team.
- * @return A list of TeamMembers belonging to the team.
- */
- public List<TeamMemberInTeamDTO> getTeamMembers(int teamId) {
- Team team = teamRepository.findById(teamId)
- .orElseThrow(() -> new RuntimeException("Team not found with ID: " + teamId));
-
- int teamLeadId = (team.getTeamLead() != null) ? team.getTeamLead().getAccountId() : -1;
-
- return isMemberOfRepository.findMembersByTeamId(teamId).stream()
- .map(isMember -> {
- TeamMember teamMember = isMember.getTeamMember();
- boolean isTeamLead;
-
- if (teamMember.getAccountId() == teamLeadId) {
- isTeamLead = true;
- }
- else {
- isTeamLead = false;
- }
-
- return convertToDTO(teamMember, isTeamLead);
- })
- .collect(Collectors.toList());
- }
-
- /*
- * Returns all tasks attached to a team
- */
- public List<TaskDTO> getTeamTasks(int teamId) {
- Team team = teamRepository.findById(teamId)
- .orElseThrow(() -> new RuntimeException("Team not found with ID: " + teamId));
-
- return taskRepository.findByTeam_TeamId(teamId).stream()
- .map(this::convertToDTO)
- .collect(Collectors.toList());
- }
-
- /*
- * Converts a Task entity to a TaskDTO entity
- */
- private TaskDTO convertToDTO(Task task) {
- List<TeamMemberDTO> members = task.getAssignedMembers().stream()
- .map(IsAssigned::getTeamMember)
- .map(member -> new TeamMemberDTO(
- member.getAccountId(),
- member.getUserName(),
- member.getUserEmail(),
- member.getRole()))
- .collect(Collectors.toList());
-
- return new TaskDTO(
- task.getTaskId(),
- task.getTitle(),
- task.getDescription(),
- task.isLocked(),
- task.getStatus(),
- task.getDateCreated(),
- task.getDueDate(),
- task.getTeam().getTeamId(),
- members,
- task.getPriority()
- );
- }
-
- /**
- * Converts a Team entity to a TeamDTO.
- */
- private TeamDTO convertToDTO(Team team) {
- return new TeamDTO(
- team.getTeamId(),
- team.getTeamName(),
- team.getTeamLead() != null ? team.getTeamLead().getAccountId() : null
- );
- }
-
- /**
- * Converts a TeamMember entity to a TeamMemberDTO.
- */
- private TeamMemberDTO convertToDTO(TeamMember teamMember) {
- return new TeamMemberDTO(
- teamMember.getAccountId(),
- teamMember.getUserName(),
- teamMember.getUserEmail(),
- teamMember.getRole());
- }
-
- private TeamMemberInTeamDTO convertToDTO(TeamMember teamMember, boolean isTeamLead) {
- return new TeamMemberInTeamDTO(
- teamMember.getAccountId(),
- teamMember.getUserName(),
- teamMember.getUserEmail(),
- teamMember.getRole(),
- isTeamLead
- );
- }
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.service/index.html b/coverageTesting/jacoco/com.example.task_manager.service/index.html
deleted file mode 100644
index 23a29aa1..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.service/index.html
+++ /dev/null
@@ -1 +0,0 @@
-com.example.task_manager.service com.example.task_manager.service
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager.service/index.source.html b/coverageTesting/jacoco/com.example.task_manager.service/index.source.html
deleted file mode 100644
index 00e8d30c..00000000
--- a/coverageTesting/jacoco/com.example.task_manager.service/index.source.html
+++ /dev/null
@@ -1 +0,0 @@
-com.example.task_manager.service com.example.task_manager.service
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager/TaskManagerApplication.html b/coverageTesting/jacoco/com.example.task_manager/TaskManagerApplication.html
deleted file mode 100644
index 60addabd..00000000
--- a/coverageTesting/jacoco/com.example.task_manager/TaskManagerApplication.html
+++ /dev/null
@@ -1 +0,0 @@
-TaskManagerApplication TaskManagerApplication
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager/TaskManagerApplication.java.html b/coverageTesting/jacoco/com.example.task_manager/TaskManagerApplication.java.html
deleted file mode 100644
index 5a8ecc62..00000000
--- a/coverageTesting/jacoco/com.example.task_manager/TaskManagerApplication.java.html
+++ /dev/null
@@ -1,14 +0,0 @@
-TaskManagerApplication.java TaskManagerApplication.java package com.example.task_manager;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-public class TaskManagerApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(TaskManagerApplication.class, args);
- }
-
-}
-
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager/index.html b/coverageTesting/jacoco/com.example.task_manager/index.html
deleted file mode 100644
index 5575c726..00000000
--- a/coverageTesting/jacoco/com.example.task_manager/index.html
+++ /dev/null
@@ -1 +0,0 @@
-com.example.task_manager com.example.task_manager Element Missed Instructions Cov. Missed Branches Cov. Missed Cxty Missed Lines Missed Methods Missed Classes Total 5 of 8 37% 0 of 0 n/a 1 2 2 3 1 2 0 1 TaskManagerApplication 37% n/a 1 2 2 3 1 2 0 1
\ No newline at end of file
diff --git a/coverageTesting/jacoco/com.example.task_manager/index.source.html b/coverageTesting/jacoco/com.example.task_manager/index.source.html
deleted file mode 100644
index c99401cb..00000000
--- a/coverageTesting/jacoco/com.example.task_manager/index.source.html
+++ /dev/null
@@ -1 +0,0 @@
-com.example.task_manager com.example.task_manager Element Missed Instructions Cov. Missed Branches Cov. Missed Cxty Missed Lines Missed Methods Missed Classes Total 5 of 8 37% 0 of 0 n/a 1 2 2 3 1 2 0 1 TaskManagerApplication.java 37% n/a 1 2 2 3 1 2 0 1
\ No newline at end of file
diff --git a/coverageTesting/jacoco/index.html b/coverageTesting/jacoco/index.html
deleted file mode 100644
index 1527e39b..00000000
--- a/coverageTesting/jacoco/index.html
+++ /dev/null
@@ -1 +0,0 @@
-task-manager task-manager
\ No newline at end of file
diff --git a/coverageTesting/jacoco/jacoco-resources/branchfc.gif b/coverageTesting/jacoco/jacoco-resources/branchfc.gif
deleted file mode 100644
index 989b46d3..00000000
Binary files a/coverageTesting/jacoco/jacoco-resources/branchfc.gif and /dev/null differ
diff --git a/coverageTesting/jacoco/jacoco-resources/branchnc.gif b/coverageTesting/jacoco/jacoco-resources/branchnc.gif
deleted file mode 100644
index 1933e07c..00000000
Binary files a/coverageTesting/jacoco/jacoco-resources/branchnc.gif and /dev/null differ
diff --git a/coverageTesting/jacoco/jacoco-resources/branchpc.gif b/coverageTesting/jacoco/jacoco-resources/branchpc.gif
deleted file mode 100644
index cbf711b7..00000000
Binary files a/coverageTesting/jacoco/jacoco-resources/branchpc.gif and /dev/null differ
diff --git a/coverageTesting/jacoco/jacoco-resources/bundle.gif b/coverageTesting/jacoco/jacoco-resources/bundle.gif
deleted file mode 100644
index fca9c53e..00000000
Binary files a/coverageTesting/jacoco/jacoco-resources/bundle.gif and /dev/null differ
diff --git a/coverageTesting/jacoco/jacoco-resources/class.gif b/coverageTesting/jacoco/jacoco-resources/class.gif
deleted file mode 100644
index eb348fb0..00000000
Binary files a/coverageTesting/jacoco/jacoco-resources/class.gif and /dev/null differ
diff --git a/coverageTesting/jacoco/jacoco-resources/down.gif b/coverageTesting/jacoco/jacoco-resources/down.gif
deleted file mode 100644
index 440a14db..00000000
Binary files a/coverageTesting/jacoco/jacoco-resources/down.gif and /dev/null differ
diff --git a/coverageTesting/jacoco/jacoco-resources/greenbar.gif b/coverageTesting/jacoco/jacoco-resources/greenbar.gif
deleted file mode 100644
index 0ba65672..00000000
Binary files a/coverageTesting/jacoco/jacoco-resources/greenbar.gif and /dev/null differ
diff --git a/coverageTesting/jacoco/jacoco-resources/group.gif b/coverageTesting/jacoco/jacoco-resources/group.gif
deleted file mode 100644
index a4ea580d..00000000
Binary files a/coverageTesting/jacoco/jacoco-resources/group.gif and /dev/null differ
diff --git a/coverageTesting/jacoco/jacoco-resources/method.gif b/coverageTesting/jacoco/jacoco-resources/method.gif
deleted file mode 100644
index 7d24707e..00000000
Binary files a/coverageTesting/jacoco/jacoco-resources/method.gif and /dev/null differ
diff --git a/coverageTesting/jacoco/jacoco-resources/package.gif b/coverageTesting/jacoco/jacoco-resources/package.gif
deleted file mode 100644
index 131c28da..00000000
Binary files a/coverageTesting/jacoco/jacoco-resources/package.gif and /dev/null differ
diff --git a/coverageTesting/jacoco/jacoco-resources/prettify.css b/coverageTesting/jacoco/jacoco-resources/prettify.css
deleted file mode 100644
index be5166e0..00000000
--- a/coverageTesting/jacoco/jacoco-resources/prettify.css
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Pretty printing styles. Used with prettify.js. */
-
-.str { color: #2A00FF; }
-.kwd { color: #7F0055; font-weight:bold; }
-.com { color: #3F5FBF; }
-.typ { color: #606; }
-.lit { color: #066; }
-.pun { color: #660; }
-.pln { color: #000; }
-.tag { color: #008; }
-.atn { color: #606; }
-.atv { color: #080; }
-.dec { color: #606; }
diff --git a/coverageTesting/jacoco/jacoco-resources/prettify.js b/coverageTesting/jacoco/jacoco-resources/prettify.js
deleted file mode 100644
index b2766fe0..00000000
--- a/coverageTesting/jacoco/jacoco-resources/prettify.js
+++ /dev/null
@@ -1,1510 +0,0 @@
-// Copyright (C) 2006 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-
-/**
- * @fileoverview
- * some functions for browser-side pretty printing of code contained in html.
- *
- *
- * For a fairly comprehensive set of languages see the
- * README
- * file that came with this source. At a minimum, the lexer should work on a
- * number of languages including C and friends, Java, Python, Bash, SQL, HTML,
- * XML, CSS, Javascript, and Makefiles. It works passably on Ruby, PHP and Awk
- * and a subset of Perl, but, because of commenting conventions, doesn't work on
- * Smalltalk, Lisp-like, or CAML-like languages without an explicit lang class.
- *
- * Usage:
- * include this source file in an html page via
- * {@code }
- * define style rules. See the example page for examples.
- * mark the {@code } and {@code } tags in your source with
- * {@code class=prettyprint.}
- * You can also use the (html deprecated) {@code } tag, but the pretty
- * printer needs to do more substantial DOM manipulations to support that, so
- * some css styles may not be preserved.
- *
- * That's it. I wanted to keep the API as simple as possible, so there's no
- * need to specify which language the code is in, but if you wish, you can add
- * another class to the {@code } or {@code } element to specify the
- * language, as in {@code }. Any class that
- * starts with "lang-" followed by a file extension, specifies the file type.
- * See the "lang-*.js" files in this directory for code that implements
- * per-language file handlers.
- *
- * Change log:
- * cbeust, 2006/08/22
- *
- * Java annotations (start with "@") are now captured as literals ("lit")
- *
- * @requires console
- */
-
-// JSLint declarations
-/*global console, document, navigator, setTimeout, window */
-
-/**
- * Split {@code prettyPrint} into multiple timeouts so as not to interfere with
- * UI events.
- * If set to {@code false}, {@code prettyPrint()} is synchronous.
- */
-window['PR_SHOULD_USE_CONTINUATION'] = true;
-
-/** the number of characters between tab columns */
-window['PR_TAB_WIDTH'] = 8;
-
-/** Walks the DOM returning a properly escaped version of innerHTML.
- * @param {Node} node
- * @param {Array.} out output buffer that receives chunks of HTML.
- */
-window['PR_normalizedHtml']
-
-/** Contains functions for creating and registering new language handlers.
- * @type {Object}
- */
- = window['PR']
-
-/** Pretty print a chunk of code.
- *
- * @param {string} sourceCodeHtml code as html
- * @return {string} code as html, but prettier
- */
- = window['prettyPrintOne']
-/** Find all the {@code } and {@code } tags in the DOM with
- * {@code class=prettyprint} and prettify them.
- * @param {Function?} opt_whenDone if specified, called when the last entry
- * has been finished.
- */
- = window['prettyPrint'] = void 0;
-
-/** browser detection. @extern @returns false if not IE, otherwise the major version. */
-window['_pr_isIE6'] = function () {
- var ieVersion = navigator && navigator.userAgent &&
- navigator.userAgent.match(/\bMSIE ([678])\./);
- ieVersion = ieVersion ? +ieVersion[1] : false;
- window['_pr_isIE6'] = function () { return ieVersion; };
- return ieVersion;
-};
-
-
-(function () {
- // Keyword lists for various languages.
- var FLOW_CONTROL_KEYWORDS =
- "break continue do else for if return while ";
- var C_KEYWORDS = FLOW_CONTROL_KEYWORDS + "auto case char const default " +
- "double enum extern float goto int long register short signed sizeof " +
- "static struct switch typedef union unsigned void volatile ";
- var COMMON_KEYWORDS = C_KEYWORDS + "catch class delete false import " +
- "new operator private protected public this throw true try typeof ";
- var CPP_KEYWORDS = COMMON_KEYWORDS + "alignof align_union asm axiom bool " +
- "concept concept_map const_cast constexpr decltype " +
- "dynamic_cast explicit export friend inline late_check " +
- "mutable namespace nullptr reinterpret_cast static_assert static_cast " +
- "template typeid typename using virtual wchar_t where ";
- var JAVA_KEYWORDS = COMMON_KEYWORDS +
- "abstract boolean byte extends final finally implements import " +
- "instanceof null native package strictfp super synchronized throws " +
- "transient ";
- var CSHARP_KEYWORDS = JAVA_KEYWORDS +
- "as base by checked decimal delegate descending event " +
- "fixed foreach from group implicit in interface internal into is lock " +
- "object out override orderby params partial readonly ref sbyte sealed " +
- "stackalloc string select uint ulong unchecked unsafe ushort var ";
- var JSCRIPT_KEYWORDS = COMMON_KEYWORDS +
- "debugger eval export function get null set undefined var with " +
- "Infinity NaN ";
- var PERL_KEYWORDS = "caller delete die do dump elsif eval exit foreach for " +
- "goto if import last local my next no our print package redo require " +
- "sub undef unless until use wantarray while BEGIN END ";
- var PYTHON_KEYWORDS = FLOW_CONTROL_KEYWORDS + "and as assert class def del " +
- "elif except exec finally from global import in is lambda " +
- "nonlocal not or pass print raise try with yield " +
- "False True None ";
- var RUBY_KEYWORDS = FLOW_CONTROL_KEYWORDS + "alias and begin case class def" +
- " defined elsif end ensure false in module next nil not or redo rescue " +
- "retry self super then true undef unless until when yield BEGIN END ";
- var SH_KEYWORDS = FLOW_CONTROL_KEYWORDS + "case done elif esac eval fi " +
- "function in local set then until ";
- var ALL_KEYWORDS = (
- CPP_KEYWORDS + CSHARP_KEYWORDS + JSCRIPT_KEYWORDS + PERL_KEYWORDS +
- PYTHON_KEYWORDS + RUBY_KEYWORDS + SH_KEYWORDS);
-
- // token style names. correspond to css classes
- /** token style for a string literal */
- var PR_STRING = 'str';
- /** token style for a keyword */
- var PR_KEYWORD = 'kwd';
- /** token style for a comment */
- var PR_COMMENT = 'com';
- /** token style for a type */
- var PR_TYPE = 'typ';
- /** token style for a literal value. e.g. 1, null, true. */
- var PR_LITERAL = 'lit';
- /** token style for a punctuation string. */
- var PR_PUNCTUATION = 'pun';
- /** token style for a punctuation string. */
- var PR_PLAIN = 'pln';
-
- /** token style for an sgml tag. */
- var PR_TAG = 'tag';
- /** token style for a markup declaration such as a DOCTYPE. */
- var PR_DECLARATION = 'dec';
- /** token style for embedded source. */
- var PR_SOURCE = 'src';
- /** token style for an sgml attribute name. */
- var PR_ATTRIB_NAME = 'atn';
- /** token style for an sgml attribute value. */
- var PR_ATTRIB_VALUE = 'atv';
-
- /**
- * A class that indicates a section of markup that is not code, e.g. to allow
- * embedding of line numbers within code listings.
- */
- var PR_NOCODE = 'nocode';
-
- /** A set of tokens that can precede a regular expression literal in
- * javascript.
- * http://www.mozilla.org/js/language/js20/rationale/syntax.html has the full
- * list, but I've removed ones that might be problematic when seen in
- * languages that don't support regular expression literals.
- *
- * Specifically, I've removed any keywords that can't precede a regexp
- * literal in a syntactically legal javascript program, and I've removed the
- * "in" keyword since it's not a keyword in many languages, and might be used
- * as a count of inches.
- *
- *
The link a above does not accurately describe EcmaScript rules since
- * it fails to distinguish between (a=++/b/i) and (a++/b/i) but it works
- * very well in practice.
- *
- * @private
- */
- var REGEXP_PRECEDER_PATTERN = function () {
- var preceders = [
- "!", "!=", "!==", "#", "%", "%=", "&", "&&", "&&=",
- "&=", "(", "*", "*=", /* "+", */ "+=", ",", /* "-", */ "-=",
- "->", /*".", "..", "...", handled below */ "/", "/=", ":", "::", ";",
- "<", "<<", "<<=", "<=", "=", "==", "===", ">",
- ">=", ">>", ">>=", ">>>", ">>>=", "?", "@", "[",
- "^", "^=", "^^", "^^=", "{", "|", "|=", "||",
- "||=", "~" /* handles =~ and !~ */,
- "break", "case", "continue", "delete",
- "do", "else", "finally", "instanceof",
- "return", "throw", "try", "typeof"
- ];
- var pattern = '(?:^^|[+-]';
- for (var i = 0; i < preceders.length; ++i) {
- pattern += '|' + preceders[i].replace(/([^=<>:&a-z])/g, '\\$1');
- }
- pattern += ')\\s*'; // matches at end, and matches empty string
- return pattern;
- // CAVEAT: this does not properly handle the case where a regular
- // expression immediately follows another since a regular expression may
- // have flags for case-sensitivity and the like. Having regexp tokens
- // adjacent is not valid in any language I'm aware of, so I'm punting.
- // TODO: maybe style special characters inside a regexp as punctuation.
- }();
-
- // Define regexps here so that the interpreter doesn't have to create an
- // object each time the function containing them is called.
- // The language spec requires a new object created even if you don't access
- // the $1 members.
- var pr_amp = /&/g;
- var pr_lt = //g;
- var pr_quot = /\"/g;
- /** like textToHtml but escapes double quotes to be attribute safe. */
- function attribToHtml(str) {
- return str.replace(pr_amp, '&')
- .replace(pr_lt, '<')
- .replace(pr_gt, '>')
- .replace(pr_quot, '"');
- }
-
- /** escapest html special characters to html. */
- function textToHtml(str) {
- return str.replace(pr_amp, '&')
- .replace(pr_lt, '<')
- .replace(pr_gt, '>');
- }
-
-
- var pr_ltEnt = /</g;
- var pr_gtEnt = />/g;
- var pr_aposEnt = /'/g;
- var pr_quotEnt = /"/g;
- var pr_ampEnt = /&/g;
- var pr_nbspEnt = / /g;
- /** unescapes html to plain text. */
- function htmlToText(html) {
- var pos = html.indexOf('&');
- if (pos < 0) { return html; }
- // Handle numeric entities specially. We can't use functional substitution
- // since that doesn't work in older versions of Safari.
- // These should be rare since most browsers convert them to normal chars.
- for (--pos; (pos = html.indexOf('', pos + 1)) >= 0;) {
- var end = html.indexOf(';', pos);
- if (end >= 0) {
- var num = html.substring(pos + 3, end);
- var radix = 10;
- if (num && num.charAt(0) === 'x') {
- num = num.substring(1);
- radix = 16;
- }
- var codePoint = parseInt(num, radix);
- if (!isNaN(codePoint)) {
- html = (html.substring(0, pos) + String.fromCharCode(codePoint) +
- html.substring(end + 1));
- }
- }
- }
-
- return html.replace(pr_ltEnt, '<')
- .replace(pr_gtEnt, '>')
- .replace(pr_aposEnt, "'")
- .replace(pr_quotEnt, '"')
- .replace(pr_nbspEnt, ' ')
- .replace(pr_ampEnt, '&');
- }
-
- /** is the given node's innerHTML normally unescaped? */
- function isRawContent(node) {
- return 'XMP' === node.tagName;
- }
-
- var newlineRe = /[\r\n]/g;
- /**
- * Are newlines and adjacent spaces significant in the given node's innerHTML?
- */
- function isPreformatted(node, content) {
- // PRE means preformatted, and is a very common case, so don't create
- // unnecessary computed style objects.
- if ('PRE' === node.tagName) { return true; }
- if (!newlineRe.test(content)) { return true; } // Don't care
- var whitespace = '';
- // For disconnected nodes, IE has no currentStyle.
- if (node.currentStyle) {
- whitespace = node.currentStyle.whiteSpace;
- } else if (window.getComputedStyle) {
- // Firefox makes a best guess if node is disconnected whereas Safari
- // returns the empty string.
- whitespace = window.getComputedStyle(node, null).whiteSpace;
- }
- return !whitespace || whitespace === 'pre';
- }
-
- function normalizedHtml(node, out, opt_sortAttrs) {
- switch (node.nodeType) {
- case 1: // an element
- var name = node.tagName.toLowerCase();
-
- out.push('<', name);
- var attrs = node.attributes;
- var n = attrs.length;
- if (n) {
- if (opt_sortAttrs) {
- var sortedAttrs = [];
- for (var i = n; --i >= 0;) { sortedAttrs[i] = attrs[i]; }
- sortedAttrs.sort(function (a, b) {
- return (a.name < b.name) ? -1 : a.name === b.name ? 0 : 1;
- });
- attrs = sortedAttrs;
- }
- for (var i = 0; i < n; ++i) {
- var attr = attrs[i];
- if (!attr.specified) { continue; }
- out.push(' ', attr.name.toLowerCase(),
- '="', attribToHtml(attr.value), '"');
- }
- }
- out.push('>');
- for (var child = node.firstChild; child; child = child.nextSibling) {
- normalizedHtml(child, out, opt_sortAttrs);
- }
- if (node.firstChild || !/^(?:br|link|img)$/.test(name)) {
- out.push('<\/', name, '>');
- }
- break;
- case 3: case 4: // text
- out.push(textToHtml(node.nodeValue));
- break;
- }
- }
-
- /**
- * Given a group of {@link RegExp}s, returns a {@code RegExp} that globally
- * matches the union o the sets o strings matched d by the input RegExp.
- * Since it matches globally, if the input strings have a start-of-input
- * anchor (/^.../), it is ignored for the purposes of unioning.
- * @param {Array.} regexs non multiline, non-global regexs.
- * @return {RegExp} a global regex.
- */
- function combinePrefixPatterns(regexs) {
- var capturedGroupIndex = 0;
-
- var needToFoldCase = false;
- var ignoreCase = false;
- for (var i = 0, n = regexs.length; i < n; ++i) {
- var regex = regexs[i];
- if (regex.ignoreCase) {
- ignoreCase = true;
- } else if (/[a-z]/i.test(regex.source.replace(
- /\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi, ''))) {
- needToFoldCase = true;
- ignoreCase = false;
- break;
- }
- }
-
- function decodeEscape(charsetPart) {
- if (charsetPart.charAt(0) !== '\\') { return charsetPart.charCodeAt(0); }
- switch (charsetPart.charAt(1)) {
- case 'b': return 8;
- case 't': return 9;
- case 'n': return 0xa;
- case 'v': return 0xb;
- case 'f': return 0xc;
- case 'r': return 0xd;
- case 'u': case 'x':
- return parseInt(charsetPart.substring(2), 16)
- || charsetPart.charCodeAt(1);
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7':
- return parseInt(charsetPart.substring(1), 8);
- default: return charsetPart.charCodeAt(1);
- }
- }
-
- function encodeEscape(charCode) {
- if (charCode < 0x20) {
- return (charCode < 0x10 ? '\\x0' : '\\x') + charCode.toString(16);
- }
- var ch = String.fromCharCode(charCode);
- if (ch === '\\' || ch === '-' || ch === '[' || ch === ']') {
- ch = '\\' + ch;
- }
- return ch;
- }
-
- function caseFoldCharset(charSet) {
- var charsetParts = charSet.substring(1, charSet.length - 1).match(
- new RegExp(
- '\\\\u[0-9A-Fa-f]{4}'
- + '|\\\\x[0-9A-Fa-f]{2}'
- + '|\\\\[0-3][0-7]{0,2}'
- + '|\\\\[0-7]{1,2}'
- + '|\\\\[\\s\\S]'
- + '|-'
- + '|[^-\\\\]',
- 'g'));
- var groups = [];
- var ranges = [];
- var inverse = charsetParts[0] === '^';
- for (var i = inverse ? 1 : 0, n = charsetParts.length; i < n; ++i) {
- var p = charsetParts[i];
- switch (p) {
- case '\\B': case '\\b':
- case '\\D': case '\\d':
- case '\\S': case '\\s':
- case '\\W': case '\\w':
- groups.push(p);
- continue;
- }
- var start = decodeEscape(p);
- var end;
- if (i + 2 < n && '-' === charsetParts[i + 1]) {
- end = decodeEscape(charsetParts[i + 2]);
- i += 2;
- } else {
- end = start;
- }
- ranges.push([start, end]);
- // If the range might intersect letters, then expand it.
- if (!(end < 65 || start > 122)) {
- if (!(end < 65 || start > 90)) {
- ranges.push([Math.max(65, start) | 32, Math.min(end, 90) | 32]);
- }
- if (!(end < 97 || start > 122)) {
- ranges.push([Math.max(97, start) & ~32, Math.min(end, 122) & ~32]);
- }
- }
- }
-
- // [[1, 10], [3, 4], [8, 12], [14, 14], [16, 16], [17, 17]]
- // -> [[1, 12], [14, 14], [16, 17]]
- ranges.sort(function (a, b) { return (a[0] - b[0]) || (b[1] - a[1]); });
- var consolidatedRanges = [];
- var lastRange = [NaN, NaN];
- for (var i = 0; i < ranges.length; ++i) {
- var range = ranges[i];
- if (range[0] <= lastRange[1] + 1) {
- lastRange[1] = Math.max(lastRange[1], range[1]);
- } else {
- consolidatedRanges.push(lastRange = range);
- }
- }
-
- var out = ['['];
- if (inverse) { out.push('^'); }
- out.push.apply(out, groups);
- for (var i = 0; i < consolidatedRanges.length; ++i) {
- var range = consolidatedRanges[i];
- out.push(encodeEscape(range[0]));
- if (range[1] > range[0]) {
- if (range[1] + 1 > range[0]) { out.push('-'); }
- out.push(encodeEscape(range[1]));
- }
- }
- out.push(']');
- return out.join('');
- }
-
- function allowAnywhereFoldCaseAndRenumberGroups(regex) {
- // Split into character sets, escape sequences, punctuation strings
- // like ('(', '(?:', ')', '^'), and runs of characters that do not
- // include any of the above.
- var parts = regex.source.match(
- new RegExp(
- '(?:'
- + '\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]' // a character set
- + '|\\\\u[A-Fa-f0-9]{4}' // a unicode escape
- + '|\\\\x[A-Fa-f0-9]{2}' // a hex escape
- + '|\\\\[0-9]+' // a back-reference or octal escape
- + '|\\\\[^ux0-9]' // other escape sequence
- + '|\\(\\?[:!=]' // start of a non-capturing group
- + '|[\\(\\)\\^]' // start/emd of a group, or line start
- + '|[^\\x5B\\x5C\\(\\)\\^]+' // run of other characters
- + ')',
- 'g'));
- var n = parts.length;
-
- // Maps captured group numbers to the number they will occupy in
- // the output or to -1 if that has not been determined, or to
- // undefined if they need not be capturing in the output.
- var capturedGroups = [];
-
- // Walk over and identify back references to build the capturedGroups
- // mapping.
- for (var i = 0, groupIndex = 0; i < n; ++i) {
- var p = parts[i];
- if (p === '(') {
- // groups are 1-indexed, so max group index is count of '('
- ++groupIndex;
- } else if ('\\' === p.charAt(0)) {
- var decimalValue = +p.substring(1);
- if (decimalValue && decimalValue <= groupIndex) {
- capturedGroups[decimalValue] = -1;
- }
- }
- }
-
- // Renumber groups and reduce capturing groups to non-capturing groups
- // where possible.
- for (var i = 1; i < capturedGroups.length; ++i) {
- if (-1 === capturedGroups[i]) {
- capturedGroups[i] = ++capturedGroupIndex;
- }
- }
- for (var i = 0, groupIndex = 0; i < n; ++i) {
- var p = parts[i];
- if (p === '(') {
- ++groupIndex;
- if (capturedGroups[groupIndex] === undefined) {
- parts[i] = '(?:';
- }
- } else if ('\\' === p.charAt(0)) {
- var decimalValue = +p.substring(1);
- if (decimalValue && decimalValue <= groupIndex) {
- parts[i] = '\\' + capturedGroups[groupIndex];
- }
- }
- }
-
- // Remove any prefix anchors so that the output will match anywhere.
- // ^^ really does mean an anchored match though.
- for (var i = 0, groupIndex = 0; i < n; ++i) {
- if ('^' === parts[i] && '^' !== parts[i + 1]) { parts[i] = ''; }
- }
-
- // Expand letters to groupts to handle mixing of case-sensitive and
- // case-insensitive patterns if necessary.
- if (regex.ignoreCase && needToFoldCase) {
- for (var i = 0; i < n; ++i) {
- var p = parts[i];
- var ch0 = p.charAt(0);
- if (p.length >= 2 && ch0 === '[') {
- parts[i] = caseFoldCharset(p);
- } else if (ch0 !== '\\') {
- // TODO: handle letters in numeric escapes.
- parts[i] = p.replace(
- /[a-zA-Z]/g,
- function (ch) {
- var cc = ch.charCodeAt(0);
- return '[' + String.fromCharCode(cc & ~32, cc | 32) + ']';
- });
- }
- }
- }
-
- return parts.join('');
- }
-
- var rewritten = [];
- for (var i = 0, n = regexs.length; i < n; ++i) {
- var regex = regexs[i];
- if (regex.global || regex.multiline) { throw new Error('' + regex); }
- rewritten.push(
- '(?:' + allowAnywhereFoldCaseAndRenumberGroups(regex) + ')');
- }
-
- return new RegExp(rewritten.join('|'), ignoreCase ? 'gi' : 'g');
- }
-
- var PR_innerHtmlWorks = null;
- function getInnerHtml(node) {
- // inner html is hopelessly broken in Safari 2.0.4 when the content is
- // an html description of well formed XML and the containing tag is a PRE
- // tag, so we detect that case and emulate innerHTML.
- if (null === PR_innerHtmlWorks) {
- var testNode = document.createElement('PRE');
- testNode.appendChild(
- document.createTextNode('\n '));
- PR_innerHtmlWorks = !/)[\r\n]+/g, '$1')
- .replace(/(?:[\r\n]+[ \t]*)+/g, ' ');
- }
- return content;
- }
-
- var out = [];
- for (var child = node.firstChild; child; child = child.nextSibling) {
- normalizedHtml(child, out);
- }
- return out.join('');
- }
-
- /** returns a function that expand tabs to spaces. This function can be fed
- * successive chunks of text, and will maintain its own internal state to
- * keep track of how tabs are expanded.
- * @return {function (string) : string} a function that takes
- * plain text and return the text with tabs expanded.
- * @private
- */
- function makeTabExpander(tabWidth) {
- var SPACES = ' ';
- var charInLine = 0;
-
- return function (plainText) {
- // walk over each character looking for tabs and newlines.
- // On tabs, expand them. On newlines, reset charInLine.
- // Otherwise increment charInLine
- var out = null;
- var pos = 0;
- for (var i = 0, n = plainText.length; i < n; ++i) {
- var ch = plainText.charAt(i);
-
- switch (ch) {
- case '\t':
- if (!out) { out = []; }
- out.push(plainText.substring(pos, i));
- // calculate how much space we need in front of this part
- // nSpaces is the amount of padding -- the number of spaces needed
- // to move us to the next column, where columns occur at factors of
- // tabWidth.
- var nSpaces = tabWidth - (charInLine % tabWidth);
- charInLine += nSpaces;
- for (; nSpaces >= 0; nSpaces -= SPACES.length) {
- out.push(SPACES.substring(0, nSpaces));
- }
- pos = i + 1;
- break;
- case '\n':
- charInLine = 0;
- break;
- default:
- ++charInLine;
- }
- }
- if (!out) { return plainText; }
- out.push(plainText.substring(pos));
- return out.join('');
- };
- }
-
- var pr_chunkPattern = new RegExp(
- '[^<]+' // A run of characters other than '<'
- + '|<\!--[\\s\\S]*?--\>' // an HTML comment
- + '|' // a CDATA section
- // a probable tag that should not be highlighted
- + '|<\/?[a-zA-Z](?:[^>\"\']|\'[^\']*\'|\"[^\"]*\")*>'
- + '|<', // A '<' that does not begin a larger chunk
- 'g');
- var pr_commentPrefix = /^<\!--/;
- var pr_cdataPrefix = /^) into their textual equivalent.
- *
- * @param {string} s html where whitespace is considered significant.
- * @return {Object} source code and extracted tags.
- * @private
- */
- function extractTags(s) {
- // since the pattern has the 'g' modifier and defines no capturing groups,
- // this will return a list of all chunks which we then classify and wrap as
- // PR_Tokens
- var matches = s.match(pr_chunkPattern);
- var sourceBuf = [];
- var sourceBufLen = 0;
- var extractedTags = [];
- if (matches) {
- for (var i = 0, n = matches.length; i < n; ++i) {
- var match = matches[i];
- if (match.length > 1 && match.charAt(0) === '<') {
- if (pr_commentPrefix.test(match)) { continue; }
- if (pr_cdataPrefix.test(match)) {
- // strip CDATA prefix and suffix. Don't unescape since it's CDATA
- sourceBuf.push(match.substring(9, match.length - 3));
- sourceBufLen += match.length - 12;
- } else if (pr_brPrefix.test(match)) {
- // tags are lexically significant so convert them to text.
- // This is undone later.
- sourceBuf.push('\n');
- ++sourceBufLen;
- } else {
- if (match.indexOf(PR_NOCODE) >= 0 && isNoCodeTag(match)) {
- // A will start a section that should be
- // ignored. Continue walking the list until we see a matching end
- // tag.
- var name = match.match(pr_tagNameRe)[2];
- var depth = 1;
- var j;
- end_tag_loop:
- for (j = i + 1; j < n; ++j) {
- var name2 = matches[j].match(pr_tagNameRe);
- if (name2 && name2[2] === name) {
- if (name2[1] === '/') {
- if (--depth === 0) { break end_tag_loop; }
- } else {
- ++depth;
- }
- }
- }
- if (j < n) {
- extractedTags.push(
- sourceBufLen, matches.slice(i, j + 1).join(''));
- i = j;
- } else { // Ignore unclosed sections.
- extractedTags.push(sourceBufLen, match);
- }
- } else {
- extractedTags.push(sourceBufLen, match);
- }
- }
- } else {
- var literalText = htmlToText(match);
- sourceBuf.push(literalText);
- sourceBufLen += literalText.length;
- }
- }
- }
- return { source: sourceBuf.join(''), tags: extractedTags };
- }
-
- /** True if the given tag contains a class attribute with the nocode class. */
- function isNoCodeTag(tag) {
- return !!tag
- // First canonicalize the representation of attributes
- .replace(/\s(\w+)\s*=\s*(?:\"([^\"]*)\"|'([^\']*)'|(\S+))/g,
- ' $1="$2$3$4"')
- // Then look for the attribute we want.
- .match(/[cC][lL][aA][sS][sS]=\"[^\"]*\bnocode\b/);
- }
-
- /**
- * Apply the given language handler to sourceCode and add the resulting
- * decorations to out.
- * @param {number} basePos the index of sourceCode within the chunk of source
- * whose decorations are already present on out.
- */
- function appendDecorations(basePos, sourceCode, langHandler, out) {
- if (!sourceCode) { return; }
- var job = {
- source: sourceCode,
- basePos: basePos
- };
- langHandler(job);
- out.push.apply(out, job.decorations);
- }
-
- /** Given triples of [style, pattern, context] returns a lexing function,
- * The lexing function interprets the patterns to find token boundaries and
- * returns a decoration list of the form
- * [index_0, style_0, index_1, style_1, ..., index_n, style_n]
- * where index_n is an index into the sourceCode, and style_n is a style
- * constant like PR_PLAIN. index_n-1 <= index_n, and style_n-1 applies to
- * all characters in sourceCode[index_n-1:index_n].
- *
- * The stylePatterns is a list whose elements have the form
- * [style : string, pattern : RegExp, DEPRECATED, shortcut : string].
- *
- * Style is a style constant like PR_PLAIN, or can be a string of the
- * form 'lang-FOO', where FOO is a language extension describing the
- * language of the portion of the token in $1 after pattern executes.
- * E.g., if style is 'lang-lisp', and group 1 contains the text
- * '(hello (world))', then that portion of the token will be passed to the
- * registered lisp handler for formatting.
- * The text before and after group 1 will be restyled using this decorator
- * so decorators should take care that this doesn't result in infinite
- * recursion. For example, the HTML lexer rule for SCRIPT elements looks
- * something like ['lang-js', /<[s]cript>(.+?)<\/script>/]. This may match
- * '