Skip to content

Commit

Permalink
Merge pull request #113 from Team-Packman/feature/PS-92
Browse files Browse the repository at this point in the history
feat: 로그 eventType 추가 및 패킹리스트 수정 api명 세분화
  • Loading branch information
hyeon-z authored Aug 20, 2023
2 parents 5e4b173 + c87e3e3 commit be7e5aa
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/main/java/packman/service/AlarmService.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ public class AlarmService {
public void getAlarm(Long userId) {
validateUserId(userRepository, userId);

LogMessage.setNonDataLog("알림 조회", userId);
LogMessage.setNonDataLog("알림 조회", userId, "click");
}
}
2 changes: 1 addition & 1 deletion src/main/java/packman/service/HelpService.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public class HelpService {
public void getHelp(Long userId) {
validateUserId(userRepository, userId);

LogMessage.setNonDataLog("엿보기 조회", userId);
LogMessage.setNonDataLog("엿보기 조회", userId, "click");
}
}
4 changes: 2 additions & 2 deletions src/main/java/packman/service/ListService.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public ListTitleResponseDto updateTitle(ListTitleRequestDto listTitleRequestDto,
.title(title)
.build();

LogMessage.setNonDataLog("패킹리스트 수정", userId);
LogMessage.setNonDataLog("패킹리스트 제목 수정", userId, "click");

return listTitleResponseDto;
}
Expand Down Expand Up @@ -123,7 +123,7 @@ public DepartureDateResponseDto updateDepartureDate(DepartureDateRequestDto depa
.departureDate(departureDateRequestDto.getDepartureDate())
.build();

LogMessage.setNonDataLog("패킹리스트 수정", userId);
LogMessage.setNonDataLog("패킹리스트 출발 날짜 수정", userId, "click");

return departureDateResponseDto;
}
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/packman/service/PackService.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public ListResponseMapping createAlonePack(PackCreateDto packCreateDto, Long use

ListResponseMapping listResponseMapping = packingListRepository.findByIdAndTitle(aloneListId, packingList.getTitle());

LogMessage.setNonDataLog("패킹리스트 수정", userId);
LogMessage.setNonDataLog("혼자 패킹리스트 짐 생성", userId, "click");

return listResponseMapping;
}
Expand All @@ -54,7 +54,7 @@ public ListResponseMapping createTogetherPack(PackCreateDto packCreateDto, Long

ListResponseMapping listResponseMapping = packingListRepository.findByIdAndTitle(togetherListId, packingList.getTitle());

LogMessage.setNonDataLog("패킹리스트 수정", userId);
LogMessage.setNonDataLog("함께 패킹리스트 짐 생성", userId, "click");

return listResponseMapping;
}
Expand All @@ -81,7 +81,7 @@ public ListResponseMapping updateAlonePack(PackUpdateDto packUpdateDto, Long use

ListResponseMapping listResponseMapping = packingListRepository.findByIdAndTitle(aloneListId, packingList.getTitle());

LogMessage.setNonDataLog("패킹리스트 수정", userId);
LogMessage.setNonDataLog("혼자 패킹리스트 수정", userId, "click");

return listResponseMapping;
}
Expand All @@ -95,7 +95,7 @@ public ListResponseMapping updateTogetherPack(PackUpdateDto packUpdateDto, Long

ListResponseMapping listResponseMapping = packingListRepository.findByIdAndTitle(togetherListId, packingList.getTitle());

LogMessage.setNonDataLog("패킹리스트 수정", userId);
LogMessage.setNonDataLog("함께 패킹리스트 수정", userId, "click");

return listResponseMapping;
}
Expand All @@ -117,14 +117,14 @@ public void deleteAlonePack(Long listId, Long categoryId, Long packId, Long user

packRepository.delete(validateListCategoryPack(packingList, categoryId, packId, categoryRepository, packRepository));

LogMessage.setNonDataLog("패킹리스트 수정", userId);
LogMessage.setNonDataLog("혼자 패킹리스트 짐 삭제", userId, "click");
}

public void deleteTogetherPack(Long listId, Long categoryId, Long packId, Long userId) {
PackingList packingList = validateTogetherList(userId, listId, packingListRepository, togetherPackingListRepository);

packRepository.delete(validateListCategoryPack(packingList, categoryId, packId, categoryRepository, packRepository));

LogMessage.setNonDataLog("패킹리스트 수정", userId);
LogMessage.setNonDataLog("함께 패킹리스트 짐 삭제", userId, "click");
}
}
}
4 changes: 2 additions & 2 deletions src/main/java/packman/service/TemplateService.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public TemplateListResponseDto getAloneTemplateList(Long userId) {
.basicTemplate(basicTemplateRepository.findByUserIdAndIsAlonedAndIsDeletedOrderByCreatedAt(null, true, false))
.myTemplate(templateRepository.findByUserIdAndIsAlonedAndIsDeletedOrderByCreatedAt(userId, true, false)).build();

LogMessage.setNonDataLog("혼자 패킹 템플릿 리스트 조회", userId);
LogMessage.setNonDataLog("혼자 패킹 템플릿 리스트 조회", userId, "screen");

return templateListResponseDto;
}
Expand All @@ -43,7 +43,7 @@ public TemplateListResponseDto getTogetherTemplateList(Long userId) {
.basicTemplate(basicTemplateRepository.findByUserIdAndIsAlonedAndIsDeletedOrderByCreatedAt(null, false, false))
.myTemplate(templateRepository.findByUserIdAndIsAlonedAndIsDeletedOrderByCreatedAt(userId, false, false)).build();

LogMessage.setNonDataLog("함께 패킹 템플릿 리스트 조회", userId);
LogMessage.setNonDataLog("함께 패킹 템플릿 리스트 조회", userId, "screen");

return templateListResponseDto;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/packman/service/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public UserResponseDto createUser(UserCreateDto userCreateDto) {
.path(userCreateDto.getPath())
.build();

LogMessage.setDataLog("닉네임/프로필 등록", userLogDto, createdUser.getId());
LogMessage.setDataLog("닉네임/프로필 등록", userLogDto, createdUser.getId(), "click");

return UserResponseDto.builder()
.isAlreadyUser(true)
Expand Down Expand Up @@ -93,7 +93,7 @@ public void deleteUser(Long userId) {

userRepository.setUserIsDeletedByUserId(userId);

LogMessage.setNonDataLog("유저 탈퇴", userId);
LogMessage.setNonDataLog("유저 탈퇴", userId, "click");
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public ListResponseMapping createCategory(CategoryCreateDto categoryCreateDto, L
// response
ListResponseMapping listResponseMapping = packingListRepository.findByIdAndTitle(Long.parseLong(categoryCreateDto.getListId()), packingList.getTitle());

LogMessage.setNonDataLog("패킹리스트 수정", userId);
LogMessage.setNonDataLog("혼자 패킹리스트 카테고리 생성", userId, "click");

return listResponseMapping;
}
Expand Down Expand Up @@ -76,7 +76,7 @@ public ListResponseMapping updateCategory(CategoryUpdateDto categoryUpdateDto, L
// response
ListResponseMapping categoryResponseDto = packingListRepository.findByIdAndTitle(Long.parseLong(categoryUpdateDto.getListId()), packingList.getTitle());

LogMessage.setNonDataLog("패킹리스트 수정", userId);
LogMessage.setNonDataLog("혼자 패킹리스트 카테고리 수정", userId, "click");

return categoryResponseDto;
}
Expand All @@ -99,6 +99,6 @@ public void deleteCategory(Long listId, Long categoryId, Long userId) {
// delete
categoryRepository.delete(category);

LogMessage.setNonDataLog("패킹리스트 수정", userId);
LogMessage.setNonDataLog("혼자 패킹리스트 카테고리 삭제", userId, "click");
}
}
4 changes: 2 additions & 2 deletions src/main/java/packman/service/aloneList/AloneListService.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public AloneListResponseDto createAloneList(ListCreateDto listCreateDto, Long us
.category(savedCategories.getCategory())
.build();

LogMessage.setDataLog("혼자 패킹리스트 생성", aloneListLogDto, userId);
LogMessage.setDataLog("혼자 패킹리스트 생성", aloneListLogDto, userId, "click");

return AloneListResponseDto.builder()
.id(Long.toString(savedList.getId()))
Expand Down Expand Up @@ -202,7 +202,7 @@ public InviteAloneListResponseDto getInviteAloneList(Long userId, String inviteC
.IsOwner(isOwner)
.build();

LogMessage.setDataLog("혼자 패킹리스트 초대", inviteAloneListResponseDto, userId);
LogMessage.setDataLog("혼자 패킹리스트 초대", inviteAloneListResponseDto, userId, "screen");

return inviteAloneListResponseDto;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public ListResponseMapping createCategory(CategoryCreateDto categoryCreateDto, L
// response
ListResponseMapping categoryResponseDto = packingListRepository.findByIdAndTitle(Long.parseLong(categoryCreateDto.getListId()), packingList.getTitle());

LogMessage.setNonDataLog("패킹리스트 수정", userId);
LogMessage.setNonDataLog("함께 패킹리스트 카테고리 생성", userId, "click");

return categoryResponseDto;
}
Expand Down Expand Up @@ -91,7 +91,7 @@ public ListResponseMapping updateCategory(CategoryUpdateDto categoryUpdateDto, L
// response
ListResponseMapping categoryResponseDto = packingListRepository.findByIdAndTitle(Long.parseLong(categoryUpdateDto.getListId()), packingList.getTitle());

LogMessage.setNonDataLog("패킹리스트 수정", userId);
LogMessage.setNonDataLog("함께 패킹리스트 카테고리 수정", userId, "click");

return categoryResponseDto;
}
Expand All @@ -115,7 +115,7 @@ public void deleteCategory(Long listId, Long categoryId, Long userId) {
// delete
categoryRepository.delete(category);

LogMessage.setNonDataLog("패킹리스트 수정", userId);
LogMessage.setNonDataLog("함께 패킹리스트 카테고리 삭제", userId, "click");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public TogetherListResponseDto createTogetherList(ListCreateDto listCreateDto, L
.category(savedTogetherCategories.getCategory())
.build();

LogMessage.setDataLog("함께 패킹리스트 생성", togetherListLogDto, userId);
LogMessage.setDataLog("함께 패킹리스트 생성", togetherListLogDto, userId, "click");

return togetherListResponseDto;
}
Expand Down Expand Up @@ -318,7 +318,7 @@ public ListResponseMapping updatePacker(PackerUpdateDto packerUpdateDto, Long us

ListResponseMapping listResponseMapping = packingListRepository.findProjectionById(togetherPackingList.getId());

LogMessage.setNonDataLog("패킹리스트 수정", userId);
LogMessage.setNonDataLog("함께 패킹리스트 담당자 배정", userId, "click");

return listResponseMapping;
}
Expand Down Expand Up @@ -369,7 +369,7 @@ public MemberAddResponseDto addMember(MemberAddDto memberAddDto, Long userId) {

MemberAddResponseDto memberAddResponseDto = MemberAddResponseDto.builder().listId(newTogetherAlonePackingList.getId().toString()).build();

LogMessage.setDataLog("함께 패킹리스트 초대 - 그룹원 추가", memberAddResponseDto, userId);
LogMessage.setDataLog("함께 패킹리스트 초대 - 그룹원 추가", memberAddResponseDto, userId, "screen");

return memberAddResponseDto;
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/packman/util/LogMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public class LogMessage {
private static final Logger logger = LoggerFactory.getLogger(LogMessage.class);

public static void setDataLog(String apiName, Object data, Long userId) {
public static void setDataLog(String apiName, Object data, Long userId, String eventType) {
ObjectMapper objectMapper = new ObjectMapper();
String json = "";

Expand All @@ -17,10 +17,10 @@ public static void setDataLog(String apiName, Object data, Long userId) {
} catch (JsonProcessingException e) {
e.printStackTrace();
}
logger.info("PACKMAN, " + apiName + ", userId: " + userId + ", data: " + json);
logger.info("PACKMAN, " + apiName + ", userId: " + userId + ", data: " + json + ", eventType: " + eventType);
}

public static void setNonDataLog(String apiName, Long userId) {
logger.info("PACKMAN, " + apiName + ", userId: " + userId);
public static void setNonDataLog(String apiName, Long userId, String eventType) {
logger.info("PACKMAN, " + apiName + ", userId: " + userId + ", eventType: " + eventType);
}
}

0 comments on commit be7e5aa

Please sign in to comment.