Skip to content

Commit ac1f14b

Browse files
authored
[refactor] 사용자 로그 관련 코드 리팩토링
[refactor] 사용자 로그 관련 코드 리팩토링
2 parents 1bed0c7 + f4cfc74 commit ac1f14b

2 files changed

Lines changed: 6 additions & 55 deletions

File tree

MathCaptain/weakness/src/main/java/MathCaptain/weakness/domain/Record/dto/response/StudyLogResponse.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,23 @@ public class StudyLogResponse {
1010

1111
private Long activityId;
1212

13+
private Long duration;
14+
1315
private String subject;
1416

1517
private String date;
1618

1719
private String memo;
1820

19-
private StudyLogResponse(Long activityId, String subject, String date, String memo) {
21+
private StudyLogResponse(Long activityId, Long duration, String subject, String date, String memo) {
2022
this.activityId = activityId;
2123
this.subject = subject;
24+
this.duration = duration;
2225
this.date = date;
2326
this.memo = memo;
2427
}
2528

2629
public static StudyLogResponse of(StudyDetail studyDetail) {
27-
return new StudyLogResponse(studyDetail.getActivityId(), studyDetail.getSubject(), studyDetail.getDate().toString(), studyDetail.getMemo());
30+
return new StudyLogResponse(studyDetail.getActivityId(), studyDetail.getDuration(), studyDetail.getSubject(), studyDetail.getDate().toString(), studyDetail.getMemo());
2831
}
2932
}

MathCaptain/weakness/src/main/java/MathCaptain/weakness/domain/Record/service/RecordService.java

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -80,63 +80,11 @@ private RecordSummaryResponse createRecordSummaryResponse(
8080
studyLogResponse = activityDetailService.enrollStudyLog(activityId, (StudyLogEnrollRequest) logRequest);
8181
break;
8282
default:
83-
throw new IllegalArgumentException("Unsupported activity type: " + activityType);
83+
throw new IllegalArgumentException("지원되지 않는 인증 타입입니다: " + activityType);
8484
}
8585

8686
return RecordSummaryResponse.of(record, relation, fitnessLogResponse, runningLogResponse, studyLogResponse);
8787
}
88-
//
89-
// public RecordSummaryResponse endFitnessActivity(Users user, Long groupId, FitnessLogEnrollRequest logRequest) {
90-
// // 활동 기록 저장
91-
// RelationBetweenUserAndGroup relation = findRelationByMemberAndGroup(user, groupId);
92-
// DayOfWeek nowDay = LocalDate.now().getDayOfWeek();
93-
//
94-
// LocalDateTime startTime = logRequest.getStartTime();
95-
// LocalDateTime endTime = logRequest.getEndTime();
96-
// Long duration = logRequest.getActivityTime();
97-
//
98-
// ActivityRecord record = ActivityRecord.of(relation, nowDay, startTime, endTime, duration);
99-
// updateGoalAchieve(relation, record, nowDay);
100-
// Long activityId = recordRepository.save(record).getId();
101-
//
102-
// // 피트니스 로그 저장
103-
// FitnessLogResponse fitnessLogResponse = activityDetailService.enrollFitnessLog(activityId, logRequest);
104-
// return RecordSummaryResponse.of(record, relation, fitnessLogResponse, null, null);
105-
// }
106-
//
107-
// public RecordSummaryResponse endRunningActivity(Users user, Long groupId, RunningLogEnrollRequest logRequest) {
108-
// // 활동 기록 저장
109-
// RelationBetweenUserAndGroup relation = findRelationByMemberAndGroup(user, groupId);
110-
// DayOfWeek nowDay = LocalDate.now().getDayOfWeek();
111-
// LocalDateTime startTime = logRequest.getStartTime();
112-
// LocalDateTime endTime = logRequest.getEndTime();
113-
// Long duration = logRequest.getActivityTime();
114-
//
115-
// ActivityRecord record = ActivityRecord.of(relation, nowDay, startTime, endTime, duration);
116-
// updateGoalAchieve(relation, record, nowDay);
117-
// Long activityId = recordRepository.save(record).getId();
118-
//
119-
// // 러닝 로그 저장
120-
// RunningLogResponse runningLogResponse = activityDetailService.enrollRunningLog(activityId, logRequest);
121-
// return RecordSummaryResponse.of(record, relation, null, runningLogResponse, null);
122-
// }
123-
//
124-
// public RecordSummaryResponse endStudyActivity(Users user, Long groupId, StudyLogEnrollRequest logRequest) {
125-
// // 활동 기록 저장
126-
// RelationBetweenUserAndGroup relation = findRelationByMemberAndGroup(user, groupId);
127-
// DayOfWeek nowDay = LocalDate.now().getDayOfWeek();
128-
// LocalDateTime startTime = logRequest.getStartTime();
129-
// LocalDateTime endTime = logRequest.getEndTime();
130-
// Long duration = logRequest.getActivityTime();
131-
//
132-
// ActivityRecord record = ActivityRecord.of(relation, nowDay, startTime, endTime, duration);
133-
// updateGoalAchieve(relation, record, nowDay);
134-
// Long activityId = recordRepository.save(record).getId();
135-
//
136-
// // 스터디 로그 저장
137-
// StudyLogResponse studyLogResponse = activityDetailService.enrollStudyLog(activityId, logRequest);
138-
// return RecordSummaryResponse.of(record, relation, null, null, studyLogResponse);
139-
// }
14088

14189
// 주간 목표 달성 여부 조회
14290
public Map<DayOfWeek, Boolean> getWeeklyGoalStatus(Users user, Group group, LocalDateTime weekStart) {

0 commit comments

Comments
 (0)