Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.withtime.be.withtimebe.domain.date.preference.dto.DatePreferenceResponseDTO;
import org.withtime.be.withtimebe.domain.date.preference.entity.enums.PreferenceType;
import org.withtime.be.withtimebe.domain.date.preference.service.command.DatePreferenceTestCommandService;
import org.withtime.be.withtimebe.domain.date.preference.service.command.DatePreferenceTestResultCommandService;
import org.withtime.be.withtimebe.domain.date.preference.service.query.DatePreferenceDescriptionQueryService;
import org.withtime.be.withtimebe.domain.date.preference.service.query.DatePreferenceQuestionQueryService;
import org.withtime.be.withtimebe.domain.date.preference.service.query.DatePreferenceTypeRelationQueryService;
Expand All @@ -25,6 +26,7 @@
public class DatePreferenceController {

private final DatePreferenceTestCommandService datePreferenceTestCommandService;
private final DatePreferenceTestResultCommandService datePreferenceTestResultCommandService;
private final DatePreferenceTypeRelationQueryService datePreferenceTypeRelationQueryService;
private final DatePreferenceDescriptionQueryService datePreferenceDescriptionQueryService;
private final DatePreferenceQuestionQueryService datePreferenceQuestionQueryService;
Expand Down Expand Up @@ -76,4 +78,11 @@ public DefaultResponse<DatePreferenceResponseDTO.FindRelationType> findRelationT
return DefaultResponse.ok(datePreferenceTypeRelationQueryService.findTypeRelations(type));
}

@Operation(summary = "유형 데이터 초기화 API by 요시", description = "로그인된 사용자의 취향 데이터를 초기화하는 API")
@DeleteMapping
public DefaultResponse<Void> resetDatePreferenceData(@AuthenticatedMember Member member) {
datePreferenceTestResultCommandService.resetDatePreferenceData(member);
return DefaultResponse.noContent();
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package org.withtime.be.withtimebe.domain.date.preference.repository;

import org.withtime.be.withtimebe.domain.date.preference.entity.DatePreferenceTestResult;
import org.withtime.be.withtimebe.domain.member.entity.Member;

public interface DatePreferenceTestResultRepository {
DatePreferenceTestResult save(DatePreferenceTestResult datePreferenceTestResult);
void deleteAllByMember(Member member);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.withtime.be.withtimebe.domain.date.preference.service.command;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.withtime.be.withtimebe.domain.date.preference.repository.DatePreferenceTestResultRepository;
import org.withtime.be.withtimebe.domain.member.entity.Member;

@Service
@Transactional
@RequiredArgsConstructor
public class DatePreferenceTestResultCommandImpl implements DatePreferenceTestResultCommandService {

private final DatePreferenceTestResultRepository datePreferenceTestResultRepository;

@Override
public void resetDatePreferenceData(Member member) {
datePreferenceTestResultRepository.deleteAllByMember(member);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.withtime.be.withtimebe.domain.date.preference.service.command;

import org.withtime.be.withtimebe.domain.member.entity.Member;

public interface DatePreferenceTestResultCommandService {
void resetDatePreferenceData(Member member);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class MemberController {
private final MemberCommandService memberCommandService;
private final MemberQueryService memberQueryService;

@Operation(summary = "비밀번호 변경 API", description = "현재 비밀번호가 맞으면 새로운 비밀번호로 변경")
@Operation(summary = "비밀번호 변경 API by 요시", description = "현재 비밀번호가 맞으면 새로운 비밀번호로 변경")
@ApiResponses({
@ApiResponse(responseCode = "204", description = "비밀번호 변경 성공"),
@ApiResponse(
Expand Down Expand Up @@ -58,7 +58,7 @@ public DefaultResponse<Void> changePassword(@AuthenticatedMember Member member,
return DefaultResponse.noContent();
}

@Operation(summary = "사용자 정보 변경 API", description = "사용자 정보 변경, 사용자를 쿠키로 인식하여 정보를 변경")
@Operation(summary = "사용자 정보 변경 API by 요시", description = "사용자 정보 변경, 사용자를 쿠키로 인식하여 정보를 변경")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "정보 변경 성공"),
@ApiResponse(
Expand All @@ -76,15 +76,15 @@ public DefaultResponse<MemberResponseDTO.ChangeInfo> changeInfo(@AuthenticatedMe
return DefaultResponse.ok(MemberConverter.toChangeInfo(updatedMember));
}

@Operation(summary = "회원 탈퇴하기 API", description = "로그인된 토큰을 이용하여 회원 탈퇴하는 API")
@Operation(summary = "회원 탈퇴하기 API by 요시", description = "로그인된 토큰을 이용하여 회원 탈퇴하는 API")
@ApiResponse(responseCode = "204", description = "회원 탈퇴 성공 (soft delete)")
@DeleteMapping
public DefaultResponse<Void> deleteMember(@AuthenticatedMember Member member) {
memberCommandService.deleteMember(member.getId());
return DefaultResponse.noContent();
}

@Operation(summary = "사용자 정보 가져오는 API", description = "로그인된 사용자 정보 가져오는 API")
@Operation(summary = "사용자 정보 가져오는 API by 요시", description = "로그인된 사용자 정보 가져오는 API")
@ApiResponse(responseCode = "200", description = "사용자 정보를 가져왔습니다.")
@GetMapping("/infos")
public DefaultResponse<MemberResponseDTO.MemberInfo> getMemberInfo(@AuthenticatedMember Member member) {
Expand Down