Skip to content

Commit

Permalink
[merge] dev 브랜치에서 merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ehs208 committed Jan 14, 2025
2 parents e6cdb6c + 37749f4 commit 4e0a13a
Show file tree
Hide file tree
Showing 31 changed files with 1,370 additions and 444 deletions.
9 changes: 8 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,28 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'

// 로그인
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
implementation 'com.auth0:java-jwt:4.2.1'
implementation 'org.hibernate.validator:hibernate-validator:8.0.0.Final'
implementation 'jakarta.validation:jakarta.validation-api:3.0.2'

runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'

compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.7.0'

implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
annotationProcessor "com.querydsl:querydsl-apt:5.0.0:jakarta"
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"
}

tasks.named('test') {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
package com.example.eatmate.app.domain.meeting.controller;

import java.util.List;
import static com.example.eatmate.app.domain.meeting.domain.ParticipantRole.*;

import java.time.LocalDateTime;

import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Slice;
import org.springframework.data.domain.Sort;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
Expand All @@ -22,13 +28,20 @@
import com.example.eatmate.app.domain.meeting.dto.CreateOfflineMeetingResponseDto;
import com.example.eatmate.app.domain.meeting.dto.DeliveryMeetingDetailResponseDto;
import com.example.eatmate.app.domain.meeting.dto.DeliveryMeetingListResponseDto;
import com.example.eatmate.app.domain.meeting.dto.MeetingListResponseDto;
import com.example.eatmate.app.domain.meeting.dto.OfflineMeetingDetailResponseDto;
import com.example.eatmate.app.domain.meeting.dto.OfflineMeetingListResponseDto;
import com.example.eatmate.app.domain.meeting.dto.UpcomingMeetingResponseDto;
import com.example.eatmate.app.domain.meeting.service.MeetingService;
import com.example.eatmate.global.response.CursorResponseDto;
import com.example.eatmate.global.response.GlobalResponseDto;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Positive;
import jakarta.validation.constraints.PositiveOrZero;
import lombok.RequiredArgsConstructor;

@RestController
Expand Down Expand Up @@ -81,20 +94,32 @@ public ResponseEntity<GlobalResponseDto<Void>> joinOfflineMeeting(

@GetMapping("/offline")
@Operation(summary = "오프라인 모임 목록 조회", description = "오프라인 모임 목록을 조회합니다.")
public ResponseEntity<GlobalResponseDto<List<OfflineMeetingListResponseDto>>> getOfflineMeetingList(
@RequestParam(required = true) OfflineMeetingCategory category) {
public ResponseEntity<GlobalResponseDto<Slice<OfflineMeetingListResponseDto>>> getOfflineMeetingList(
@RequestParam(required = true) OfflineMeetingCategory category,
@RequestParam(defaultValue = "0")
@PositiveOrZero(message = "페이지 번호는 0 이상이어야 합니다") int page,
@RequestParam(defaultValue = "20")
@Positive(message = "페이지 크기는 양수여야 합니다")
@Max(value = 100, message = "페이지 크기는 최대 100을 초과할 수 없습니다") int size) {
PageRequest pageRequest = PageRequest.of(page, size, Sort.by("createdAt").descending());
return ResponseEntity.status(HttpStatus.OK)
.body(GlobalResponseDto.success(
meetingService.getOfflineMeetingList(category)));
meetingService.getOfflineMeetingList(category, pageRequest)));
}

@GetMapping("/delivery")
@Operation(summary = "배달 모임 목록 조회", description = "배달 모임 목록을 조회합니다.")
public ResponseEntity<GlobalResponseDto<List<DeliveryMeetingListResponseDto>>> getDeliveryMeetingList(
@RequestParam(required = true) FoodCategory foodCategory) {
public ResponseEntity<GlobalResponseDto<Slice<DeliveryMeetingListResponseDto>>> getDeliveryMeetingList(
@RequestParam(required = true) FoodCategory foodCategory,
@RequestParam(defaultValue = "0")
@PositiveOrZero(message = "페이지 번호는 0 이상이어야 합니다") int page,
@RequestParam(defaultValue = "20")
@Positive(message = "페이지 크기는 양수여야 합니다")
@Max(value = 100, message = "페이지 크기는 최대 100을 초과할 수 없습니다") int size) {
PageRequest pageRequest = PageRequest.of(page, size, Sort.by("createdAt").descending());
return ResponseEntity.status(HttpStatus.OK)
.body(GlobalResponseDto.success(
meetingService.getDeliveryMeetingList(foodCategory)));
meetingService.getDeliveryMeetingList(foodCategory, pageRequest)));
}

@GetMapping("/offline/{meetingId}")
Expand All @@ -114,4 +139,68 @@ public ResponseEntity<GlobalResponseDto<DeliveryMeetingDetailResponseDto>> getDe
.body(GlobalResponseDto.success(
meetingService.getDeliveryMeetingDetail(meetingId)));
}

@GetMapping("/my/created")
@Operation(summary = "내가 생성한 모임 목록 조회", description = "마이페이지에서 내가 생성한 모임 목록(과거 포함)을 조회합니다.")
@Parameter(name = "lastMeetingId", description = "마지막으로 조회한 모임 ID", required = false)
@Parameter(name = "lastDateTime", description = "마지막으로 조회한 모임의 날짜시간(ISO 형식: yyyy-MM-dd'T'HH:mm:ss)", required = false)
@Parameter(name = "pageSize", description = "페이지당 조회할 항목 수 (기본값: 20, 최대: 100)", required = false)
public ResponseEntity<GlobalResponseDto<CursorResponseDto<MeetingListResponseDto>>> getMyCreatedMeetingList(
@AuthenticationPrincipal UserDetails userDetails,
@RequestParam(required = false) Long lastMeetingId,
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime lastDateTime,
@RequestParam(defaultValue = "20")
@Positive(message = "페이지 크기는 양수여야 합니다")
@Max(value = 100, message = "페이지 크기는 최대 100을 초과할 수 없습니다") int pageSize
) {
return ResponseEntity.status(HttpStatus.OK)
.body(GlobalResponseDto.success(
meetingService.getMyMeetingList(userDetails, HOST, lastMeetingId, lastDateTime, pageSize)));
}

@GetMapping("/my/participated")
@Operation(summary = "내가 참여한 모임 목록 조회", description = "마이페이지에서 내가 참여한 모임 목록(과거 포함)을 조회합니다.")
@Parameter(name = "lastMeetingId", description = "마지막으로 조회한 모임 ID", required = false)
@Parameter(name = "lastDateTime", description = "마지막으로 조회한 모임의 날짜시간(ISO 형식: yyyy-MM-dd'T'HH:mm:ss)", required = false)
@Parameter(name = "pageSize", description = "페이지당 조회할 항목 수 (기본값: 20, 최대: 100)", required = false)
public ResponseEntity<GlobalResponseDto<CursorResponseDto<MeetingListResponseDto>>> getMyParticipatedMeetingList(
@AuthenticationPrincipal UserDetails userDetails,
@RequestParam(required = false) Long lastMeetingId,
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime lastDateTime,
@RequestParam(defaultValue = "20")
@Positive(message = "페이지 크기는 양수여야 합니다")
@Max(value = 100, message = "페이지 크기는 최대 100을 초과할 수 없습니다") int pageSize
) {
return ResponseEntity.status(HttpStatus.OK)
.body(GlobalResponseDto.success(
meetingService.getMyMeetingList(userDetails, PARTICIPANT, lastMeetingId, lastDateTime, pageSize)));
}

@GetMapping("/my/participating")
@Operation(summary = "내가 참여 중인 모임 목록 조회", description = "내가 참여중인 활성화된 모임 목록을 조회합니다.")
@Parameter(name = "lastMeetingId", description = "마지막으로 조회한 모임 ID", required = false)
@Parameter(name = "lastDateTime", description = "마지막으로 조회한 모임의 날짜시간(ISO 형식: yyyy-MM-dd'T'HH:mm:ss)", required = false)
@Parameter(name = "pageSize", description = "페이지당 조회할 항목 수 (기본값: 20, 최대: 100)", required = false)
public ResponseEntity<GlobalResponseDto<CursorResponseDto<MeetingListResponseDto>>> getMyActiveMeetingList(
@AuthenticationPrincipal UserDetails userDetails,
@RequestParam(required = false) Long lastMeetingId,
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime lastDateTime,
@RequestParam(defaultValue = "20")
@Positive(message = "페이지 크기는 양수여야 합니다")
@Max(value = 100, message = "페이지 크기는 최대 100을 초과할 수 없습니다") int pageSize
) {
return ResponseEntity.status(HttpStatus.OK)
.body(GlobalResponseDto.success(
meetingService.getMyActiveMeetingList(userDetails, lastMeetingId, lastDateTime, pageSize)));
}

@GetMapping("/my/upcoming")
@Operation(summary = "가장 임박한 모임 조회", description = "내가 참여중인 활성화된 모임 중 가장 임박한 모임을 조회합니다.")
public ResponseEntity<GlobalResponseDto<UpcomingMeetingResponseDto>> getUpcomingMeeting(
@AuthenticationPrincipal UserDetails userDetails) {
return ResponseEntity.status(HttpStatus.OK)
.body(GlobalResponseDto.success(
meetingService.getUpcomingMeeting(userDetails)));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public abstract class Meeting {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(name = "meeting_type", insertable = false, updatable = false)
private String type; // discriminator 값을 조회하기 위한 필드

@Column(length = 30, nullable = false)
private String meetingName;

Expand All @@ -50,6 +53,10 @@ public abstract class Meeting {
@Embedded
private ParticipantLimit participantLimit;

@Column(nullable = false)
@Enumerated(EnumType.STRING)
private MeetingStatus meetingStatus;

@CreatedDate
@Column(updatable = false)
private LocalDateTime createdAt;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.example.eatmate.app.domain.meeting.domain;

import lombok.Getter;

@Getter
public enum MeetingStatus {
ACTIVE("활성화"),
INACTIVE("비활성화"),
;

private final String text;

MeetingStatus(String text) {
this.text = text;
}

}
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package com.example.eatmate.app.domain.meeting.domain.repository;

import java.util.List;

import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.data.jpa.repository.JpaRepository;

import com.example.eatmate.app.domain.meeting.domain.DeliveryMeeting;
import com.example.eatmate.app.domain.meeting.domain.FoodCategory;
import com.example.eatmate.app.domain.meeting.domain.MeetingStatus;

public interface DeliveryMeetingRepository extends JpaRepository<DeliveryMeeting, Long> {
List<DeliveryMeeting> findAllByFoodCategory(FoodCategory foodCategory);
Slice<DeliveryMeeting> findAllByFoodCategoryAndMeetingStatus(FoodCategory foodCategory,
MeetingStatus meetingStatus, Pageable pageable);
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.example.eatmate.app.domain.meeting.domain.repository;

import java.time.LocalDateTime;
import java.util.List;

import com.example.eatmate.app.domain.meeting.domain.MeetingStatus;
import com.example.eatmate.app.domain.meeting.domain.ParticipantRole;
import com.example.eatmate.app.domain.meeting.dto.MeetingListResponseDto;
import com.example.eatmate.app.domain.meeting.dto.UpcomingMeetingResponseDto;

public interface MeetingCustomRepository {
List<MeetingListResponseDto> findAllMeetings(Long memberId, ParticipantRole role, MeetingStatus meetingStatus,
Long lastMeetingId, LocalDateTime lastDateTime, int pageSize);

UpcomingMeetingResponseDto findUpcomingMeeting(Long memberId);
}
Loading

0 comments on commit 4e0a13a

Please sign in to comment.