Skip to content

Commit

Permalink
Merge feature/#34 into feature/#29
Browse files Browse the repository at this point in the history
  • Loading branch information
runasy-koonta committed May 26, 2024
1 parent 1c31501 commit c21001d
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ChatRoomService {
private final ChatRoomUserRepository chatRoomUserRepository;

public void updateAlarmStatus(Long userId, Long chatRoomId) {
ChatRoomUser chatRoomUser = chatRoomUserRepository.findChatRoomUserByUserIdAndChatRoomId(userId, chatRoomId)
ChatRoomUser chatRoomUser = chatRoomUserRepository.findChatRoomUserByAccountIdAndChatRoomId(userId, chatRoomId)
.orElseThrow(() -> new IllegalArgumentException("ChatRoomUser not found"));
chatRoomUser.toggleAlarm();
chatRoomUserRepository.save(chatRoomUser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class ChatRoomUser extends BaseEntity {
private Alarm alarm;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
@JoinColumn(name = "account_id")
private Account account;

@ManyToOne(fetch = FetchType.LAZY)
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/meltingpot/server/domain/entity/party/Party.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.*;
import meltingpot.server.domain.entity.Area;
import meltingpot.server.domain.entity.Account;
import meltingpot.server.domain.entity.chat.ChatRoom;
import meltingpot.server.domain.entity.common.BaseEntity;
import meltingpot.server.domain.entity.party.enums.PartyStatus;

Expand Down Expand Up @@ -60,17 +61,18 @@ public class Party extends BaseEntity {
private int partyMinParticipant;

@NotNull
@Column(name = "party_max_participant", nullable = false)
private int partyMaxParticipant;

@NotNull
@Column(name = "part_max_participant", nullable = false)
private Integer partMaxParticipant;

@OneToMany(mappedBy = "party", fetch = FetchType.EAGER, cascade = CascadeType.REMOVE)
@Builder.Default
private List<PartyContent> partyContents = new ArrayList<>();

@OneToMany(mappedBy = "party", fetch = FetchType.EAGER, cascade = CascadeType.REMOVE)
@Builder.Default
private List<PartyParticipant> partyParticipants = new ArrayList<>();

@OneToOne(mappedBy = "party", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
@Builder.Default
private ChatRoom chatRoom = null;
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

public interface ChatRoomUserRepository extends JpaRepository<ChatRoomUser, Long> {
int countChatRoomUsersByChatRoomId(Long chatRoomId);
Optional<ChatRoomUser> findChatRoomUserByUserIdAndChatRoomId(Long userId, Long chatRoomId);
Optional<ChatRoomUser> findChatRoomUserByAccountIdAndChatRoomId(Long userId, Long chatRoomId);
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
package meltingpot.server.domain.repository.party;

import meltingpot.server.domain.entity.party.Party;
import meltingpot.server.domain.entity.party.PartyParticipant;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

public interface PartyParticipantRepository extends JpaRepository<PartyParticipant, Long> {
int countByPartyId(Long partyId);
int countByUserId(Long userId);
List<PartyParticipant> findAllByUserId(Long userId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
import meltingpot.server.domain.entity.party.PartyParticipant;
import org.springframework.data.jpa.repository.JpaRepository;

public interface PartyRepository extends JpaRepository<Party, Long> {
public interface PartyRepository extends JpaRepository<Party, Integer> {
Party findByChatRoomId(Long chatRoomId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import meltingpot.server.domain.entity.party.PartyParticipant;
import meltingpot.server.domain.entity.party.enums.ParticipantStatus;
import meltingpot.server.domain.entity.party.enums.PartyStatus;
import meltingpot.server.domain.repository.PartyParticipantRepository;
import meltingpot.server.domain.repository.PartyRepository;
import meltingpot.server.domain.repository.party.PartyParticipantRepository;
import meltingpot.server.domain.repository.party.PartyRepository;
import meltingpot.server.party.dto.PartyResponse;
import meltingpot.server.util.ResponseCode;
import org.springframework.stereotype.Service;
Expand Down

0 comments on commit c21001d

Please sign in to comment.