-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #231 from haedoang/feature/room-with-user
[feature/room-with-user] room api 작성
- Loading branch information
Showing
12 changed files
with
122 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,18 +81,17 @@ CommandLineRunner commandLineRunner( | |
initFurnishings(furnishingRepository); | ||
initLocations(locationRepository); | ||
initLanguages(languageRepository); | ||
//FIXME 테스트 후 제거 예정 | ||
initRooms(roomRepository, locationRepository, furnishingRepository, imageFileRepository); | ||
initUser(userRepository, encoder); | ||
User user = initUser(userRepository, encoder); | ||
initRooms(roomRepository, locationRepository, furnishingRepository, imageFileRepository, user); | ||
}; | ||
} | ||
|
||
private void initUser(UserRepository userRepository, PasswordEncoder encoder) { | ||
private User initUser(UserRepository userRepository, PasswordEncoder encoder) { | ||
final User user = User.builder() | ||
.email("[email protected]") | ||
.build(); | ||
user.setPassword(encoder.encode("test1234!@")); | ||
userRepository.save(user); | ||
return userRepository.save(user); | ||
} | ||
|
||
private void initImageFiles(ImageFileRepository imageFileRepository) { | ||
|
@@ -105,7 +104,7 @@ private void initImageFiles(ImageFileRepository imageFileRepository) { | |
} | ||
|
||
private void initRooms(RoomRepository roomRepository, LocationRepository locationRepository, | ||
FurnishingRepository furnishingRepository, ImageFileRepository imageFileRepository) { | ||
FurnishingRepository furnishingRepository, ImageFileRepository imageFileRepository, User user) { | ||
Location location = locationRepository.findByName("Songjeong").get(); | ||
Location location2 = locationRepository.findByName("Huam").get(); | ||
Location location3 = locationRepository.findByName("Amsaje 1").get(); | ||
|
@@ -137,7 +136,7 @@ private void initRooms(RoomRepository roomRepository, LocationRepository locatio | |
imageFile, | ||
imageFile2 | ||
) | ||
), | ||
).by(user), | ||
Room.valueOf( | ||
location2, | ||
RoomInfo.valueOf(RoomType.ONE_BED_FLATS, 1, 2, 2), | ||
|
@@ -148,7 +147,7 @@ private void initRooms(RoomRepository roomRepository, LocationRepository locatio | |
LocalDate.of(2023, 8, 30), | ||
"용산구 후암동) ONE_BED_FLATS, 방1, 욕실2, 룸메2 보증금 5_000_000 월세X 관리비X 가구X 2023.08.30 입주", | ||
Sets.newHashSet() | ||
), | ||
).by(user), | ||
Room.valueOf( | ||
location3, | ||
RoomInfo.valueOf(RoomType.ONE_BED_FLATS, 1, 2, 2), | ||
|
@@ -159,7 +158,7 @@ private void initRooms(RoomRepository roomRepository, LocationRepository locatio | |
LocalDate.now(), | ||
"강동구 암사제1동) ONE_BED_FLATS, 방1, 욕실2, 룸메2 보증금 5_000_000 월세300_000 관리비X 가구X 2023.08.30 입주", | ||
Sets.newHashSet() | ||
) | ||
).by(user) | ||
) | ||
); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ public record TokenRequest( | |
@Schema(description = "계정", example = "[email protected]") | ||
@NotEmpty String email, | ||
|
||
@Schema(description = "비밀번호", example = "password1234") | ||
@Schema(description = "비밀번호", example = "test1234!@") | ||
@NotEmpty String password | ||
) { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.koliving.api.fixtures; | ||
|
||
import com.koliving.api.user.User; | ||
|
||
import java.util.UUID; | ||
|
||
public class UserFixture { | ||
public static User createUser() { | ||
User user = User.builder() | ||
.email(String.format("%[email protected]", UUID.randomUUID())).build(); | ||
|
||
return user; | ||
} | ||
} |
Oops, something went wrong.