Skip to content

Commit

Permalink
Merge pull request #101 from ku-ring/develop
Browse files Browse the repository at this point in the history
version 2.3.2
  • Loading branch information
zbqmgldjfh authored Nov 13, 2023
2 parents bf1f434 + 6dae6df commit 50e07b9
Show file tree
Hide file tree
Showing 97 changed files with 2,344 additions and 659 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ env:
KU_PASSWORD: ${{ secrets.APP_ENV_TEST_KU_PASSWORD }}
SENTRY_URL: ${{ secrets.APP_ENV_SENTRY_URL }}
TZ: ${{ secrets.APP_ENV_TZ }}
JWT_SECRET_KEY: ${{ secrets.JWT_SECRET_KEY }}
JWT_EXPIRE_LENGTH: ${{ secrets.JWT_EXPIRE_LENGTH }}

jobs:
build:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ env:
KU_PASSWORD: ${{ secrets.APP_ENV_TEST_KU_PASSWORD }}
SENTRY_URL: ${{ secrets.APP_ENV_SENTRY_URL }}
TZ: ${{ secrets.APP_ENV_TZ }}
JWT_SECRET_KEY: ${{ secrets.JWT_SECRET_KEY }}
JWT_EXPIRE_LENGTH: ${{ secrets.JWT_EXPIRE_LENGTH }}

permissions:
packages: write
Expand Down Expand Up @@ -84,4 +86,4 @@ jobs:
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \
--s3-location bucket=$S3_BUCKET_NAME,key=$GITHUB_SHA.zip,bundleType=zip
--s3-location bucket=$S3_BUCKET_NAME,key=$GITHUB_SHA.zip,bundleType=zip
16 changes: 15 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ dependencies {
implementation "com.querydsl:querydsl-core:${queryDslVersion}"
annotationProcessor "com.querydsl:querydsl-apt:${queryDslVersion}"

// password encoder
implementation 'org.springframework.security:spring-security-crypto:5.7.5'

// jwt
implementation 'io.jsonwebtoken:jjwt:0.9.1'

// monitoring
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'io.micrometer:micrometer-registry-prometheus'
Expand Down Expand Up @@ -123,6 +129,11 @@ test {
finalizedBy 'jacocoTestReport'
}

//Querydsl 추가, 자동 생성된 Q클래스 gradle clean으로 제거
clean {
delete file('src/main/generated')
}

asciidoctor.onlyIf { System.getenv('DEPLOY_ENV') == 'dev' }

asciidoctor {
Expand Down Expand Up @@ -184,7 +195,10 @@ configurations {
compileQuerydsl {
options.annotationProcessorPath = configurations.querydsl
}

compileQuerydsl.doFirst {
if(file(querydslDir).exists())
delete(file(querydslDir))
}
// -- Jacoco 설정 -------------------------------------------------------
jacoco {
// jacoco version
Expand Down
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 src/main/java/com/kustacks/kuring/admin/business/AdminService.java

This file was deleted.

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 src/main/java/com/kustacks/kuring/admin/common/InitAdmin.java
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);
}
}
}
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());
}
}

This file was deleted.

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());
}
}

This file was deleted.

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;
}
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;
}
Loading

0 comments on commit 50e07b9

Please sign in to comment.