Skip to content

Commit

Permalink
#31 [FEAT] : 그룹생성 api 개발 (그룹알람 생성 포함)
Browse files Browse the repository at this point in the history
  • Loading branch information
hye-on committed Aug 24, 2023
1 parent c79f1f3 commit 822998a
Show file tree
Hide file tree
Showing 22 changed files with 299 additions and 404 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.wakeUpTogetUp.togetUp.api.alarm.model.Alarm;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
Expand All @@ -22,4 +23,9 @@ public interface AlarmRepository extends JpaRepository<Alarm, Integer> {

@Query("select a from Alarm a where a.user.id = :userId")
List<Alarm> findByUserId(@Param(value = "userId") Integer userId);

@Modifying
@Query("update Alarm a set a.room.id = :roomId where a.id = :alarmId")
void updateRoomIdByAlarmId(@Param("alarmId") Integer alarmId, @Param("roomId") Integer roomId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ public class Alarm {

private String name;
private String icon;
@Column(name = "is_vibrate")
private Boolean isVibrate;

@Column(columnDefinition = "TINYINT")
@Column(name = "snooze_interval",columnDefinition = "TINYINT")
private Integer snoozeInterval;

@Column(columnDefinition = "TINYINT")
@Column(name = "snooze_cnt" ,columnDefinition = "TINYINT")
private Integer snoozeCnt;

@Column(columnDefinition = "TIME")
@Column(name = "alarm_time" ,columnDefinition = "TIME")
private String alarmTime;

private Boolean monday;
Expand All @@ -55,6 +56,8 @@ public class Alarm {
private Boolean friday;
private Boolean saturday;
private Boolean sunday;

@Column(name = "is_activated")
private Boolean isActivated;

@Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.wakeUpTogetUp.togetUp.api.room.model.Room;
import com.wakeUpTogetUp.togetUp.common.Status;
import com.wakeUpTogetUp.togetUp.exception.BaseException;
import com.wakeUpTogetUp.togetUp.api.room.GroupRepository;
import com.wakeUpTogetUp.togetUp.api.room.RoomRepository;
import com.wakeUpTogetUp.togetUp.api.users.UserRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
Expand All @@ -18,15 +18,15 @@
public class NotificationService {
private final FcmService fcmService;
private final PushLogService pushLogService;
private final GroupRepository groupRepository;
private final RoomRepository roomRepository;
private final UserRepository userRepository;

// 그룹 채팅 알림 보내기
@Transactional
public PushNotificationRes sendMessageToGroup(int groupId, PushNotificationReq request)
throws ExecutionException, InterruptedException {
// group 조회
Room room = groupRepository.findById(groupId)
Room room = roomRepository.findById(groupId)
.orElseThrow(
() -> new BaseException(Status.INVALID_GROUP_ID)
);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.wakeUpTogetUp.togetUp.api.mission;

import com.wakeUpTogetUp.togetUp.api.room.GroupRepository;
import com.wakeUpTogetUp.togetUp.api.room.RoomRepository;
import com.wakeUpTogetUp.togetUp.api.room.model.Room;
import com.wakeUpTogetUp.togetUp.api.mission.model.Mission;
import com.wakeUpTogetUp.togetUp.common.Status;
Expand All @@ -23,7 +23,7 @@ public class MissionService {
private final MissionRepository missionRepository;
private final MissionLogRepository missionLogRepository;
private final UserRepository userRepository;
private final GroupRepository groupRepository;
private final RoomRepository roomRepository;

public boolean recognizeObject(String object, MultipartFile missionImage) {
// 일치 여부 확인
Expand Down Expand Up @@ -53,7 +53,7 @@ public Integer createMissionLog(int userId, PostMissionLogReq req){

Room room = Objects.isNull(req.getRoomId())
? null
: groupRepository.findById(req.getRoomId())
: roomRepository.findById(req.getRoomId())
.orElseThrow(
() -> new BaseException(Status.INVALID_ALARM_ID));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ public Mission(String name, String object) {
private int id;
private String name;
private String object;
@Column(columnDefinition = "Timestamp")
@Column(name ="created_at",columnDefinition = "Timestamp")
private String createdAt;
@Column(columnDefinition = "Timestamp")
@Column(name = "updated_at" ,columnDefinition = "Timestamp")
private String updatedAt;
@Column(name = "is_active")
private Boolean isActive = true;

// @OneToMany(mappedBy = "mission")
Expand Down

This file was deleted.

87 changes: 0 additions & 87 deletions src/main/java/com/wakeUpTogetUp/togetUp/api/room/GroupService.java

This file was deleted.

Loading

0 comments on commit 822998a

Please sign in to comment.