Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8c5b730
[feat] QueryDSL 의존성 추가 및 설정
parkmineum Feb 15, 2025
0d0ef8c
[feat] QClass 경로 주석 제거
parkmineum Feb 15, 2025
34dab09
Merge branch 'dev' of https://github.com/Yeogigallae/Back-End into re…
parkmineum Feb 17, 2025
1307959
Merge branch 'dev' of https://github.com/Yeogigallae/Back-End into re…
parkmineum Feb 17, 2025
d80d9a3
[chore] 테스트 환경 구축
parkmineum Feb 17, 2025
e7b4323
[chore] 레디스 환경 세팅 및 의존성 주입
parkmineum Feb 17, 2025
f33eebb
Merge branch 'dev' of https://github.com/Yeogigallae/Back-End into re…
parkmineum Feb 18, 2025
8d10274
[chore] Redis ObjectMapper 추가
parkmineum Feb 18, 2025
8c6019c
[chore] .yml Redis 설정 변경
parkmineum Feb 18, 2025
f7a6a04
[feat] Vote 엔티티 JSON 변환 가능하도록 설정 추가
parkmineum Feb 18, 2025
b4f6881
[refactor] 분산 락 할당을 통한 동시성 제어
parkmineum Feb 19, 2025
9d78c5c
[chore] QueryDSL 설정 추가
parkmineum Feb 19, 2025
889cea0
[chore] 투표 조회 기능 성능 개선
parkmineum Feb 19, 2025
a77c2f4
Merge branch 'dev' into refactor/#96
parkmineum Feb 19, 2025
6d84ca2
[feat] budget 조회 응답값 추가
Gwanghyeon-k Feb 20, 2025
68e8c93
[feat] dto 변환 converter 수정
Gwanghyeon-k Feb 20, 2025
831a27e
[feat] 프롬프트 수정, controller 수정
Gwanghyeon-k Feb 20, 2025
67d3c5e
Merge pull request #162 from Yeogigallae/feat/#161
Gwanghyeon-k Feb 20, 2025
9b7df09
[refactor] 알림 조회시 로그인 정보 없으면 에러
GithubKangMin Feb 20, 2025
e711acd
Merge pull request #163 from Yeogigallae/feat/#7
GithubKangMin Feb 20, 2025
1ae551d
[refactor] 방정보 조회시 본인만 있는 방의 정보 조회 안되는 오류 수정
GithubKangMin Feb 20, 2025
c896561
Merge pull request #165 from Yeogigallae/feat/#7
GithubKangMin Feb 20, 2025
17b2dac
[fix] 여행 확정 판단 여부 오류 수정
parkmineum Feb 20, 2025
a781cf3
Merge remote-tracking branch 'origin/refactor/#96' into refactor/#96
parkmineum Feb 20, 2025
c2c3236
[fix] DTO 수정
parkmineum Feb 20, 2025
8c20884
Merge pull request #160 from Yeogigallae/refactor/#96
parkmineum Feb 20, 2025
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
17 changes: 13 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ dependencies {
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

//security

implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'io.jsonwebtoken:jjwt-api:0.11.2'
Expand All @@ -49,8 +48,6 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'io.github.cdimascio:dotenv-java:3.0.0'



// swagger
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.1.0'

Expand All @@ -59,8 +56,16 @@ dependencies {
implementation 'mysql:mysql-connector-java:8.0.30'
implementation 'com.h2database:h2:2.2.220'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'org.redisson:redisson-spring-boot-starter:3.22.0'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'


// QueryDSL
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jakarta"
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"

implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
}


Expand All @@ -71,4 +76,8 @@ tasks.named('test') {
test {
// 모든 테스트를 스킵하도록 설정 (임시)
enabled = false
}

clean {
delete file('src/main/generated')
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 1 addition & 2 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
import com.umc.yeogi_gal_lae.api.budget.dto.BudgetAssignment;
import com.umc.yeogi_gal_lae.api.budget.dto.BudgetDetailResponse;
import com.umc.yeogi_gal_lae.api.budget.dto.BudgetResponse;
import com.umc.yeogi_gal_lae.api.budget.dto.DailyBudgetAssignmentResponse;
import com.umc.yeogi_gal_lae.api.budget.repository.BudgetRepository;
import com.umc.yeogi_gal_lae.api.budget.service.BudgetService;
import com.umc.yeogi_gal_lae.global.common.response.Response;
import com.umc.yeogi_gal_lae.global.error.ErrorCode;
import com.umc.yeogi_gal_lae.global.success.SuccessCode;
import java.time.LocalDate;
import java.util.Collections;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -56,21 +54,7 @@ public Response<BudgetDetailResponse> getBudget(@PathVariable Long budgetId) {
}
Budget budget = budgetOpt.get();
Map<String, List<BudgetAssignment>> budgetMap = budgetService.getBudgetMapById(budgetId);
List<DailyBudgetAssignmentResponse> dailyAssignments = BudgetConverter.toDailyBudgetAssignmentResponseList(
budgetMap);

// AICourse를 통해 TripPlan 정보를 조회 (TripPlan 클래스가 startDate와 endDate를 LocalDate 타입으로 제공한다고 가정)
String imageUrl = budget.getAiCourse().getTripPlan().getImageUrl();
LocalDate startDate = budget.getAiCourse().getTripPlan().getStartDate();
LocalDate endDate = budget.getAiCourse().getTripPlan().getEndDate();

BudgetDetailResponse detailResponse = BudgetDetailResponse.builder()
.dailyAssignments(dailyAssignments)
.imageUrl(imageUrl)
.startDate(startDate)
.endDate(endDate)
.build();

BudgetDetailResponse detailResponse = BudgetConverter.toBudgetDetailResponse(budget, budgetMap);
return Response.of(SuccessCode.OK, detailResponse);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.umc.yeogi_gal_lae.api.budget.domain.Budget;
import com.umc.yeogi_gal_lae.api.budget.dto.BudgetAssignment;
import com.umc.yeogi_gal_lae.api.budget.dto.BudgetDetailResponse;
import com.umc.yeogi_gal_lae.api.budget.dto.BudgetResponse;
import com.umc.yeogi_gal_lae.api.budget.dto.DailyBudgetAssignmentResponse;
import java.util.List;
Expand Down Expand Up @@ -33,4 +34,17 @@ public static List<DailyBudgetAssignmentResponse> toDailyBudgetAssignmentRespons
.build())
.collect(Collectors.toList());
}

public static BudgetDetailResponse toBudgetDetailResponse(Budget budget,
Map<String, List<BudgetAssignment>> budgetMap) {
List<DailyBudgetAssignmentResponse> dailyAssignments = toDailyBudgetAssignmentResponseList(budgetMap);
return BudgetDetailResponse.builder()
.dailyAssignments(dailyAssignments)
.location(budget.getAiCourse().getTripPlan().getLocation())
.imageUrl(budget.getAiCourse().getTripPlan().getImageUrl())
.startDate(budget.getAiCourse().getTripPlan().getStartDate())
.endDate(budget.getAiCourse().getTripPlan().getEndDate())
.build();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@AllArgsConstructor
@Builder
public class BudgetDetailResponse {
private String location;
private String imageUrl;
private LocalDate startDate;
private LocalDate endDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ private String buildBudgetPrompt(String scheduleJson) {
prompt.append("Given the following travel schedule in JSON format: ")
.append(scheduleJson)
.append(", generate budget recommendations for each day. ");
prompt.append("단, 'placeName' 필드의 값은 반드시 한국어로만 작성되어야 하며, 영어 표현은 사용하지 마세요. ");
prompt.append(
"For each place, assign exactly one budget type (one of MEAL, ACTIVITY, SHOPPING, TRANSPORT) and a recommended amount. ");
prompt.append(
Expand Down Expand Up @@ -125,7 +126,7 @@ private Map<String, List<BudgetAssignment>> parseBudgetGptResponse(String gptRes
if (jsonStart != -1) {
content = content.substring(jsonStart);
}
return objectMapper.readValue(content, new TypeReference<Map<String, List<BudgetAssignment>>>() {
return objectMapper.readValue(content, new TypeReference<>() {
});
} catch (Exception e) {
e.printStackTrace();
Expand All @@ -144,13 +145,11 @@ public Map<String, List<BudgetAssignment>> getBudgetMapById(Long id) {
}
try {
String budgetJson = budgetOpt.get().getBudgetJson();
return objectMapper.readValue(budgetJson, new TypeReference<Map<String, List<BudgetAssignment>>>() {
return objectMapper.readValue(budgetJson, new TypeReference<>() {
});
} catch (Exception e) {
e.printStackTrace();
return Collections.emptyMap();
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.umc.yeogi_gal_lae.api.notification.service.NotificationService;
import com.umc.yeogi_gal_lae.api.notification.domain.NotificationType;
import com.umc.yeogi_gal_lae.api.tripPlan.types.TripPlanType;
import com.umc.yeogi_gal_lae.api.user.domain.User;
import com.umc.yeogi_gal_lae.api.vote.AuthenticatedUserUtils;
import com.umc.yeogi_gal_lae.global.common.response.Response;
import com.umc.yeogi_gal_lae.global.success.SuccessCode;
Expand Down Expand Up @@ -59,6 +60,10 @@ public ResponseEntity<Response<Void>> createEndNotification(
*/
@GetMapping
public ResponseEntity<Response<List<NotificationDto>>> getAllNotifications() {

//로그인 없을시 에러냄
String userEmail = AuthenticatedUserUtils.getAuthenticatedUserEmail();

List<NotificationDto> notifications = notificationService.getAllNotifications();
return ResponseEntity.ok(Response.of(SuccessCode.NOTIFICATION_FETCH_OK, notifications));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,9 @@ public RoomListResponse getRoomsByUserId(Long userId) {
.roomId(room.getId())
.roomName(room.getName())
.members(room.getRoomMembers().stream()
.filter(member -> !member.getUser().getId().equals(userId)) // 본인 제외
.map(member -> new SimpleRoomMemberResponse(
member.getUser().getId(),
member.getUser().getProfileImage() // 프로필 이미지 추가
member.getUser().getId().equals(userId) ? null : member.getUser().getProfileImage() // 본인 프로필만 null 처리
))
.collect(Collectors.toList()))
.build())
Expand Down
14 changes: 10 additions & 4 deletions src/main/java/com/umc/yeogi_gal_lae/api/vote/domain/Vote.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package com.umc.yeogi_gal_lae.api.vote.domain;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.umc.yeogi_gal_lae.api.tripPlan.domain.TripPlan;
import com.umc.yeogi_gal_lae.global.common.BaseEntity;
import jakarta.persistence.*;
import lombok.*;

import java.time.LocalDateTime;

@Builder
@Getter @Setter
@NoArgsConstructor
Expand All @@ -19,17 +23,19 @@ public class Vote extends BaseEntity {

@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "trip_plan_id", nullable = false)
@JsonIgnore
private TripPlan tripPlan;

// 특정 사용자의 투표 결과 조회 빈번하게 일어날 것으로 예상되기에, VoteRoom 을 통하지 않고 바로 Use 와 매핑
// VoteRoom 은 투표 방 자체를 관리하고, Vote 는 사용자들의 실제 투표 데이터를 관리하므로 역할 분리
// 투표 데이터를 추가하거나 변경할 때 VoteRoom 에 불필요한 데이터가 섞이지 않기 위함

@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "vote_room_id", nullable = false)
@JsonIgnore
private VoteRoom voteRoom;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private VoteType type;

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
@Override
public LocalDateTime getCreatedAt() { return super.getCreatedAt(); }
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minidev.json.annotate.JsonIgnore;


@NoArgsConstructor
public class VoteRequest {


Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package com.umc.yeogi_gal_lae.api.vote.dto.request;

import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;


@Builder
@Getter
@NoArgsConstructor
@Builder // 추가
@AllArgsConstructor // 필요 시 추가
public class VoteRoomRequest {

@NotNull
Expand All @@ -17,5 +21,4 @@ public class VoteRoomRequest {

@NotNull
private Long voteRoomId;

}
Loading