-
Notifications
You must be signed in to change notification settings - Fork 0
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 #101 from ku-ring/develop
version 2.3.2
- Loading branch information
Showing
97 changed files
with
2,344 additions
and
659 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
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
22 changes: 22 additions & 0 deletions
22
src/main/java/com/kustacks/kuring/admin/business/AdminDetailsService.java
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,22 @@ | ||
package com.kustacks.kuring.admin.business; | ||
|
||
import com.kustacks.kuring.admin.domain.AdminRepository; | ||
import com.kustacks.kuring.auth.userdetails.UserDetails; | ||
import com.kustacks.kuring.auth.userdetails.UserDetailsService; | ||
import com.kustacks.kuring.common.exception.NotFoundException; | ||
import com.kustacks.kuring.common.exception.code.ErrorCode; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class AdminDetailsService implements UserDetailsService { | ||
|
||
private final AdminRepository adminRepository; | ||
|
||
@Override | ||
public UserDetails loadUserByUsername(String loginId) { | ||
return adminRepository.findByLoginId(loginId) | ||
.orElseThrow(() -> new NotFoundException(ErrorCode.USER_NOT_FOUND)); | ||
} | ||
} |
92 changes: 0 additions & 92 deletions
92
src/main/java/com/kustacks/kuring/admin/business/AdminService.java
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
src/main/java/com/kustacks/kuring/admin/common/AdminProperties.java
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,16 @@ | ||
package com.kustacks.kuring.admin.common; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.ConstructorBinding; | ||
|
||
@Getter | ||
@ConstructorBinding | ||
@RequiredArgsConstructor | ||
@ConfigurationProperties(prefix = "admin") | ||
public class AdminProperties { | ||
|
||
private final String id; | ||
private final String password; | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/com/kustacks/kuring/admin/common/InitAdmin.java
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,32 @@ | ||
package com.kustacks.kuring.admin.common; | ||
|
||
import com.kustacks.kuring.admin.domain.Admin; | ||
import com.kustacks.kuring.admin.domain.AdminRepository; | ||
import com.kustacks.kuring.admin.domain.AdminRole; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.beans.factory.InitializingBean; | ||
import org.springframework.security.crypto.password.PasswordEncoder; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Optional; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class InitAdmin implements InitializingBean { | ||
|
||
private final AdminRepository adminRepository; | ||
private final PasswordEncoder passwordEncoder; | ||
private final AdminProperties adminProperties; | ||
|
||
@Override | ||
public void afterPropertiesSet() throws Exception { | ||
Optional<Admin> optionalAdmin = adminRepository.findByLoginId(adminProperties.getId()); | ||
|
||
if(optionalAdmin.isEmpty()) { | ||
String encodedPassword = passwordEncoder.encode(adminProperties.getPassword()); | ||
Admin admin = new Admin(adminProperties.getId(), encodedPassword); | ||
admin.addRole(AdminRole.ROLE_ROOT); | ||
adminRepository.save(admin); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/kustacks/kuring/admin/common/dto/AdminNotificationDto.java
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,26 @@ | ||
package com.kustacks.kuring.admin.common.dto; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class AdminNotificationDto { | ||
|
||
private String type; | ||
private String title; | ||
private String body; | ||
private String url; | ||
|
||
public AdminNotificationDto(String title, String body, String url) { | ||
this.type = "admin"; | ||
this.title = title; | ||
this.body = body; | ||
this.url = url; | ||
} | ||
|
||
public static AdminNotificationDto from(RealNotificationRequest request) { | ||
return new AdminNotificationDto(request.getTitle(), request.getBody(), request.getUrl()); | ||
} | ||
} |
12 changes: 0 additions & 12 deletions
12
src/main/java/com/kustacks/kuring/admin/common/dto/FakeUpdateResponseDto.java
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
src/main/java/com/kustacks/kuring/admin/common/dto/FeedbackDto.java
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,23 @@ | ||
package com.kustacks.kuring.admin.common.dto; | ||
|
||
import com.kustacks.kuring.feedback.domain.Feedback; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class FeedbackDto { | ||
|
||
private String contents; | ||
private Long userId; | ||
private LocalDateTime createdAt; | ||
|
||
public static FeedbackDto from(Feedback feedback) { | ||
return new FeedbackDto(feedback.getContent(), feedback.getUserId(), feedback.getCreatedAt()); | ||
} | ||
} |
17 changes: 0 additions & 17 deletions
17
src/main/java/com/kustacks/kuring/admin/common/dto/LoginResponseDto.java
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
src/main/java/com/kustacks/kuring/admin/common/dto/RealNotificationRequest.java
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.kustacks.kuring.admin.common.dto; | ||
|
||
import lombok.*; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class RealNotificationRequest { | ||
|
||
private String title; | ||
private String body; | ||
private String url; | ||
private String adminPassword; | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/kustacks/kuring/admin/common/dto/TestNotificationRequest.java
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.kustacks.kuring.admin.common.dto; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class TestNotificationRequest { | ||
|
||
private String category; | ||
private String subject; | ||
private String articleId; | ||
} |
Oops, something went wrong.