Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] 체크리스트 오타 수정 #60

Merged
merged 2 commits into from
Jan 24, 2024
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 @@ -25,6 +25,7 @@ public ResponseEntity<SuccessResponse<?>> createCheckList(@UserId final Long use
@PatchMapping("/my")
public ResponseEntity<SuccessResponse<?>> updateCheckList(@UserId final Long userId,
@RequestBody final CheckListRequestDto checkListRequestDto) {
System.out.println("my logs " + checkListRequestDto.cleanType());
checkListService.updateCheckList(userId, checkListRequestDto);
return SuccessResponse.ok(null);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.gachon.checkmate.domain.checkList.converter;

import jakarta.persistence.Converter;
import org.gachon.checkmate.domain.checkList.entity.SleepGrindingType;
import org.gachon.checkmate.global.utils.AbstractEnumCodeAttributeConverter;

@Converter
public class SleepGrindingTypeConverter extends AbstractEnumCodeAttributeConverter<SleepGrindingType> {
public SleepGrindingTypeConverter() {
super(SleepGrindingType.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public record CheckListRequestDto(
LifePatternType lifePatternType,
CallType callType,
EarPhoneType earPhoneType,
SleepGridingType sleepGridingType,
SleepGrindingType sleepGrindingType,
SleepSnoreType sleepSnoreType,
SleepTalkingType sleepTalkingType,
SleepTurningType sleepTurningType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package org.gachon.checkmate.domain.checkList.dto.response;

import lombok.Builder;
import org.gachon.checkmate.domain.checkList.entity.*;
import org.gachon.checkmate.domain.checkList.entity.CheckList;
import org.gachon.checkmate.domain.checkList.entity.PostCheckList;

@Builder
public record CheckListResponseDto(
String cleanType,
String drinkType,
String homeType,
String lifePatterType,
String lifePatternType,
String callType,
String earPhoneType,
String sleepGridingType,
String sleepGrindingType,
String sleepSnoreType,
String sleepTalkingType,
String sleepTurningType,
Expand All @@ -22,10 +23,10 @@ public static CheckListResponseDto of(CheckList checkList) {
.cleanType(checkList.getCleanType().getDesc())
.drinkType(checkList.getDrinkType().getDesc())
.homeType(checkList.getHomeType().getDesc())
.lifePatterType(checkList.getLifePatternType().getDesc())
.callType(checkList.getCallType().getCode())
.earPhoneType(checkList.getEarPhoneType().getCode())
.sleepGridingType(checkList.getSleepGridingType().getDesc())
.lifePatternType(checkList.getLifePatternType().getDesc())
.callType(checkList.getCallType().getDesc())
.earPhoneType(checkList.getEarPhoneType().getDesc())
.sleepGrindingType(checkList.getSleepGrindingType().getDesc())
.sleepSnoreType(checkList.getSleepSnoreType().getDesc())
.sleepTalkingType(checkList.getSleepTalkingType().getDesc())
.sleepTurningType(checkList.getSleepTurningType().getDesc())
Expand All @@ -38,10 +39,10 @@ public static CheckListResponseDto ofPostCheckList(PostCheckList checkList) {
.cleanType(checkList.getCleanType().getDesc())
.drinkType(checkList.getDrinkType().getDesc())
.homeType(checkList.getHomeType().getDesc())
.lifePatterType(checkList.getLifePatternType().getDesc())
.callType(checkList.getCallType().getCode())
.earPhoneType(checkList.getEarPhoneType().getCode())
.sleepGridingType(checkList.getSleepGridingType().getDesc())
.lifePatternType(checkList.getLifePatternType().getDesc())
.callType(checkList.getCallType().getDesc())
.earPhoneType(checkList.getEarPhoneType().getDesc())
.sleepGrindingType(checkList.getSleepGrindingType().getDesc())
.sleepSnoreType(checkList.getSleepSnoreType().getDesc())
.sleepTalkingType(checkList.getSleepTalkingType().getDesc())
.sleepTurningType(checkList.getSleepTurningType().getDesc())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public class CheckList extends BaseTimeEntity {
private CallType callType;
@Convert(converter = EarPhoneTypeConverter.class)
private EarPhoneType earPhoneType;
@Convert(converter = SleepGridingTypeConverter.class)
private SleepGridingType sleepGridingType;
@Convert(converter = SleepGrindingTypeConverter.class)
private SleepGrindingType sleepGrindingType;
@Convert(converter = SleepSnoreTypeConverter.class)
private SleepSnoreType sleepSnoreType;
@Convert(converter = SleepTalkingTypeConverter.class)
Expand All @@ -51,7 +51,7 @@ public static CheckList createCheckList(User user, CheckListRequestDto checkList
.lifePatternType(checkListRequestDto.lifePatternType())
.callType(checkListRequestDto.callType())
.earPhoneType(checkListRequestDto.earPhoneType())
.sleepGridingType(checkListRequestDto.sleepGridingType())
.sleepGrindingType(checkListRequestDto.sleepGrindingType())
.sleepSnoreType(checkListRequestDto.sleepSnoreType())
.sleepTalkingType(checkListRequestDto.sleepTalkingType())
.sleepTurningType(checkListRequestDto.sleepTurningType())
Expand All @@ -69,7 +69,7 @@ public void updateCheckList(CheckListRequestDto checkListRequestDto) {
this.lifePatternType = checkListRequestDto.lifePatternType();
this.callType = checkListRequestDto.callType();
this.earPhoneType = checkListRequestDto.earPhoneType();
this.sleepGridingType = checkListRequestDto.sleepGridingType();
this.sleepGrindingType = checkListRequestDto.sleepGrindingType();
this.sleepSnoreType = checkListRequestDto.sleepSnoreType();
this.sleepTalkingType = checkListRequestDto.sleepTalkingType();
this.sleepTurningType = checkListRequestDto.sleepTurningType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public class PostCheckList extends BaseTimeEntity {
private CallType callType;
@Convert(converter = EarPhoneTypeConverter.class)
private EarPhoneType earPhoneType;
@Convert(converter = SleepGridingTypeConverter.class)
private SleepGridingType sleepGridingType;
@Convert(converter = SleepGrindingTypeConverter.class)
private SleepGrindingType sleepGrindingType;
@Convert(converter = SleepSnoreTypeConverter.class)
private SleepSnoreType sleepSnoreType;
@Convert(converter = SleepTalkingTypeConverter.class)
Expand All @@ -51,7 +51,7 @@ public static PostCheckList createPostCheckList(CheckListRequestDto checkListReq
.lifePatternType(checkListRequestDto.lifePatternType())
.callType(checkListRequestDto.callType())
.earPhoneType(checkListRequestDto.earPhoneType())
.sleepGridingType(checkListRequestDto.sleepGridingType())
.sleepGrindingType(checkListRequestDto.sleepGrindingType())
.sleepSnoreType(checkListRequestDto.sleepSnoreType())
.sleepTalkingType(checkListRequestDto.sleepTalkingType())
.sleepTurningType(checkListRequestDto.sleepTurningType())
Expand All @@ -69,7 +69,7 @@ public void updatePostCheckList(CheckListRequestDto checkListRequestDto) {
this.lifePatternType = checkListRequestDto.lifePatternType();
this.callType = checkListRequestDto.callType();
this.earPhoneType = checkListRequestDto.earPhoneType();
this.sleepGridingType = checkListRequestDto.sleepGridingType();
this.sleepGrindingType = checkListRequestDto.sleepGrindingType();
this.sleepSnoreType = checkListRequestDto.sleepSnoreType();
this.sleepTalkingType = checkListRequestDto.sleepTalkingType();
this.sleepTurningType = checkListRequestDto.sleepTurningType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

@AllArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
public enum SleepGridingType implements EnumField {
TRUE("1", "코골이"),
public enum SleepGrindingType implements EnumField {
TRUE("1", "이갈이"),
FALSE("2", "false");

private final String code;
private final String desc;

public int compareRateTo(SleepGridingType e) {
public int compareRateTo(SleepGrindingType e) {
return this.equals(e) ? 1 : 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
public enum SleepSnoreType implements EnumField {
TRUE("1", "이갈이"),
TRUE("1", "코골이"),
FALSE("2", "false");

private final String code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static int getAccuracy(PostCheckList postCheckList, CheckList checkList)
count += postCheckList.getLifePatternType().compareRateTo(checkList.getLifePatternType());
count += postCheckList.getCallType().compareRateTo(checkList.getCallType());
count += postCheckList.getEarPhoneType().compareRateTo(checkList.getEarPhoneType());
count += postCheckList.getSleepGridingType().compareRateTo(checkList.getSleepGridingType());
count += postCheckList.getSleepGrindingType().compareRateTo(checkList.getSleepGrindingType());
count += postCheckList.getSleepSnoreType().compareRateTo(checkList.getSleepSnoreType());
count += postCheckList.getSleepTalkingType().compareRateTo(checkList.getSleepTalkingType());
count += postCheckList.getSleepTurningType().compareRateTo(checkList.getSleepTurningType());
Expand Down