Skip to content

Commit

Permalink
Merge pull request #25 from yetJunior/develop
Browse files Browse the repository at this point in the history
[🚀 Deploy ] : 에러수정
  • Loading branch information
mon0mon authored Oct 4, 2023
2 parents 379f1db + 7fe360c commit 5014188
Show file tree
Hide file tree
Showing 20 changed files with 56 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ public class CustomAuthorizationFilter extends OncePerRequestFilter {

private static final List<String> EXCLUDE_URL =
List.of("/api/auth/token/refresh",
"/auth/**",
"/ws",
"/oauth2/authorization/**,",
"/api/articles",
"/api/review/{reviewApiId}",
"/api/article/{articleApiId}/review",
"/v3/api-docs/**",
"/configuration/**",
"/webjars/**",
"/swagger-ui/**"
// "/auth/**",
"/ws"
// "/oauth2/authorization/**,",
// "/api/articles",
// "/api/review/{reviewApiId}",
// "/api/article/{articleApiId}/review",
// "/v3/api-docs/**",
// "/configuration/**",
// "/webjars/**",
// "/swagger-ui/**"
);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void init() {
"articlecontrollertestuser1@gmail.com",
null,
null,
null
"ArticleControllerTestUser1"
);
user1 = userRepository.save(user1);

Expand All @@ -107,7 +107,7 @@ public void init() {
"articlecontrollertestuser2@gmail.com",
null,
null,
null
"ArticleControllerTestUser2"
);
user2 = userRepository.save(user2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ public static void afterAll() {

@BeforeEach
public void init() {
seller = User.of("user1", "password", "email1@", "oauthName1", null, null);
seller2 = User.of("seller2", "password", "seller2@", "seller2", null, null);
consumer = User.of("user2", "password", "email2@", "oauthName2", null, null);
seller = User.of("user1", "password", "email1@", "oauthName1", null, "user1");
seller2 = User.of("seller2", "password", "seller2@", "seller2", null, "seller2");
consumer = User.of("user2", "password", "email2@", "oauthName2", null, "user2");
seller = userRepository.save(seller);
seller2 = userRepository.save(seller2);
consumer = userRepository.save(consumer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public static void afterAll() {

@BeforeEach
public void init() {
seller = User.of("user1", "password", "email1@", "oauthName1", null, null);
consumer = User.of("user2", "password", "email2@", "oauthName2", null, null);
seller = User.of("user1", "password", "email1@", "oauthName1", null, "user1");
consumer = User.of("user2", "password", "email2@", "oauthName2", null, "user2");
seller = userRepository.save(seller);
consumer = userRepository.save(consumer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void setup() {
}

private void initializeEntities() {
consumer = User.of("user2", "password", "email2@", "oauthName2", null, null);
consumer = User.of("user2", "password", "email2@", "oauthName2", null, "user2");
consumer = userRepository.save(consumer);

article = Article.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ public static void afterAll() {
@BeforeEach
public void init() {

reviewer1 = User.of("user1", "password", "email1@", "oauthName1", null, null);
reviewer1 = User.of("user1", "password", "email1@", "oauthName1", null, "user1");
reviewer1 = userRepository.save(reviewer1);

reviewer2 = User.of("user2", "password", "email2@", "oauthName2", null, null);
reviewer2 = User.of("user2", "password", "email2@", "oauthName2", null, "user2");
reviewer2 = userRepository.save(reviewer2);

User seller = User.of("seller", "password", "sellerEmail@", "sellerOauthName", null, null);
User seller = User.of("seller", "password", "sellerEmail@", "sellerOauthName", null, "seller");
seller = userRepository.save(seller);

article = Article.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ public class ArticleRepositoryTest {

@BeforeEach
public void init() {
user1 = User.of("ArticleRepositoryTestUser1", "1234", "user1@gmail.com", null, null, null);
user1 = User.of("ArticleRepositoryTestUser1", "1234", "user1@gmail.com", null, null, "ArticleRepositoryTestUser1");

user1 = userRepository.save(user1);

user2 = User.of("ArticleRepositoryTestUser2", "1234", "user2@gmail.com", null, null, null);
user2 = User.of("ArticleRepositoryTestUser2", "1234", "user2@gmail.com", null, null, "ArticleRepositoryTestUser2");

user2 = userRepository.save(user2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class OrderRepositoryTest {

@BeforeEach
public void init() {
user = userRepository.save(User.of("user", "password", "email", "oauthName", null, null));
user = userRepository.save(User.of("user", "password", "email", "oauthName", null, "user"));
when(userService.getByApiId(any())).thenReturn(user);

article = articleRepository.save(Article.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class ChatroomUserRepositoryTest {

@BeforeEach
public void init() {
user1 = User.of("user1", "password", "email1@", "oauthName1", null, null);
user2 = User.of("seller2", "password", "seller2@", "seller2", null, null);
user1 = User.of("user1", "password", "email1@", "oauthName1", null, "user1");
user2 = User.of("seller2", "password", "seller2@", "seller2", null, "seller2");
user1 = userRepository.save(user1);
user2 = userRepository.save(user2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class ArticleServiceTest {

@BeforeEach
public void init() {
user = User.of("ArticleServiceTestUser", "1234", "user1@gmail.com", null, null, null);
user = User.of("ArticleServiceTestUser", "1234", "user1@gmail.com", null, null, "ArticleServiceTestUser");

user = userRepository.save(user);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ class ChatroomServiceTest {

@BeforeEach
public void init() {
seller = User.of("user1", "password", "email1@", "oauthName1", null, null);
seller2 = User.of("seller2", "password", "seller2@", "seller2", null, null);
consumer = User.of("user2", "password", "email2@", "oauthName2", null, null);
seller = User.of("user1", "password", "email1@", "oauthName1", null, "user1");
seller2 = User.of("seller2", "password", "seller2@", "seller2", null, "seller2");
consumer = User.of("user2", "password", "email2@", "oauthName2", null, "user2");
seller = userRepository.save(seller);
seller2 = userRepository.save(seller2);
consumer = userRepository.save(consumer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ class OrderModuleServiceTest {

@BeforeEach
public void init() {
seller = User.of("user1", "password", "email1@", "oauthName1", null, null);
consumer = User.of("user2", "password", "email2@", "oauthName2", null, null);
other = User.of("user3", "password", "email3@", "oauthName3", null, null);
seller = User.of("user1", "password", "email1@", "oauthName1", null, "user1");
consumer = User.of("user2", "password", "email2@", "oauthName2", null, "user2");
other = User.of("user3", "password", "email3@", "oauthName3", null, "user3");
seller = userRepository.save(seller);
consumer = userRepository.save(consumer);
other = userRepository.save(other);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class OrderServiceTest {

@BeforeEach
public void init() {
seller = User.of("user1", "password", "email1@", "oauthName1", null, null);
consumer = User.of("user2", "password", "email2@", "oauthName2", null, null);
seller = User.of("user1", "password", "email1@", "oauthName1", null, "user1");
consumer = User.of("user2", "password", "email2@", "oauthName2", null, "user2");
seller = userRepository.save(seller);
consumer = userRepository.save(consumer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private void initTestData() {
}

private User createAndSaveUser(String username, String email, String oauthName) {
User user = User.of(username, "password", email, oauthName, null, null);
User user = User.of(username, "password", email, oauthName, null, username);
return userRepository.save(user);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ class ReportModuleServiceTest {

@BeforeEach
public void init() {
reporter = User.of("reporter", "password", "email_reporter", "oauthName", null, null);
reporter = User.of("reporter", "password", "email_reporter", "oauthName", null, "reporter");
reporter = userRepository.save(reporter);

reportedUser = User.of("reported", "password", "email_reported", "oauthName", null, null);
reportedUser = User.of("reported", "password", "email_reported", "oauthName", null, "reported");
reportedUser = userRepository.save(reportedUser);

targetArticle = Article.builder().title("test article title")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ public class ReportServiceTest {

@BeforeEach
public void init() {
reporter = User.of("reporter", "password", "email_reporter", "oauthName", null, null);
reporter = User.of("reporter", "password", "email_reporter", "oauthName", null, "reporter");
reporter = userRepository.save(reporter);

reportedUser = User.of("reported", "password", "email_reported", "oauthName", null, null);
reportedUser = User.of("reported", "password", "email_reported", "oauthName", null, "reported");
reportedUser = userRepository.save(reportedUser);

targetArticle = Article.builder().title("test article title")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ public class ReviewModuleServiceTest {
@BeforeEach
public void init() {

reviewer1 = User.of("user1", "password", "email1@", "oauthName1", null, null);
reviewer1 = User.of("user1", "password", "email1@", "oauthName1", null, "user1");
reviewer1 = userRepository.save(reviewer1);

reviewer2 = User.of("user2", "password", "email2@", "oauthName2", null, null);
reviewer2 = User.of("user2", "password", "email2@", "oauthName2", null, "user2");
reviewer2 = userRepository.save(reviewer2);

User seller = User.of("seller", "password", "sellerEmail@", "sellerOauthName", null, null);
User seller = User.of("seller", "password", "sellerEmail@", "sellerOauthName", null, "seller");
seller = userRepository.save(seller);

article = Article.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@ public static void afterAll() {

@BeforeEach
public void init() {
reviewer1 = User.of("user1", "password", "email1@", "oauthName1", "", null);
reviewer1 = User.of("user1", "password", "email1@", "oauthName1", "", "user1");
reviewer1 = userRepository.save(reviewer1);

reviewer2 = User.of("user2", "password", "email2@", "oauthName2", "", null);
reviewer2 = User.of("user2", "password", "email2@", "oauthName2", "", "user2");
reviewer2 = userRepository.save(reviewer2);

reviewer3 = User.of("user3", "password", "email3@", "oauthName3", "", null);
reviewer3 = User.of("user3", "password", "email3@", "oauthName3", "", "user3");
reviewer3 = userRepository.save(reviewer3);

reviewer4 = User.of("user4", "password", "email4@", "oauthName4", "", null);
reviewer4 = User.of("user4", "password", "email4@", "oauthName4", "", "user4");
reviewer4 = userRepository.save(reviewer4);

User seller = User.of("seller", "password", "sellerEmail@", "sellerOauthName", "", null);
User seller = User.of("seller", "password", "sellerEmail@", "sellerOauthName", "", "seller");
seller = userRepository.save(seller);

article = Article.builder()
Expand Down
9 changes: 6 additions & 3 deletions common/src/main/java/mutsa/common/BootstrapDataLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public void createAdminUser() {
admin.put("email", "mutsaproject@gmail.com");
admin.put("image_url", "");
admin.put("role", RoleStatus.ROLE_ADMIN);
admin.put("nickname", "admin_nick");

loadUser(admin);
}
Expand Down Expand Up @@ -124,7 +125,7 @@ private User loadUser(Map<String, Object> attributes) {
String email = (String) attributes.get("email");
String imageUrl = (String) attributes.get("image_url");
String password = (String) attributes.get("password");
String nickname = (String) attributes.get("password");
String nickname = (String) attributes.get("nickname");

RoleStatus role = (RoleStatus) attributes.get("role");
HashMap<String, Object> necessaryAttributes = createNecessaryAttributes(apiId, login,
Expand Down Expand Up @@ -223,6 +224,7 @@ public User createTestUser1() {
testUser1.put("email", "qwer@gmail.com");
testUser1.put("image_url", "");
testUser1.put("role", RoleStatus.ROLE_USER);
testUser1.put("nickname", "test-user1");

return loadUser(testUser1);
}
Expand All @@ -235,6 +237,7 @@ public User createTestUser2() {
testUser2.put("email", "asdf@gmail.com");
testUser2.put("image_url", "");
testUser2.put("role", RoleStatus.ROLE_USER);
testUser2.put("nickname", "test-user2");

return loadUser(testUser2);
}
Expand All @@ -246,7 +249,7 @@ public void createReport() {
"reporter1@gmail.com",
null,
null,
null
"ReportControllerTestUser1-nick"
);
reporter1 = userRepository.save(reporter1);

Expand All @@ -256,7 +259,7 @@ public void createReport() {
"reportedUser@gmail.com",
null,
null,
null
"ReportControllerTestUser2-nick"
);
reportedUser = userRepository.save(reportedUser);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public class User extends BaseTimeEntity implements Serializable {

@Column(nullable = false, unique = true)
private String username;

@Column(nullable = false, unique = true)
private String nickname;

@Column(nullable = false)
Expand Down

0 comments on commit 5014188

Please sign in to comment.