Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main <- develop #19

Merged
merged 6 commits into from
Jul 26, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public CorsConfigurationSource corsConfigurationSource() {

config.setAllowCredentials(true);
config.addAllowedOrigin("http://localhost:3000");
config.addAllowedOrigin("https://fe-newneek.vercel.app/");
config.addAllowedMethod("GET");
config.addAllowedMethod("POST");
config.addAllowedMethod("PUT");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import com.example.newnique.auth.jwt.JwtUtil;
import com.example.newnique.auth.security.UserDetailsImpl;
import com.example.newnique.user.dto.LoginRequestDto;
import com.example.newnique.user.entity.User;
import com.example.newnique.user.repository.UserRepository;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
Expand All @@ -16,7 +14,6 @@
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;

import java.io.IOException;
Expand Down Expand Up @@ -67,7 +64,7 @@ protected void successfulAuthentication(HttpServletRequest request, HttpServletR
response.setCharacterEncoding("UTF-8");

// JSON 응답 생성
String json = String.format("{\"msg\": \"로그인이 완료 되었습니다.\", \"emoji\": \"%s\"}", emoji);
String json = "{\"msg\": \"로그인이 완료 되었습니다.\"}";

// JSON 응답 전송
PrintWriter writer = response.getWriter();
Expand All @@ -85,7 +82,6 @@ protected void unsuccessfulAuthentication(HttpServletRequest request, HttpServle
// JSON 응답 생성
String json = "{\"message\": \"이메일 혹은 비밀번호가 일치하지 않습니다.\",\"statusCode\": \"401\"}";


// JSON 응답 전송
PrintWriter writer = response.getWriter();
writer.print(json);
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/example/newnique/global/Scheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.example.newnique.news.entity.News;
import com.example.newnique.news.repository.NewsRepository;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jsoup.Jsoup;
Expand Down Expand Up @@ -54,7 +53,7 @@ public void updateNews() throws InterruptedException {
// 원하는 뉴스 사이트의 URL을 지정
String url = "https://www.sedaily.com/";

List<String> mainCategories = Arrays.asList("증권", "부동산", "경제 · 금융", "산업","정치","사회","국제","오피니언","문화 · 스포츠","서경");
List<String> mainCategories = Arrays.asList("증권", "부동산", "경제 · 금융", "산업","정치","사회","국제","오피니언","문화 · 스포츠","서경");g

Document doc = Jsoup.connect(url).get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,26 @@ public ResponseEntity<Map<String, Object>> SearchNews(
return ResponseEntity.ok(newsResponseDtoList);
}

@GetMapping("/search/basic")
public ResponseEntity<Map<String, Object>> SearchNewsBaSic(
@RequestParam("keyword") String keyword,
@RequestParam("page") int page,
@RequestParam("size") int size,
@RequestParam("sortBy") String sortBy,
@RequestParam("isAsc") boolean isAsc
){

Map<String, Object> newsResponseDtoList = newsService.SearchNewsBaSic(
keyword,
page - 1,
size,
sortBy,
isAsc
);

return ResponseEntity.ok(newsResponseDtoList);
}

@GetMapping("/{newsId}")
public ResponseEntity<NewsDetailsResponseDto> getNewsDetails(@PathVariable Long newsId) {
NewsDetailsResponseDto newsDetails = newsService.getNewsDetails(newsId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import lombok.Getter;

import java.time.LocalDate;
import java.util.List;

@Getter
public class NewsDetailsResponseDto {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down