Skip to content

Commit

Permalink
Merge pull request #36 from gongPyeon/kang
Browse files Browse the repository at this point in the history
fix(Days): 타입 오류 수정
  • Loading branch information
gongPyeon authored Nov 27, 2024
2 parents 350f4d6 + 8776839 commit 2201b4b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
4 changes: 0 additions & 4 deletions src/main/java/timetogether/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ public class SecurityConfig {
@Bean
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
<<<<<<< HEAD
configuration.addAllowedOrigin("http://192.168.179.87:3000"); // 프론트 ip 3000 URL
=======
configuration.addAllowedOrigin("http://192.168.12.91:3000"); // 프론트 ip 3000 URL
>>>>>>> master
configuration.addAllowedMethod("*"); // 모든 HTTP 메서드 허용
configuration.addAllowedHeader("*"); // 모든 헤더 허용
configuration.addExposedHeader("Authorization"); // 클라이언트에서 Authorization 헤더를 읽을 수 있게 노출
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/timetogether/config/kakaoapi/KakaoAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@Slf4j
@Component
public class KakaoAPI {
@Value("${kakao.rest-api}")
//@Value("${kakao.rest-api}")
private String apiKey = "KakaoAK 967533de3fc3839252ee41386fe0bd95";
private static final String KEYWORD_URL = "https://dapi.kakao.com/v2/local/search/keyword";
private static final String CATEGORY_URL = "https://dapi.kakao.com/v2/local/search/category";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package timetogether.when2meet.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -92,9 +93,22 @@ public BaseResponse<Object> updateUserMeet(HttpServletRequest request,
@PathVariable("groupId") Long groupId,
@PathVariable("type") String type,
@PathVariable("title") String groupMeetingTitle,
@RequestBody List<Days> days)
@RequestBody String rawJson)
{ // (그룹, 회의 제목, TYPE을 확인) -> 회의 아이디, Type, 사용자로 테이블을 조회해서 when2meet을 가져온 후 ranktime을 업데이트한다
// ranktime을 set한다 (time, rank)

System.out.println("Received JSON: " + rawJson);

ObjectMapper objectMapper = new ObjectMapper();
List<Days> days;
try {
days = objectMapper.readValue(rawJson, new TypeReference<List<Days>>() {});
System.out.println("Parsed Days: " + days);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("JSON parsing error", e);
}

String accessToken = jwtService.extractAccessToken(request).get();
String socialId = jwtService.extractId(accessToken).get();
when2MeetService.updateUserMeet(groupId, groupMeetingTitle, MeetType.fromString(type), socialId, days);
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/timetogether/when2meet/dto/Days.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package timetogether.when2meet.dto;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;

@Getter
Expand All @@ -9,7 +11,13 @@ public class Days {
private final String time;
private final String rank;

public Days(String date, String day, String time, String rank) {
@JsonCreator
public Days(
@JsonProperty("date") String date,
@JsonProperty("day") String day,
@JsonProperty("time") String time,
@JsonProperty("rank") String rank
) {
this.date = date;
this.day = day;
this.time = time;
Expand Down

0 comments on commit 2201b4b

Please sign in to comment.