Skip to content

Commit

Permalink
Merge pull request #59 from Mojacknong/fix_58/스웨거-로컬-이슈
Browse files Browse the repository at this point in the history
Fix 58/스웨거 로컬 이슈
  • Loading branch information
Ryeolee authored Aug 2, 2024
2 parents 3209b70 + f7d918b commit 9059816
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package com.modernfarmer.farmusspring.domain.history.controller;

import com.modernfarmer.farmusspring.domain.auth.entity.CustomUser;
import com.modernfarmer.farmusspring.domain.history.dto.res.*;
import com.modernfarmer.farmusspring.domain.history.service.HistoryService;
import com.modernfarmer.farmusspring.global.response.BaseResponseDto;
import com.modernfarmer.farmusspring.global.response.SuccessCode;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
Expand All @@ -18,34 +22,39 @@ public class HistoryController {
private final HistoryService historyService;

@GetMapping("/{id}")
@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = HistoryResponseDto.class)))
public BaseResponseDto<?> getUserHistory(
@PathVariable Long id
) {
return BaseResponseDto.of(SuccessCode.SUCCESS, historyService.getUserHistory(id));
}

@GetMapping("/farmclub")
@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FarmClubHistoryListResponseDto.class)))
public BaseResponseDto<?> getFarmClubHistories(
@AuthenticationPrincipal CustomUser user
) {
return BaseResponseDto.of(SuccessCode.SUCCESS, historyService.getFarmClubHistories(user.getUserId()));
}

@GetMapping("/farmclub/{detailId}")
@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FarmClubHistoryDetailResponseDto.class)))
public BaseResponseDto<?> getFarmClubHistoryDetail(
@PathVariable String detailId
) {
return BaseResponseDto.of(SuccessCode.SUCCESS, historyService.getFarmClubHistoryDetail(detailId));
}

@GetMapping("/veggie")
@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VeggieHistoryListResponseDto.class)))
public BaseResponseDto<?> getVeggieHistories(
@AuthenticationPrincipal CustomUser user
) {
return BaseResponseDto.of(SuccessCode.SUCCESS, historyService.getVeggieHistories(user.getUserId()));
}

@GetMapping("/veggie/{detailId}")
@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VeggieHistoryDetailResponseDto.class)))
public BaseResponseDto<?> getVeggieHistoryDetail(
@PathVariable String detailId
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class SecurityConfig {
@Bean
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOrigins(List.of("http://locahost:8080"));
configuration.setAllowedOrigins(List.of("http://localhost:8080"));
configuration.setAllowedMethods(Arrays.asList("GET", "POST"));
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", configuration);
Expand Down

0 comments on commit 9059816

Please sign in to comment.