Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
da9b6fe
CLAP-343 fix: 카테고리 고유코드 및 제목 중복 가능한 문제 수정
hyoseong-Choi Feb 9, 2025
c5b632e
CLAP-343 fix: 카테고리 고유코드 및 제목 중복 가능한 문제 수정
hyoseong-Choi Feb 9, 2025
13a5745
Merge branch 'develop' of https://github.com/TaskFlow-CLAP/TaskFlow-S…
hyoseong-Choi Feb 10, 2025
e2372a6
CLAP-356 fix: 카테고리 수정시 고유코드 및 제목 중복 가능한 문제 수정
hyoseong-Choi Feb 10, 2025
0dea66b
Merge branch 'develop' of https://github.com/TaskFlow-CLAP/TaskFlow-S…
hyoseong-Choi Feb 10, 2025
8a6c12a
CLAP-362 fix:save메소드 위치 변경
Feb 10, 2025
e4ab582
Merge branch 'develop' of https://github.com/TaskFlow-CLAP/TaskFlow-S…
hyoseong-Choi Feb 10, 2025
fd52f10
Merge branch 'release' of https://github.com/TaskFlow-CLAP/TaskFlow-S…
hyoseong-Choi Feb 10, 2025
b8e9aa8
CLAP-362 fix: 회원 상태 필드 추가
Feb 10, 2025
95a36ad
CLAP-373 Fix: 로그인 조회시 logstatus 제거
parkjaehak Feb 11, 2025
8dbf9b4
Merge pull request #477 from TaskFlow-CLAP/CLAP-373
joowojr Feb 11, 2025
3dc1310
CLAP-362 fix:MemberStatus response type String->Enum으로 변경
Feb 11, 2025
12feb9e
Merge pull request #462 from TaskFlow-CLAP/CLAP-362
joowojr Feb 11, 2025
cf951aa
Refactor: 사용하지 않는 dto deprecated 처리
joowojr Feb 11, 2025
d1a7cce
Merge branch 'develop' of https://github.com/TaskFlow-CLAP/TaskFlow-S…
hyoseong-Choi Feb 11, 2025
71d1062
CLAP-378 fix:category id 변수명 변경 및 mapper 수정
Feb 11, 2025
d3649f4
CLAP-370 Fix : 아지트 템플릿 수정
starboxxxx Feb 11, 2025
20577e8
CLAP-370 Fix : 작업 종료 알림 템플릿 생성 및 수정
starboxxxx Feb 11, 2025
c51f7e9
Merge pull request #481 from TaskFlow-CLAP/CLAP-378
joowojr Feb 11, 2025
e326ee5
CLAP-379 Fix: 비밀번호 정규식 누락된 문자 추가
joowojr Feb 11, 2025
6ea29ff
Merge branch 'release' of https://github.com/TaskFlow-CLAP/TaskFlow-S…
hyoseong-Choi Feb 11, 2025
0668fa0
CLAP-379 Refactor: 비밀번호 정규식 정책화
joowojr Feb 11, 2025
79dba17
CLAP-379 Test: 비밀번호 정규식 정책 단위 테스트 코드 작성
joowojr Feb 11, 2025
2402cac
CLAP-380 Fix : 작업 상태 변경, 작업 처리자 변경 모든 담당자들이 가능하도록 수정
starboxxxx Feb 11, 2025
1aed5f6
Merge pull request #486 from TaskFlow-CLAP/CLAP-379
joowojr Feb 11, 2025
fd4dc8f
Merge pull request #487 from TaskFlow-CLAP/CLAP-380
joowojr Feb 11, 2025
f5a0808
Merge branch 'release' of https://github.com/TaskFlow-CLAP/TaskFlow-S…
hyoseong-Choi Feb 11, 2025
a2b2daa
Merge pull request #483 from TaskFlow-CLAP/CLAP-370
joowojr Feb 11, 2025
7eca472
CLAP-381 Fix : 삭제된 task에 대한 알림은 불러오지 않도록 설정 및 fetch join 추가
starboxxxx Feb 11, 2025
e8d5e4c
Merge pull request #489 from TaskFlow-CLAP/CLAP-381
joowojr Feb 11, 2025
95aa9ba
CLAP-382 fix: 카테고리 이름, 코드 중복 체크 로직 수정
hyoseong-Choi Feb 11, 2025
7dab99b
Merge branch 'release' of https://github.com/TaskFlow-CLAP/TaskFlow-S…
hyoseong-Choi Feb 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
package clap.server.adapter.inbound.web.dto.admin.response;

import io.swagger.v3.oas.annotations.media.Schema;

import java.util.List;

public record FindAllCategoryResponse(
Long id,
@Schema(description = "메인 카테고리 ID", example = "1")
Long mainCategoryId,

@Schema(description = "카테고리 이름", example = "VM 관련")
String name,

@Schema(description = "카테고리 코드", example = "VM")
String code,

@Schema(description = "서브 카테고리 목록")
List<FindSubCategoryResponse> subCategory
) {
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
package clap.server.adapter.inbound.web.dto.admin.response;

import io.swagger.v3.oas.annotations.media.Schema;

public record FindMainCategoryResponse(
Long id,
@Schema(description = "메인 카테고리 ID", example = "1")
Long mainCategoryId,

@Schema(description = "카테고리 이름", example = "VM 관련")
String name,

@Schema(description = "카테고리 코드", example = "VM")
String code
) {
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
package clap.server.adapter.inbound.web.dto.admin.response;

import io.swagger.v3.oas.annotations.media.Schema;

public record FindSubCategoryResponse(
Long id,
@Schema(description = "서브 카테고리 ID", example = "4")
Long subCategoryId,

@Schema(description = "메인 카테고리 ID", example = "1")
Long mainCategoryId,

@Schema(description = "카테고리 이름", example = "VM 수정")
String name,

@Schema(description = "카테고리 코드", example = "VU")
String code,

@Schema(description = "카테고리 설명 예시", example = "VM을 수정합니다.")
String descriptionExample
) {
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package clap.server.adapter.inbound.web.dto.admin.response;

import clap.server.adapter.outbound.persistense.entity.member.constant.MemberRole;
import clap.server.adapter.outbound.persistense.entity.member.constant.MemberStatus;
import io.swagger.v3.oas.annotations.media.Schema;

import java.time.LocalDateTime;
Expand Down Expand Up @@ -31,7 +32,10 @@ public record RetrieveAllMemberResponse(
String departmentRole,

@Schema(description = "가입일", example = "2024-01-01T12:00:00")
LocalDateTime createdAt
LocalDateTime createdAt,

@Schema(description = "회원 상태", example = "ACTIVE")
MemberStatus memberStatus


) {}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;

@Deprecated
public record EditCommentRequest(
@Schema(description = "댓글 내용")
@NotBlank
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public record FilterLogRequest(
Integer term,

@NotNull
@Schema(description = "로그 상태 목록",
example = "[\"LOGIN\", \"ASSIGNER_CHANGED\", \"COMMENT_ADDED\"]")
@Schema(description = "로그 상태 목록")
List<LogStatus> logStatus,

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import jakarta.validation.constraints.NotBlank;

@Deprecated
public record SendVerificationCodeRequest(
@NotBlank
String nickname,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import jakarta.validation.constraints.NotBlank;

@Deprecated
public record VerifyCodeRequest(
@NotBlank
String email,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ public String createPayLoad(PushNotificationTemplate request, Task task, String

public String createMessage(PushNotificationTemplate request, String taskDetailUrl) {

return switch (request.notificationType()) {
case TASK_REQUESTED -> "📌 *새 작업 요청:* `" + request.taskName() + "`\\n"
+ "\\t\\t*•요청자: " + request.senderName() + "*\\n"
+ "[확인하러 가기](" + taskDetailUrl + ")";
case STATUS_SWITCHED -> "⚙️ *작업 상태 변경:* `" + request.taskName() + "\\n"
+ "\\t\\t*•작업 상태: " + request.message() + "*\\n"
+ "[확인하러 가기](" + taskDetailUrl + ")";
case PROCESSOR_CHANGED -> "🔄 *담당자 변경:* `" + request.taskName() + "\\n"
+ "\\t\\t*•새 담당자: " + request.message() + "*\\n"
+ "[확인하러 가기](" + taskDetailUrl + ")";
case PROCESSOR_ASSIGNED -> "👤 *작업 담당자 배정:* `" + request.taskName() + "\\n"
+ "\\t\\t*•담당자: " + request.message() + "*\\n"
+ "[확인하러 가기](" + taskDetailUrl + ")";
return switch (request.notificationType()) {
case TASK_REQUESTED -> "📌 *새 작업이 요청되었습니다.*\\n"
+ "\\t\\t*• 🔖 작업명:* " + "*" + request.taskName() + "*" + "\\n"
+ "\\t\\t*• 🙋 요청자:* " + "*" + request.senderName() + "*" + "\\n\\n"
+ "\\t[자세히 보기](" + taskDetailUrl + ")";

case STATUS_SWITCHED -> "작업 상태가 " + "*" + request.message() + "*" + "으로 변경되었습니다.";

case PROCESSOR_CHANGED -> "담당자가 " + "*" + request.message() + "*" + "으로 변경되었습니다.";

case PROCESSOR_ASSIGNED -> "작업이 *승인*되었습니다.*\n"
+ "\\t\\t*• 👤 담당자:* " + "*" + request.message() + "*";

default -> null;
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public record PushNotificationTemplate(
String taskName,
String senderName,
String message,
String commenterName
String commenterName,
String reason
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,20 @@ public EmailTemplate createWebhookTemplate(PushNotificationTemplate request, Str
context.setVariable("title", request.taskName());
break;
case STATUS_SWITCHED:
templateName = "status-switched";
subject = "[TaskFlow] "+ request.taskName()+ " 작업의 상태가 " + request.message() + "으로 변경되었습니다.";
context.setVariable("taskDetailUrl", taskDetailUrl);
context.setVariable("receiverName", request.senderName());
context.setVariable("title", request.taskName());
context.setVariable("status", request.message());
if (request.message().equals("TERMINATED")) {
templateName = "task-terminated";
subject = "[TaskFlow] " + request.taskName() + " 작업이 종료되었습니다.";
context.setVariable("taskDetailUrl", taskDetailUrl);
context.setVariable("reason", request.reason());
context.setVariable("title", request.taskName());
} else {
templateName = "status-switched";
subject = "[TaskFlow] "+ request.taskName()+ " 작업의 상태가 " + request.message() + "으로 변경되었습니다.";
context.setVariable("taskDetailUrl", taskDetailUrl);
context.setVariable("receiverName", request.senderName());
context.setVariable("title", request.taskName());
context.setVariable("status", request.message());
}
break;
case PROCESSOR_CHANGED:
templateName = "processor-changed";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ public class KakaoWorkBlockBuilder {
public String makeObjectBlock(PushNotificationTemplate request, String taskDetailUrl){
return switch (request.notificationType()) {
case TASK_REQUESTED -> makeTaskRequestBlock(request, taskDetailUrl);
case STATUS_SWITCHED -> makeTaskStatusBlock(request, taskDetailUrl);
case STATUS_SWITCHED -> switch (request.message()) { // getStatusChangeType() 메서드로 추가 분기
case "TERMINATED" -> makeTerminatedStatusBlock(request, taskDetailUrl);
default -> makeTaskStatusBlock(request, taskDetailUrl);
};
case PROCESSOR_CHANGED -> makeProcessorChangeBlock(request, taskDetailUrl);
case PROCESSOR_ASSIGNED -> makeNewProcessorBlock(request, taskDetailUrl);
case COMMENT -> makeCommentBlock(request, taskDetailUrl);
Expand Down Expand Up @@ -366,4 +369,72 @@ private String makeTaskStatusBlock(PushNotificationTemplate request, String task

return payload;
}

private String makeTerminatedStatusBlock(PushNotificationTemplate request, String taskDetailUrl) {
Object[] blocks = new Object[]{
Map.of(
"type", "header",
"text", "TaskFlow 알림 서비스",
"style", "blue"
),
Map.of(
"type", "text",
"text", "TaskFlow 작업 종료 알림",
"inlines", new Object[]{
Map.of(
"type", "styled",
"text", "TaskFlow 작업 종료 알림",
"bold", true
)
}
),
Map.of(
"type", "text",
"text", "TaskFlow 작업 종료 알림",
"inlines", new Object[]{
Map.of(
"type", "styled",
"text", " - Task Title : " + request.taskName(),
"bold", false
)
}
),
Map.of(
"type", "text",
"text", "TaskFlow 작업 종료 알림",
"inlines", new Object[]{
Map.of(
"type", "styled",
"text", " - 거절 사유 : " + request.reason(),
"bold", false
)
}
),
Map.of(
"type", "button",
"text", "확인하기",
"style", "default",
"action", Map.of(
"type", "open_system_browser",
"name", "button1",
"value", taskDetailUrl
)
)
};

String payload;
try {
payload = "{" +
"\"email\":\"" + request.email() + "\"," +
"\"text\":\"작업 종료 알림\"," +
"\"blocks\":" + objectMapper.writeValueAsString(blocks) +
"}";
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}

return payload;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,17 @@ public List<Category> findSubCategory() {
}

@Override
public boolean existsByNameOrCode(String name, String code) {
return categoryRepository.existsByNameOrCodeAndIsDeletedFalse(name, code);
public boolean existsMainCategoryByNameOrCode(String name, String code) {
return categoryRepository.existsByNameOrCodeAndMainCategoryIsNullAndIsDeletedFalse(name, code);
}

@Override
public boolean existsSubCategoryByNameOrCode(Category category, String name, String code) {
CategoryEntity categoryEntity = categoryPersistenceMapper.toEntity(category);
return categoryRepository.existsByMainCategoryAndIsDeletedFalseAndNameOrCode(categoryEntity, name, code);
}


@Override
public void save(final Category category) {
categoryRepository.save(categoryPersistenceMapper.toEntity(category));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ public Page<AnonymousLogEntity> filterAnonymousLogs(FilterLogRequest request, Pa
LocalDateTime fromDate = LocalDateTime.now().minusHours(request.term());
builder.and(anonymousLogEntity.requestAt.after(fromDate));
}
if (!request.logStatus().isEmpty()) {
builder.and(anonymousLogEntity.logStatus.in(request.logStatus()));
}
if (!request.nickName().isEmpty()) {
builder.and(anonymousLogEntity.loginNickname.contains(request.nickName()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
Expand All @@ -13,7 +15,14 @@
@Repository
public interface NotificationRepository extends JpaRepository<NotificationEntity, Long> {

Slice<NotificationEntity> findAllByReceiver_MemberIdOrderByCreatedAtDesc(Long receiverId, Pageable pageable);
@Query("SELECT n FROM NotificationEntity n " +
"JOIN FETCH n.task t " +
"JOIN FETCH n.receiver r " +
"WHERE n.receiver.memberId = :receiverId " +
"AND t.isDeleted = false " +
"ORDER BY n.createdAt DESC")
Slice<NotificationEntity> findAllByReceiver_MemberIdOrderByCreatedAtDesc(
@Param("receiverId") Long receiverId, Pageable pageable);

List<NotificationEntity> findAllByReceiver_MemberId(Long memberId);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package clap.server.adapter.outbound.persistense.repository.task;
import clap.server.adapter.outbound.persistense.entity.task.CategoryEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
Expand All @@ -12,5 +14,9 @@ public interface CategoryRepository extends JpaRepository<CategoryEntity, Long>
List<CategoryEntity> findByIsDeletedFalseAndMainCategoryIsNull();
List<CategoryEntity> findByIsDeletedFalseAndMainCategoryIsNotNull();

boolean existsByNameOrCodeAndIsDeletedFalse(String name, String code);
@Query("SELECT CASE WHEN COUNT(c) > 0 THEN true ELSE false END FROM CategoryEntity c WHERE c.mainCategory IS NULL AND c.isDeleted = false AND (c.name = :name OR c.code = :code)")
boolean existsByNameOrCodeAndMainCategoryIsNullAndIsDeletedFalse(@Param("name") String name, @Param("code") String code);

@Query("SELECT CASE WHEN COUNT(c) > 0 THEN true ELSE false END FROM CategoryEntity c WHERE c.mainCategory = :mainCategory AND c.isDeleted = false AND (c.name = :name OR c.code = :code)")
boolean existsByMainCategoryAndIsDeletedFalseAndNameOrCode(@Param("mainCategory")CategoryEntity mainCategory, @Param("name") String name, @Param("code") String code);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.util.List;


public class AdminResponseMapper {
private AdminResponseMapper() {
throw new IllegalStateException("Utility class");
Expand All @@ -26,7 +27,8 @@ public static RetrieveAllMemberResponse toRetrieveAllMemberResponse(Member membe
member.getMemberInfo().getDepartment().getName(),
member.getMemberInfo().getRole(),
member.getMemberInfo().getDepartmentRole(),
member.getCreatedAt()
member.getCreatedAt(),
member.getStatus()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ public class CategoryResponseMapper {
private CategoryResponseMapper() {throw new IllegalStateException("Utility class");}

public static FindAllCategoryResponse toFindAllCategoryResponse(
Long id,
Long mainCategoryId,
String name,
String code,
List<FindSubCategoryResponse> subCategoryResponses) {
return new FindAllCategoryResponse(id, name, code, subCategoryResponses);
return new FindAllCategoryResponse(mainCategoryId, name, code, subCategoryResponses);
}

public static FindMainCategoryResponse toFindMainCategoryResponse(Category category) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ public interface LoadCategoryPort {
List<Category> findMainCategory();
List<Category> findSubCategory();

boolean existsByNameOrCode(String name, String code);
boolean existsMainCategoryByNameOrCode(String name, String code);

boolean existsSubCategoryByNameOrCode(Category category, String name, String code);
}
Loading
Loading