Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Profile("consumer & !legacy")
@Profile("consumer")
@Slf4j
@Component
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.stream.Collectors;

@Profile("consumer & !legacy")
@Profile("consumer")
@Slf4j
@Component
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,11 @@
import com.threestar.trainus.domain.lesson.teacher.entity.Category;
import com.threestar.trainus.global.annotation.LoginUser;
import com.threestar.trainus.global.dto.PageRequestDto;
import com.threestar.trainus.global.exception.domain.ErrorCode;
import com.threestar.trainus.global.exception.handler.BusinessException;
import com.threestar.trainus.global.unit.BaseResponse;
import com.threestar.trainus.global.unit.PagedResponse;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpSession;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
Expand Down Expand Up @@ -137,13 +134,8 @@ public ResponseEntity<PagedResponse<MyLessonApplicationListWrapperDto>> getMyLes
@RequestParam(defaultValue = "5") @Min(value = 1, message = "limit는 1 이상이어야 합니다.")
@Max(value = 100, message = "limit는 100 이하여야 합니다.") int limit,
@RequestParam(defaultValue = "ALL") String status,
HttpSession session
@LoginUser Long userId
) {
Long userId = (Long)session.getAttribute("LOGIN_USER");
if (userId == null) {
throw new BusinessException(ErrorCode.AUTHENTICATION_REQUIRED);
}

MyLessonApplicationListResponseDto serviceResponse = studentLessonService.getMyLessonApplications(userId, page,
limit, status);
MyLessonApplicationListWrapperDto response = new MyLessonApplicationListWrapperDto(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.context.annotation.Profile;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -27,6 +28,7 @@
import lombok.RequiredArgsConstructor;

@Tag(name = "동시성 테스트 API", description = "선착순 기능 테스트를 위한 API")
@Profile({"local", "test"})
@RestController
@RequestMapping("/test")
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.Set;

import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Profile;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
Expand All @@ -26,7 +27,6 @@
import com.threestar.trainus.domain.metadata.entity.ProfileMetadata;
import com.threestar.trainus.domain.metadata.mapper.ProfileMetadataMapper;
import com.threestar.trainus.domain.metadata.repository.ProfileMetadataRepository;
import com.threestar.trainus.domain.profile.entity.Profile;
import com.threestar.trainus.domain.profile.mapper.ProfileMapper;
import com.threestar.trainus.domain.profile.repository.ProfileRepository;
import com.threestar.trainus.domain.review.entity.Review;
Expand All @@ -40,7 +40,7 @@

@Slf4j
@Component
@org.springframework.context.annotation.Profile("dev") // dev 프로필에서만 실행
@Profile({"local", "test"})
@RequiredArgsConstructor
public class MockDataInitializer implements CommandLineRunner {

Expand Down Expand Up @@ -111,7 +111,7 @@ private List<User> createInstructors() {
User savedInstructor = userRepository.save(instructor);

// Profile 생성
Profile profile = ProfileMapper.toDefaultEntity(savedInstructor);
var profile = ProfileMapper.toDefaultEntity(savedInstructor);
profile.updateProfileImage("https://example.com/instructor" + (i + 1) + ".jpg");
profile.updateProfileIntro(instructorNames[i] + "입니다. 최고의 레슨을 제공합니다!");
profileRepository.save(profile);
Expand All @@ -138,7 +138,7 @@ private List<User> createInstructors() {
User savedAdmin = userRepository.save(admin);

// 관리자 Profile 생성
Profile adminProfile = ProfileMapper.toDefaultEntity(savedAdmin);
var adminProfile = ProfileMapper.toDefaultEntity(savedAdmin);
adminProfile.updateProfileImage("https://example.com/admin.jpg");
profileRepository.save(adminProfile);

Expand All @@ -165,7 +165,7 @@ private List<User> createStudents() {
User savedStudent = userRepository.save(student);

// Profile 생성
Profile profile = ProfileMapper.toDefaultEntity(savedStudent);
var profile = ProfileMapper.toDefaultEntity(savedStudent);
profile.updateProfileImage("https://example.com/student" + (i + 1) + ".jpg");
profileRepository.save(profile);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ public class SwaggerConfig {
@Bean
public OpenAPI openApi() {
return new OpenAPI()
.addSecurityItem(new SecurityRequirement().addList("session"))
.addSecurityItem(new SecurityRequirement().addList("bearerAuth"))
.components(new Components()
.addSecuritySchemes("session", new SecurityScheme()
.type(SecurityScheme.Type.APIKEY)
.in(SecurityScheme.In.COOKIE)
.name("JSESSIONID")
.addSecuritySchemes("bearerAuth", new SecurityScheme()
.type(SecurityScheme.Type.HTTP)
.scheme("bearer")
.bearerFormat("JWT")
)
)
.info(apiInfo());
}

private Info apiInfo() {
return new Info()
.title("FitMate API 문서") // API의 제목
.title("TrainUs API 문서") // API의 제목
.description("운동 메이트 매칭 플랫폼의 API 명세서") // API에 대한 설명
.version("1.0.0"); // API의 버전
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
Expand All @@ -29,10 +30,26 @@ public PasswordEncoder passwordEncoder() {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.authorizeHttpRequests(
auth -> auth.requestMatchers("/api/v1/users/**", "/api/lessons/test-auth", "/swagger-ui/**",
"/v3/api-docs/**", "/api/v1/profiles/**", "/api/v1/lessons/**", "api/v1/coupons/**",
"/api/v1/comments/**", "/api/v1/reviews/**", "/api/v1/admin/**", "/api/v1/rankings/**",
"/api/v1/payments/**", "/test/**", "/health", "/actuator/**")
auth -> auth.requestMatchers(
"/api/v1/users/signup",
"/api/v1/users/login",
"/api/v1/users/verify/**",
"/swagger-ui/**",
"/v3/api-docs/**",
"/health",
"/actuator/**")
.permitAll()
.requestMatchers(HttpMethod.GET,
"/api/v1/profiles/*",
"/api/v1/profiles/*/created-lessons",
"/api/v1/lessons",
"/api/v1/lessons/search/nearby",
"/api/v1/lessons/*",
"/api/v1/lessons/summary/*",
"/api/v1/lessons/apply/status/*",
"/api/v1/comments/**",
"/api/v1/reviews/**",
"/api/v1/rankings/**")
.permitAll()
.requestMatchers("/api/v1/admin/**")
.hasRole("ADMIN")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.context.annotation.Profile;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
Expand All @@ -15,6 +16,7 @@
import lombok.RequiredArgsConstructor;

@Tag(name = "S3 테스트 컨트롤러", description = "S3 업로더 테스트용 컨트롤러입니다.")
@Profile({"local", "test"})
@RestController
@RequestMapping("/api/v1/test/s3")
@RequiredArgsConstructor
Expand All @@ -38,4 +40,4 @@ public ResponseEntity<String> upload(
return ResponseEntity.badRequest().body("업로드 실패: " + e.getMessage());
}
}
}
}
Loading