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

feat(meeting): Implementation of features related to meeting requests #105

Merged
merged 51 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
b0112aa
fix: fix error entrance h2-console
Aug 14, 2023
71f4ac7
feat(meeting): add dto for request, response meeting api
Aug 14, 2023
1efa1f5
feat(valid): add custom bean validator for meeting request
Aug 14, 2023
d717937
test(valid): add kakao open chat link format validator
Aug 14, 2023
a86064b
feat(meeting): add repository specification
Aug 14, 2023
f240b34
feat(meeting): add service specification
Aug 14, 2023
c79d3fe
feat(meeting): add controller specification
Aug 14, 2023
04ddff3
style(test): change directory Integration Abstract module
Aug 14, 2023
74f7195
test: add AbstractServiceTest for Service Integration Test
Aug 14, 2023
7258668
test: add test sendRequest()
Aug 14, 2023
ac401f1
feat: add TeamNotFoundException
Aug 15, 2023
c9b7407
feat(meeting): change default status to PENDING
Aug 15, 2023
37eb32d
feat(meeting): implement sendRequest service method
Aug 15, 2023
48a0838
feat(meeting): add method loading team proxy
Aug 15, 2023
18726c6
test(meeting): add test loading team proxy
Aug 15, 2023
16f5013
refactor(meeting): sendRequest method refactoring
Aug 15, 2023
dca405a
feat(error): Add custom exception that might occur in the MeetingHand…
Aug 16, 2023
20890f8
feat(valid): Add custom validator that checking expiration given date
Aug 16, 2023
fb50ded
refactor(meeting): change chatLink field to NOT NULL
Aug 16, 2023
9b11415
refactor(meeting): add validateOpenChatLinkFormat method to CustomFor…
Aug 16, 2023
0d85208
refactor(meeting): Detach Meeting Accept And Reject API
Aug 16, 2023
9afeda3
feat(meeting): rename MeetingReadRepository and add find query for Te…
Aug 16, 2023
5ccf71e
feat(meeting): rename MeetingReadRepository and add find query for Te…
Aug 16, 2023
733a998
feat(user): add use credit method and validate message format
Aug 16, 2023
25a1df7
refactor(meeting): Seperate Meeting Service Components
Aug 16, 2023
9ba0da1
refactor(meeting): change search Meeting List specification
Aug 25, 2023
1860a47
fix(test): fix test error
Aug 25, 2023
78cacb7
test: add fixture for Meeting, Team Image
Aug 27, 2023
cee4a60
style(dto): add postfix "Dto" to dto classes
Aug 27, 2023
f663d03
refactor(meeting): add parameter find date to search meeting informat…
Aug 27, 2023
adbf431
refactor(meeting): add validate method before handle MeetingRequest E…
Aug 27, 2023
7ec1bb3
test(meeting): add test for searching meeting information query
Aug 27, 2023
1c4d9fa
feat(meeting): add dto to find Meeting Information from query directly
Aug 27, 2023
b6e265b
feat(meeting): add feature to find personal accepted meeting information
Aug 27, 2023
05058f5
test: modify fixture for test
Aug 27, 2023
49b312b
feat(meeting): add dto to find MeetingRequest Information from query …
Aug 27, 2023
4d7a287
feat(meeting): add feature find sent & received meeting request
Aug 28, 2023
3fd490b
refactor(test): change location set authentication method
Aug 28, 2023
d703cd1
feat(meeting): add update & find query and test
Aug 28, 2023
c724458
feat(meeting): add feature getting accepted meeting list
Aug 28, 2023
5bfb52e
fix(meeting): fix find request related deleted team
Aug 28, 2023
0a09448
feat(meeting): add feature update request's accept status to EXPIRED
Aug 28, 2023
bce6ec3
refactor(meeting): change hierarchy MeetingRequestResponseDto
Aug 28, 2023
5a42d0a
feat(meeting): add get list methods that sent & received request to m…
Aug 28, 2023
876467a
test(meeting): add get list methods test
Aug 28, 2023
2797080
refactor(meeting): remove duplicate 'v1' word in url
Sep 2, 2023
d70ac46
fix(meeting): fix tests and change syntax generate NPE
Sep 2, 2023
8eb7bdf
fix(resolver): throw AccessTokenNotFoundException when principal not …
Sep 2, 2023
f6eb57b
test(meeting): add testing class MeetingController
Sep 2, 2023
fc5006b
refactor(meeting): Tie up to common path '/meeting'
Sep 3, 2023
a011de0
feat(cost): add cost event (#104)
KAispread Sep 4, 2023
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 @@ -23,7 +23,7 @@ public class H2DatabaseRunnerConfig {
""";

@Bean
@Profile("default")
@Profile("!(prod | dev)")
ApplicationRunner applicationRunner(final DataSource dataSource,
final H2ConsoleProperties h2ConsoleProperties) {
return args -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer m
Object principal = SecurityContextHolder.getContext()
.getAuthentication().getPrincipal();

if (!(principal instanceof MemberPrincipal memberPrincipal)) {
if (!(principal instanceof MemberPrincipal memberPrincipal) || memberPrincipal.getMemberId() == null) {
throw new AccessTokenNotFoundException();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package com.e2i.wemeet.controller.meeting;

import com.e2i.wemeet.config.resolver.member.MemberId;
import com.e2i.wemeet.domain.meeting.data.AcceptStatus;
import com.e2i.wemeet.dto.request.meeting.MeetingRequestAcceptDto;
import com.e2i.wemeet.dto.request.meeting.SendMeetingRequestDto;
import com.e2i.wemeet.dto.request.meeting.SendMeetingWithMessageRequestDto;
import com.e2i.wemeet.dto.response.ResponseDto;
import com.e2i.wemeet.dto.response.meeting.AcceptedMeetingResponseDto;
import com.e2i.wemeet.dto.response.meeting.ReceivedMeetingResponseDto;
import com.e2i.wemeet.dto.response.meeting.SentMeetingResponseDto;
import com.e2i.wemeet.service.meeting.MeetingHandleService;
import com.e2i.wemeet.service.meeting.MeetingListService;
import jakarta.validation.Valid;
import java.time.LocalDateTime;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequiredArgsConstructor
@RequestMapping("/v1/meeting")
@RestController
public class MeetingController {

private final MeetingHandleService meetingHandleService;
private final MeetingListService meetingListService;

@PostMapping
public ResponseDto<Void> sendMeetingRequest(@MemberId Long memberId, @RequestBody @Valid SendMeetingRequestDto requestDto) {
meetingHandleService.sendRequest(requestDto, memberId);

return ResponseDto.success("Send meeting request success");
}

@PostMapping("/message")
public ResponseDto<Void> sendMeetingRequestWithMessage(@MemberId Long memberId,
@RequestBody @Valid SendMeetingWithMessageRequestDto requestDto) {
meetingHandleService.sendRequestWithMessage(requestDto, memberId);

return ResponseDto.success("Send meeting request with message success");
}

@PostMapping("/accept/{meetingRequestId}")
public ResponseDto<Long> acceptMeetingRequest(@MemberId Long memberId,
@RequestBody @Valid MeetingRequestAcceptDto requestDto,
@PathVariable Long meetingRequestId) {
final String openChatLink = requestDto.kakaoOpenChatLink();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dto를 그대로 넘기지 않고 String 데이터를 빼서 Service로 넘긴 이유가 있으신가요?!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

미팅 요청을 처리하는 Service 입장에서는 사용자로부터 받은 오픈채팅방 링크만 필요하기때문에 String 데이터를 따로 빼서 넘겨주었습니다!
불필요한 계층간 의존성도 줄일 수 있을 것 같아요!

final LocalDateTime acceptDateTime = LocalDateTime.now();

Long meetingId = meetingHandleService.acceptRequest(openChatLink, memberId, meetingRequestId, acceptDateTime);

return ResponseDto.success("Meeting was successfully matched", meetingId);
}

@PostMapping("/reject/{meetingRequestId}")
public ResponseDto<AcceptStatus> rejectMeetingRequest(@MemberId Long memberId,
@PathVariable Long meetingRequestId) {
LocalDateTime rejectDateTime = LocalDateTime.now();
AcceptStatus acceptStatus = meetingHandleService.rejectRequest(memberId, meetingRequestId, rejectDateTime);

return ResponseDto.success("Meeting request successfully Rejected", acceptStatus);
}

@GetMapping("/accepted")
public ResponseDto<List<AcceptedMeetingResponseDto>> getAcceptedMeetingList(@MemberId Long memberId) {
final LocalDateTime findDateTime = LocalDateTime.now();
List<AcceptedMeetingResponseDto> acceptedMeetingList = meetingListService.getAcceptedMeetingList(memberId, findDateTime);

return ResponseDto.success("Get accepted meeting list success", acceptedMeetingList);
}


@GetMapping("/sent")
public ResponseDto<List<SentMeetingResponseDto>> getSentMeetingRequestList(@MemberId Long memberId) {
final LocalDateTime findDateTime = LocalDateTime.now();
List<SentMeetingResponseDto> sentRequestList = meetingListService.getSentRequestList(memberId, findDateTime);

return ResponseDto.success("Get sent meeting request list success", sentRequestList);
}

@GetMapping("/received")
public ResponseDto<List<ReceivedMeetingResponseDto>> getReceivedMeetingRequestList(@MemberId Long memberId) {
final LocalDateTime findDateTime = LocalDateTime.now();
List<ReceivedMeetingResponseDto> receiveRequestList = meetingListService.getReceiveRequestList(memberId, findDateTime);

return ResponseDto.success("Get receive meeting request list success", receiveRequestList);
}


}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.e2i.wemeet.domain.credit;
package com.e2i.wemeet.domain.cost;

import com.e2i.wemeet.domain.base.BaseTimeEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
Expand All @@ -13,7 +12,7 @@
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
public class Cost extends BaseTimeEntity {
public class Cost {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand All @@ -22,16 +21,11 @@ public class Cost extends BaseTimeEntity {
@Column(nullable = false)
private String type;

@Column(nullable = false)
@Column(nullable = false, name = "cost_value")
private Integer value;

public Cost(Earn earn, Integer value) {
this.type = earn.name();
public Cost(String type, Integer value) {
this.type = type;
this.value = value;
}

public Cost(Spent spent) {
this.type = spent.name();
this.value = spent.getValue();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.e2i.wemeet.domain.credit;
package com.e2i.wemeet.domain.cost;

import com.e2i.wemeet.domain.base.BaseTimeEntity;
import com.e2i.wemeet.domain.base.CreateTimeEntity;
import com.e2i.wemeet.domain.member.Member;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
Expand All @@ -16,7 +16,7 @@
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
public class CostHistory extends BaseTimeEntity {
public class CostHistory extends CreateTimeEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand All @@ -42,11 +42,18 @@ public CostHistory(Member member, Earn earn, Integer costValue) {
this.costValue = costValue;
}

public CostHistory(Member member, Spent spent) {
public CostHistory(Member member, Spent spent, Integer costValue) {
this.member = member;
this.costType = Spent.getTypeName();
this.detail = spent.name();
this.costValue = spent.getValue();
this.costValue = costValue;
}

public CostHistory(Member member, Payment payment, Integer costValue) {
this.member = member;
this.costType = Payment.getTypeName();
this.detail = payment.name();
this.costValue = costValue;
}

public boolean isSpent() {
Expand All @@ -56,4 +63,8 @@ public boolean isSpent() {
public boolean isEarn() {
return Earn.getTypeName().equals(this.costType);
}

public boolean isPayment() {
return Payment.getTypeName().equals(this.costType);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.e2i.wemeet.domain.cost;

import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface CostHistoryRepository extends JpaRepository<CostHistory, Long> {

@Query("select ch from CostHistory ch where ch.member.memberId = :memberId")
List<CostHistory> findAllByMemberId(@Param("memberId") Long memberId);

}
13 changes: 13 additions & 0 deletions src/main/java/com/e2i/wemeet/domain/cost/CostRepository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.e2i.wemeet.domain.cost;

import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface CostRepository extends JpaRepository<Cost, Long> {

@Query("select c.value from Cost c where c.type = :type")
Optional<Integer> findValueByType(@Param(value = "type") String type);

}
19 changes: 19 additions & 0 deletions src/main/java/com/e2i/wemeet/domain/cost/Earn.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.e2i.wemeet.domain.cost;

import lombok.Getter;

@Getter
public enum Earn {
EVENT("이벤트"),
ADVERTISEMENT("광고 시청");

private final String detail;

Earn(String detail) {
this.detail = detail;
}

public static String getTypeName() {
return "EARN";
}
}
21 changes: 21 additions & 0 deletions src/main/java/com/e2i/wemeet/domain/cost/Payment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.e2i.wemeet.domain.cost;

import lombok.Getter;

@Getter
public enum Payment {
PAYMENT_5900("5900원 결제"),
PAYMENT_9900("9900원 결제"),
PAYMENT_14900("14900원 결제"),
PAYMENT_19900("19900원 결제");

private final String detail;

Payment(String detail) {
this.detail = detail;
}

public static String getTypeName() {
return "PAYMENT";
}
}
23 changes: 23 additions & 0 deletions src/main/java/com/e2i/wemeet/domain/cost/Spent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.e2i.wemeet.domain.cost;

import lombok.Getter;

@Getter
public enum Spent {

DEFAULT("기본 값"),
MEETING_REQUEST("미팅 요청"),
MEETING_REQUEST_WITH_MESSAGE("쪽지와 함께 미팅 요청"),
MEETING_ACCEPT("미팅 수락"),
MORE_TEAM("팀 더보기");

private final String detail;

Spent(String detail) {
this.detail = detail;
}

public static String getTypeName() {
return "SPENT";
}
}
14 changes: 0 additions & 14 deletions src/main/java/com/e2i/wemeet/domain/credit/Earn.java

This file was deleted.

19 changes: 0 additions & 19 deletions src/main/java/com/e2i/wemeet/domain/credit/Spent.java

This file was deleted.

21 changes: 15 additions & 6 deletions src/main/java/com/e2i/wemeet/domain/meeting/Meeting.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.e2i.wemeet.domain.meeting;

import static com.e2i.wemeet.util.validator.CustomFormatValidator.validateOpenChatLinkFormat;

import com.e2i.wemeet.domain.base.BaseTimeEntity;
import com.e2i.wemeet.domain.team.Team;
import jakarta.persistence.Column;
Expand All @@ -9,8 +11,8 @@
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import java.time.LocalDateTime;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

Expand All @@ -31,15 +33,22 @@ public class Meeting extends BaseTimeEntity {
@JoinColumn(name = "partnerTeamId", referencedColumnName = "teamId", nullable = false)
private Team partnerTeam;

@Column(length = 50)
@Column(length = 50, nullable = false)
private String chatLink;

private LocalDateTime isOver;
@Column(nullable = false)
private Boolean isOver;

public Meeting(Team team, Team partnerTeam, String chatLink, LocalDateTime isOver) {
@Builder
public Meeting(Team team, Team partnerTeam, String chatLink) {
this.team = team;
this.partnerTeam = partnerTeam;
this.chatLink = chatLink;
this.isOver = isOver;
this.chatLink = validateOpenChatLinkFormat(chatLink);
this.isOver = false;
}

public void over() {
this.isOver = true;
}

}
Loading
Loading