diff --git a/server/build.gradle b/server/build.gradle index b8e8153d..cd2f08ba 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -1,14 +1,8 @@ -//querysl 추가 -buildscript { - dependencies { - classpath("gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin:1.0.10") - } -} - plugins { id 'java' - id 'org.springframework.boot' version '2.7.12' + id 'org.springframework.boot' version '2.7.13' id 'io.spring.dependency-management' version '1.0.15.RELEASE' +// id "com.ewerk.gradle.plugins.querydsl" version "1.0.10" // Querydsl 플러그인 버전 추가 } group = 'com.example' @@ -18,8 +12,7 @@ java { sourceCompatibility = '11' } -//apply plugin: 'io.spring.dependency-management' -apply plugin: "com.ewerk.gradle.plugins.querydsl" +//apply plugin: "com.ewerk.gradle.plugins.querydsl" configurations { compileOnly { @@ -65,35 +58,36 @@ dependencies { //aws s3 의존 implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE' - //Querydsl - implementation 'com.querydsl:querydsl-jpa' - implementation 'com.querydsl:querydsl-apt' +// //Querydsl 버전을 BOM으로 일치시키기 +// implementation platform("com.querydsl:querydsl-bom:4.4.2") // Spring Boot 2.7.13에 맞는 Querydsl 버전 사용 +// implementation 'com.querydsl:querydsl-jpa' +// annotationProcessor 'com.querydsl:querydsl-apt' } //querydsl 추가 -def querydslDir = "$buildDir/generated/querydsl" - -querydsl { - library = "com.querydsl:querydsl-apt" - jpa = true - querydslSourcesDir = querydslDir -} - -sourceSets { - main { - java { - srcDirs = ['src/main/java', querydslDir] - } - } -} - -compileQuerydsl { - options.annotationProcessorPath = configurations.querydsl -} - -configurations { - querydsl.extendsFrom compileClasspath -} +//def querydslDir = "src/main/generated/querydsl" +// +//querydsl { +// library = "com.querydsl:querydsl-apt" +// jpa = true +// querydslSourcesDir = querydslDir +//} +// +//sourceSets { +// main { +// java { +// srcDirs = ['src/main/java', querydslDir] +// } +// } +//} +// +//compileQuerydsl { +// options.annotationProcessorPath = configurations.querydsl +//} +// +//configurations { +// querydsl.extendsFrom compileClasspath +//} dependencyManagement { // 블록 추가 imports { @@ -105,11 +99,7 @@ jar { enabled = false } -tasks.named('test') { - useJUnitPlatform() -} - tasks.named('test') { exclude "**/*" + useJUnitPlatform() } - diff --git a/server/src/main/java/actiOn/config/querydsl/QuerydslConfig.java b/server/src/main/java/actiOn/config/querydsl/QuerydslConfig.java deleted file mode 100644 index b25ac191..00000000 --- a/server/src/main/java/actiOn/config/querydsl/QuerydslConfig.java +++ /dev/null @@ -1,20 +0,0 @@ -package actiOn.config.querydsl; - -import com.querydsl.jpa.impl.JPAQueryFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; - -@Configuration -public class QuerydslConfig { - - @PersistenceContext - private EntityManager entityManager; - - @Bean - public JPAQueryFactory jpaQueryFactory(){ - return new JPAQueryFactory(entityManager); - } -} diff --git a/server/src/main/java/actiOn/config/sercurity/SecurityConfiguration.java b/server/src/main/java/actiOn/config/sercurity/SecurityConfiguration.java index d992a8f7..22508266 100644 --- a/server/src/main/java/actiOn/config/sercurity/SecurityConfiguration.java +++ b/server/src/main/java/actiOn/config/sercurity/SecurityConfiguration.java @@ -18,12 +18,12 @@ import org.springframework.security.config.Customizer; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.crypto.factory.PasswordEncoderFactories; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.oauth2.client.web.OAuth2LoginAuthenticationFilter; -import org.springframework.security.web.SecurityFilterChain; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; @@ -33,12 +33,14 @@ @Configuration @EnableWebSecurity @AllArgsConstructor -public class SecurityConfiguration { +public class SecurityConfiguration extends WebSecurityConfigurerAdapter { private final TokenProvider tokenProvider; private final MemberAuthorityUtil authorityUtil; + private final MemberService memberService; + private final RoleService roleService; - @Bean - public SecurityFilterChain filterChain(HttpSecurity httpSecurity, MemberService memberService, RoleService roleService) throws Exception { + @Override + protected void configure(HttpSecurity httpSecurity) throws Exception { httpSecurity .headers().frameOptions().sameOrigin() @@ -60,15 +62,13 @@ public SecurityFilterChain filterChain(HttpSecurity httpSecurity, MemberService .apply(new CustomFilterConfigurer()) .and() - .authorizeHttpRequests(authorize -> authorize + .authorizeRequests(authorize -> authorize .anyRequest().permitAll() /// Todo URI 권한 레벨 설정 ) .oauth2Login(oAuth2 -> oAuth2 .loginPage("/oauth2/authorization/google") .successHandler(new OAuth2MemberSuccessHandler(memberService, roleService, tokenProvider)) ); - - return httpSecurity.build(); } // JwtAuthenticationFilter 구성하는 클래스 diff --git a/server/src/main/java/actiOn/member/dto/PartnerResponseDto.java b/server/src/main/java/actiOn/member/dto/PartnerResponseDto.java index 2f382476..78e548d5 100644 --- a/server/src/main/java/actiOn/member/dto/PartnerResponseDto.java +++ b/server/src/main/java/actiOn/member/dto/PartnerResponseDto.java @@ -1,5 +1,6 @@ package actiOn.member.dto; +import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; import lombok.Setter; @@ -15,6 +16,7 @@ public class PartnerResponseDto { @Builder @Getter @Setter + @AllArgsConstructor public static class StoreDto { private String category; private String storeName; diff --git a/server/src/main/java/actiOn/member/dto/PartnerStoreResponseDto.java b/server/src/main/java/actiOn/member/dto/PartnerStoreResponseDto.java index 3377e39d..a9bff3cc 100644 --- a/server/src/main/java/actiOn/member/dto/PartnerStoreResponseDto.java +++ b/server/src/main/java/actiOn/member/dto/PartnerStoreResponseDto.java @@ -1,5 +1,6 @@ package actiOn.member.dto; +import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; import lombok.Setter; @@ -15,6 +16,7 @@ public class PartnerStoreResponseDto { @Builder @Getter @Setter + @AllArgsConstructor public static class PartnerStoreDto { private Long storeId; private String storeImage; diff --git a/server/src/main/java/actiOn/store/repository/StoreRepositoryImpl.java b/server/src/main/java/actiOn/store/repository/StoreRepositoryImpl.java deleted file mode 100644 index e500eb4b..00000000 --- a/server/src/main/java/actiOn/store/repository/StoreRepositoryImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -package actiOn.store.repository; - -import actiOn.store.entity.QStore; -import actiOn.store.entity.Store; -import actiOn.wish.entity.QWish; -import com.querydsl.jpa.impl.JPAQueryFactory; -import org.springframework.stereotype.Repository; - -@Repository -public class StoreRepositoryImpl implements StoreCustomRepository{ - - private final JPAQueryFactory queryFactory; - - public StoreRepositoryImpl(JPAQueryFactory queryFactory) { - this.queryFactory = queryFactory; - } - - @Override - public void addLikeCount(Store selectStore) { - QStore st = QStore.store; - queryFactory.update(st) - .set(st.likeCount, st.likeCount.add(1)) - .where(st.eq(selectStore)) - .execute(); - } - - @Override - public void subLikeCount(Store selectStore) { - QStore st = QStore.store; - queryFactory.update(st) - .set(st.likeCount, st.likeCount.subtract(1)) - .where(st.eq(selectStore)) - .execute(); - } - - @Override - public void addReviewCount(Store selectStore) { - QStore st = QStore.store; - queryFactory.update(st) - .set(st.reviewCount, st.reviewCount.add(1)) - .where(st.eq(selectStore)) - .execute(); - - } - - @Override - public void setRating(Store store,double avgRating) { - QStore st = QStore.store; - queryFactory.update(st) - .set(st.rating, avgRating) - .where(st.eq(store)) - .execute(); - } -}