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] 선물방 이미지 default값 설정 코드 수정 #83

Merged
merged 1 commit into from
Jan 17, 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
3 changes: 1 addition & 2 deletions src/main/java/org/sopt/sweet/domain/room/entity/Room.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
public class Room extends BaseTimeEntity {

private static final int DEFAULT_NUMBER = 1;
private static final String DEFAULT_IMAGE_URL = "https://sweet-gift-bucket.s3.ap-northeast-2.amazonaws.com/sweet.png";

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down Expand Up @@ -50,7 +49,7 @@ public class Room extends BaseTimeEntity {
@Builder
public Room(String gifteeName, String imageUrl, LocalDateTime deliveryDate, LocalDateTime tournamentStartDate, TournamentDuration tournamentDuration, String invitationCode, Member host) {
this.gifteeName = gifteeName;
this.imageUrl = DEFAULT_IMAGE_URL;
this.imageUrl = imageUrl;
this.gifterNumber = DEFAULT_NUMBER;
this.deliveryDate = deliveryDate;
this.tournamentStartDate = tournamentStartDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class RoomService {
private final GiftRepository giftRepository;
private final ProductRepository productRepository;
private static final String CHARACTERS = "abcdefghijklmnopqrstuvwxyz0123456789";
private static final String DEFAULT_IMAGE_URL = "https://sweet-gift-bucket.s3.ap-northeast-2.amazonaws.com/sweet.png";
private static final int CODE_LENGTH = 6;
private static final int MAX_GIFTER_NUMBER = 8;

Expand All @@ -52,7 +53,7 @@ public CreateRoomResponseDto createNewRoom(Long memberId, CreateRoomRequestDto c
String invitationCode = generateUniqueInvitationCode();
Room room = Room.builder()
.gifteeName(createRoomRequestDto.gifteeName())
.imageUrl(createRoomRequestDto.imageUrl())
.imageUrl(createRoomRequestDto.imageUrl() != null ? createRoomRequestDto.imageUrl() : DEFAULT_IMAGE_URL)
.deliveryDate(createRoomRequestDto.deliveryDate())
.tournamentStartDate(createRoomRequestDto.tournamentStartDate())
.tournamentDuration(createRoomRequestDto.tournamentDuration())
Expand Down Expand Up @@ -152,7 +153,7 @@ public RoomMemberDetailDto getRoomMembers(Long memberId, Long roomId) {
List<RoomMember> roomMembers = roomMemberRepository.findByRoomId(roomId);
List<RoomMemberDto> roomMemberDtoList = mapToRoomMemberDtoList(roomMembers);
RoomDto roomDto = new RoomDto(room.getGifteeName(), room.getGifterNumber());
OwnerDto ownerDto = new OwnerDto(room.getHost().getId(), room.getHost().getProfileImg(),room.getHost().getNickName());
OwnerDto ownerDto = new OwnerDto(room.getHost().getId(), room.getHost().getProfileImg(), room.getHost().getNickName());
return RoomMemberDetailDto.of(roomDto, ownerDto, roomMemberDtoList);
}

Expand Down