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

chore : 안쓰는 폴더 삭제, db 꼬이는 것 수정 #22

Merged
merged 1 commit into from
Aug 4, 2023
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
Binary file removed logs/app.2023-06-13.0.gz
Binary file not shown.
Binary file removed logs/app.2023-06-17.0.gz
Binary file not shown.
2,908 changes: 69 additions & 2,839 deletions logs/app.log

Large diffs are not rendered by default.

2,562 changes: 30 additions & 2,532 deletions logs/error.log

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import com.wakeUpTogetUp.togetUp.alarm.dto.response.AlarmsRes;
import com.wakeUpTogetUp.togetUp.exception.BaseException;
import com.wakeUpTogetUp.togetUp.common.Status;
import com.wakeUpTogetUp.togetUp.routine.RoutineProvider;
import com.wakeUpTogetUp.togetUp.routine.dto.response.RoutineRes;
import com.wakeUpTogetUp.togetUp.users.UserRepository;
import com.wakeUpTogetUp.togetUp.utils.mapper.EntityDtoMapper;
import lombok.RequiredArgsConstructor;
Expand All @@ -18,7 +16,6 @@
@Service
@RequiredArgsConstructor
public class AlarmProvider {
private final RoutineProvider routineProvider;
private final UserRepository userRepository;
private final AlarmRepository alarmRepository;

Expand Down Expand Up @@ -56,12 +53,8 @@ public AlarmRes getAlarm(Integer alarmId) {
() -> new BaseException(Status.INVALID_ALARM_ID)
);

// 루틴 리스트 가져오기
// 하나도 존재하지 않아도 됨
List<RoutineRes> routineResList = routineProvider.getRoutinesByAlarmId(alarmId);

AlarmRes alarmRes = EntityDtoMapper.INSTANCE.toAlarmRes(alarm);
alarmRes.setRoutineResList(routineResList);

return alarmRes;
}
Expand Down
27 changes: 3 additions & 24 deletions src/main/java/com/wakeUpTogetUp/togetUp/alarm/AlarmService.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
import com.wakeUpTogetUp.togetUp.common.Status;
import com.wakeUpTogetUp.togetUp.mission.MissionRepository;
import com.wakeUpTogetUp.togetUp.mission.model.Mission;
import com.wakeUpTogetUp.togetUp.routine.RoutineProvider;
import com.wakeUpTogetUp.togetUp.routine.RoutineService;
import com.wakeUpTogetUp.togetUp.routine.dto.request.PostRoutineReq;
import com.wakeUpTogetUp.togetUp.users.UserRepository;
import com.wakeUpTogetUp.togetUp.users.model.User;
import com.wakeUpTogetUp.togetUp.utils.mapper.EntityDtoMapper;
Expand All @@ -23,8 +20,6 @@
@Service
@RequiredArgsConstructor
public class AlarmService {
private final RoutineProvider routineProvider;
private final RoutineService routineService;
private final AlarmRepository alarmRepository;
private final UserRepository userRepository;
private final MissionRepository missionRepository;
Expand Down Expand Up @@ -67,14 +62,8 @@ public AlarmRes createAlarm(Integer userId, PostAlarmReq postAlarmReq) {
Alarm alarmCreated = alarmRepository.save(alarm);
AlarmRes alarmRes = EntityDtoMapper.INSTANCE.toAlarmRes(alarmCreated);

// 루틴 리스트가 있으면
if(!Objects.isNull(postAlarmReq.getRoutineList())) {
// 루틴 리스트 생성
for(PostRoutineReq routineReq : postAlarmReq.getRoutineList()) {
routineService.createRoutine(routineReq, alarmCreated);
}
alarmRes.setRoutineResList(routineProvider.getRoutinesByAlarmId(alarmCreated.getId()));
}


return alarmRes;
}

Expand Down Expand Up @@ -113,17 +102,7 @@ public AlarmRes updateAlarm(Integer userId, Integer alarmId, PatchAlarmReq patch
Alarm alarmModified = alarmRepository.save(alarm);
AlarmRes alarmRes = EntityDtoMapper.INSTANCE.toAlarmRes(alarmModified);

// 연관 루틴 삭제
routineService.deleteRoutinesByAlarmId(alarmId);

// 루틴 리스트 재생성
if(!Objects.isNull(patchAlarmReq.getRoutineList())) {
// 루틴 리스트 생성
for(PostRoutineReq routineReq : patchAlarmReq.getRoutineList()) {
routineService.createRoutine(routineReq, alarmModified);
}
alarmRes.setRoutineResList(routineProvider.getRoutinesByAlarmId(alarmModified.getId()));
}


return alarmRes;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.wakeUpTogetUp.togetUp.alarm.dto.request;

import com.wakeUpTogetUp.togetUp.routine.dto.request.PostRoutineReq;
import lombok.*;

import java.sql.Time;
Expand Down Expand Up @@ -28,5 +27,4 @@ public class PatchAlarmReq {
private Boolean friday;
private Boolean saturday;
private Boolean sunday;
private List<PostRoutineReq> routineList;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.wakeUpTogetUp.togetUp.alarm.dto.request;

import com.wakeUpTogetUp.togetUp.routine.dto.request.PostRoutineReq;
import lombok.*;

import javax.validation.constraints.NotBlank;
Expand Down Expand Up @@ -34,5 +33,4 @@ public class PostAlarmReq {
private Boolean friday;
private Boolean saturday;
private Boolean sunday;
private List<PostRoutineReq> routineList; // 알람에 등록할 루틴 리스트
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.wakeUpTogetUp.togetUp.alarm.dto.response;

import com.wakeUpTogetUp.togetUp.routine.dto.response.RoutineRes;

import lombok.*;

import java.util.List;
Expand Down Expand Up @@ -30,5 +30,4 @@ public class AlarmRes {
private Boolean saturday;
private Boolean sunday;
private Boolean isActivated;
private List<RoutineRes> routineResList;
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,13 @@ public void modifyProperties(Mission mission, String name, String icon, String s
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(columnDefinition = "INT UNSIGNED")
private Integer id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "userId")
@JoinColumn(name = "userId",columnDefinition = "INT UNSIGNED")
private User user;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "missionId")
private Mission mission;
Expand Down
19 changes: 3 additions & 16 deletions src/main/java/com/wakeUpTogetUp/togetUp/avatar/model/Avatar.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,9 @@ public class Avatar {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(columnDefinition = "INT UNSIGNED")
private Integer id = null;

// @Column(name = "avatarPicLink",columnDefinition = "TEXT")
// private String avatarPicLink;

@Column(name = "hair",length = 30)
private String hair;
@Column(name = "top",length = 30)
private String top;

@Column(name = "bottom",length = 30)
private String bottom;
@Column(name = "effect",length = 30)
private String effect;

@Column(name = "createdAt")
private Timestamp createdAt;
Expand All @@ -42,12 +31,10 @@ public class Avatar {


@OneToOne
@JoinColumn(name = "userId")
@JoinColumn(name = "userId",columnDefinition = "INT UNSIGNED")
private User user;

@Column(name="isActivated",columnDefinition = "TINYINT", length=1)
@ColumnDefault("1")
private int isActivated;


@PrePersist
void createdAt() {
Expand Down
39 changes: 0 additions & 39 deletions src/main/java/com/wakeUpTogetUp/togetUp/chat/ChatController.java

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading