-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [COZY-102] feat: 사용자 상세정보 수정 / 조회 [COZY-102] feat: Controller 코드 추가 [COZY-102] feat: 수정, 조회 Service 코드 추가 [COZY-102] feat: toEntity를 업데이트 로직과 함께 사용 가능하게 변경하기 [COZY-102] feat: Request DTO 클래스 생성(Query) [COZY-102] feat: Response DTO 세부 클래스 생성(Command) [COZY-102] feat: TimeUtil 오탈자 수정 [COZY-102] feat: 불필요한 Import 제거 * [COZY-102] fix: 중괄호 수정 * [COZY-102] refactor: fixed update logic, common code
- Loading branch information
Showing
9 changed files
with
230 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 62 additions & 27 deletions
89
...in/java/com/cozymate/cozymate_server/domain/memberstat/converter/MemberStatConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,77 @@ | ||
package com.cozymate.cozymate_server.domain.memberstat.converter; | ||
|
||
import com.cozymate.cozymate_server.domain.member.Member; | ||
import com.cozymate.cozymate_server.domain.memberstat.dto.MemberStatRequestDTO; | ||
import com.cozymate.cozymate_server.domain.memberstat.MemberStat; | ||
import com.cozymate.cozymate_server.domain.memberstat.dto.MemberStatRequestDTO.MemberStatCreateRequestDTO; | ||
import com.cozymate.cozymate_server.domain.memberstat.MemberStat.MemberStatBuilder; | ||
import com.cozymate.cozymate_server.domain.memberstat.dto.MemberStatRequestDTO.MemberStatCommandRequestDTO; | ||
import com.cozymate.cozymate_server.domain.memberstat.dto.MemberStatResponseDTO.MemberStatQueryResponseDTO; | ||
import com.cozymate.cozymate_server.domain.university.University; | ||
import com.cozymate.cozymate_server.global.utils.TimeUtil; | ||
|
||
public class MemberStatConverter { | ||
|
||
public static MemberStat toEntity( | ||
Member member, University university, MemberStatCreateRequestDTO memberStatCreateRequestDTO) { | ||
return MemberStat.builder() | ||
Long memberStatId, Member member, University university, MemberStatCommandRequestDTO memberStatCommandRequestDTO) { | ||
MemberStatBuilder builder = MemberStat.builder() | ||
.member(member) | ||
.university(university) | ||
.admissionYear(Integer.parseInt(memberStatCreateRequestDTO.getAdmissionYear())) | ||
.major(memberStatCreateRequestDTO.getMajor()) | ||
.numOfRoommate(memberStatCreateRequestDTO.getNumOfRoommate()) | ||
.acceptance(memberStatCreateRequestDTO.getAcceptance()) | ||
.wakeUpTime(TimeUtil.convertTime(memberStatCreateRequestDTO.getWakeUpMeridian(), memberStatCreateRequestDTO.getWakeUpTime())) | ||
.sleepingTime(TimeUtil.convertTime(memberStatCreateRequestDTO.getSleepingMeridian(), memberStatCreateRequestDTO.getSleepingTime())) | ||
.turnOffTime(TimeUtil.convertTime(memberStatCreateRequestDTO.getTurnOffMeridian(), memberStatCreateRequestDTO.getTurnOffTime())) | ||
.smoking(memberStatCreateRequestDTO.getSmokingState()) | ||
.sleepingHabit(memberStatCreateRequestDTO.getSleepingHabit()) | ||
.airConditioningIntensity(memberStatCreateRequestDTO.getAirConditioningIntensity()) | ||
.heatingIntensity(memberStatCreateRequestDTO.getHeatingIntensity()) | ||
.lifePattern(memberStatCreateRequestDTO.getLifePattern()) | ||
.intimacy(memberStatCreateRequestDTO.getIntimacy()) | ||
.canShare(memberStatCreateRequestDTO.getCanShare()) | ||
.isPlayGame(memberStatCreateRequestDTO.getIsPlayGame()) | ||
.isPhoneCall(memberStatCreateRequestDTO.getIsPhoneCall()) | ||
.studying(memberStatCreateRequestDTO.getStudying()) | ||
.cleanSensitivity(memberStatCreateRequestDTO.getCleanSensitivity()) | ||
.noiseSensitivity(memberStatCreateRequestDTO.getNoiseSensitivity()) | ||
.cleaningFrequency(memberStatCreateRequestDTO.getCleaningFrequency()) | ||
.personality(memberStatCreateRequestDTO.getPersonality()) | ||
.mbti(memberStatCreateRequestDTO.getMbti()) | ||
.options(memberStatCreateRequestDTO.getOptions()) | ||
.admissionYear(Integer.parseInt(memberStatCommandRequestDTO.getAdmissionYear())) | ||
.major(memberStatCommandRequestDTO.getMajor()) | ||
.numOfRoommate(memberStatCommandRequestDTO.getNumOfRoommate()) | ||
.acceptance(memberStatCommandRequestDTO.getAcceptance()) | ||
.wakeUpTime(TimeUtil.convertTime(memberStatCommandRequestDTO.getWakeUpMeridian(), memberStatCommandRequestDTO.getWakeUpTime())) | ||
.sleepingTime(TimeUtil.convertTime(memberStatCommandRequestDTO.getSleepingMeridian(), memberStatCommandRequestDTO.getSleepingTime())) | ||
.turnOffTime(TimeUtil.convertTime(memberStatCommandRequestDTO.getTurnOffMeridian(), memberStatCommandRequestDTO.getTurnOffTime())) | ||
.smoking(memberStatCommandRequestDTO.getSmokingState()) | ||
.sleepingHabit(memberStatCommandRequestDTO.getSleepingHabit()) | ||
.airConditioningIntensity(memberStatCommandRequestDTO.getAirConditioningIntensity()) | ||
.heatingIntensity(memberStatCommandRequestDTO.getHeatingIntensity()) | ||
.lifePattern(memberStatCommandRequestDTO.getLifePattern()) | ||
.intimacy(memberStatCommandRequestDTO.getIntimacy()) | ||
.canShare(memberStatCommandRequestDTO.getCanShare()) | ||
.isPlayGame(memberStatCommandRequestDTO.getIsPlayGame()) | ||
.isPhoneCall(memberStatCommandRequestDTO.getIsPhoneCall()) | ||
.studying(memberStatCommandRequestDTO.getStudying()) | ||
.cleanSensitivity(memberStatCommandRequestDTO.getCleanSensitivity()) | ||
.noiseSensitivity(memberStatCommandRequestDTO.getNoiseSensitivity()) | ||
.cleaningFrequency(memberStatCommandRequestDTO.getCleaningFrequency()) | ||
.personality(memberStatCommandRequestDTO.getPersonality()) | ||
.mbti(memberStatCommandRequestDTO.getMbti()) | ||
.options(memberStatCommandRequestDTO.getOptions()); | ||
|
||
if (memberStatId != null) { | ||
builder.id(memberStatId); | ||
} | ||
|
||
return builder.build(); | ||
} | ||
|
||
public static MemberStatQueryResponseDTO toDto(MemberStat memberStat){ | ||
return MemberStatQueryResponseDTO.builder() | ||
.universityId(memberStat.getUniversity().getId()) | ||
.admissionYear(memberStat.getAdmissionYear()) | ||
.major(memberStat.getMajor()) | ||
.numOfRoommate(memberStat.getNumOfRoommate()) | ||
.acceptance(memberStat.getAcceptance()) | ||
.wakeUpTime(memberStat.getWakeUpTime()) | ||
.sleepingTime(memberStat.getSleepingTime()) | ||
.turnOffTime(memberStat.getTurnOffTime()) | ||
.smokingState(memberStat.getSmoking()) | ||
.sleepingHabit(memberStat.getSleepingHabit()) | ||
.airConditioningIntensity(memberStat.getAirConditioningIntensity()) | ||
.heatingIntensity(memberStat.getHeatingIntensity()) | ||
.lifePattern(memberStat.getLifePattern()) | ||
.intimacy(memberStat.getIntimacy()) | ||
.canShare(memberStat.getCanShare()) | ||
.isPlayGame(memberStat.getIsPlayGame()) | ||
.isPhoneCall(memberStat.getIsPhoneCall()) | ||
.studying(memberStat.getStudying()) | ||
.cleanSensitivity(memberStat.getCleanSensitivity()) | ||
.noiseSensitivity(memberStat.getNoiseSensitivity()) | ||
.cleaningFrequency(memberStat.getCleaningFrequency()) | ||
.personality(memberStat.getPersonality()) | ||
.mbti(memberStat.getMbti()) | ||
.options(memberStat.getOptions()) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/java/com/cozymate/cozymate_server/domain/memberstat/dto/MemberStatResponseDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,43 @@ | ||
package com.cozymate.cozymate_server.domain.memberstat.dto; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
public class MemberStatResponseDTO { | ||
// Read를 Query DTO로 관리하기 | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
public static class MemberStatQueryResponseDTO { | ||
|
||
private Long universityId; | ||
private Integer admissionYear; | ||
private String major; | ||
private Integer numOfRoommate; | ||
private String acceptance; | ||
private Integer wakeUpTime; | ||
private Integer sleepingTime; | ||
private Integer turnOffTime; | ||
private String smokingState; | ||
private String sleepingHabit; | ||
private Integer airConditioningIntensity; | ||
private Integer heatingIntensity; | ||
private String lifePattern; | ||
private String intimacy; | ||
private Boolean canShare; | ||
private Boolean isPlayGame; | ||
private Boolean isPhoneCall; | ||
private String studying; | ||
private Integer cleanSensitivity; | ||
private Integer noiseSensitivity; | ||
private String cleaningFrequency; | ||
private String personality; | ||
private String mbti; | ||
private Map<String, List<String>> options; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.