Skip to content

Commit

Permalink
feat: Spark 엔티티에 채팅url 추가, 관련 api 적용 (#14) (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
ympark99 authored Oct 15, 2023
1 parent 9281243 commit 02aecd1
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ public ResponseEntity<SparkHostResponse> host(@AuthenticationPrincipal CustomUse
@RequestParam("capacity") Long capacity,
@RequestParam("durationHour") DurationHour durationHour,
@RequestParam("hostDetail") String hostDetail,
@RequestParam("chatUrl") String chatUrl,
@RequestParam(value = "img", required = false)
MultipartFile img
) {
HostDto hostDto = new HostDto(img, placeId, title, description, type, always, sparkDate, price,
capacityType,
capacity, durationHour, hostDetail);
capacity, durationHour, hostDetail, chatUrl);

Member host = customUserDetails.getMember();
return ResponseEntity.ok().body(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ public class HostDto {
DurationHour durationHour;

String hostDetail;

String chatUrl;
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public class SparkResponse {

String hostDetail;

String chatUrl;

String description;

List<ParticipateMemberDto> participateMember;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,33 +54,39 @@ public Spark getById(Long sparkId) {
public List<SparkResponse> getSparkListByPlaceId(Long placeId) {
return sparkRepository.findSparksByPlace(placeId)
.stream().map(spark -> SparkResponse.builder().sparkId(spark.getSparkId())
.img(spark.getImg())
.title(spark.getTitle())
.durationHour(spark.getDurationHour())
.sparkType(spark.getType())
.sparkDate(spark.getSparkDate())
.capacity(spark.getCapacity())
.memberCount(spark.getMemberCount())
.price(spark.getPrice())
.hostName(spark.getHost().getName())
.hostDetail(spark.getHostDetail())
.hostImg(spark.getHost().getProfileImg())
.description(spark.getDescription())
.participateMember(spark.getMemberSparkMappingList().stream().map(
memberSparkMapping -> ParticipateMemberDto.builder()
.memberId(
memberSparkMapping.getApplicant().getMemberId())
.profileImg(
memberSparkMapping.getApplicant()

.img(spark.getImg())
.title(spark.getTitle())
.durationHour(spark.getDurationHour())
.sparkType(spark.getType())
.sparkDate(spark.getSparkDate())
.capacity(spark.getCapacity())
.memberCount(spark.getMemberCount())
.price(spark.getPrice())
.hostName(spark.getHost().getName())
.hostDetail(spark.getHostDetail())
.chatUrl(spark.getChatUrl())
.hostImg(spark.getHost().getProfileImg())
.description(spark.getDescription())
.participateMember(
spark.getMemberSparkMappingList()
.stream().map(
memberSparkMapping -> ParticipateMemberDto.builder()
.memberId(
memberSparkMapping.getApplicant()
.getMemberId())
.profileImg(
memberSparkMapping.getApplicant()
.getProfileImg())
.build()).collect(Collectors.toList()))
.recruitType(spark.getRecruitType())
.lng(spark.getPlace().getLongitude())
.lat(spark.getPlace().getLatitude())
.placeId(spark.getPlace().getPlaceId())
.placeName(spark.getPlace().getName())
.capacityType(spark.getCapacityType())
.build()).collect(Collectors.toList());
.build())
.collect(Collectors.toList()))
.recruitType(spark.getRecruitType())
.lng(spark.getPlace().getLongitude())
.lat(spark.getPlace().getLatitude())
.placeId(spark.getPlace().getPlaceId())
.placeName(spark.getPlace().getName())
.capacityType(spark.getCapacityType())
.build()).collect(Collectors.toList());
}

@Override
Expand Down Expand Up @@ -196,6 +202,7 @@ public SparkResponse getSparkInfo(Long id) {
.hostName(spark.getHost().getName())
.hostImg(spark.getHost().getProfileImg())
.hostDetail(spark.getHostDetail())
.chatUrl(spark.getChatUrl())
.memberCount(spark.getMemberCount())
.recruitType(spark.getRecruitType())
.placeId(spark.getPlace().getPlaceId())
Expand Down Expand Up @@ -235,6 +242,7 @@ public List<SparkResponse> searchSpark(String value) {
.detailAddress(spark.getPlace().getDetailAddress())
.hostName(spark.getHost().getName())
.hostDetail(spark.getHostDetail())
.chatUrl(spark.getChatUrl())
.recruitType(spark.getRecruitType())
.capacity(spark.getCapacity())
.title(spark.getTitle())
Expand Down Expand Up @@ -278,6 +286,7 @@ public Spark saveSpark(Member host, Place place, HostDto hostDto, String imgUrl)
.capacity(hostDto.getCapacity())
.durationHour(hostDto.getDurationHour())
.hostDetail(hostDto.getHostDetail())
.chatUrl(hostDto.getChatUrl())
.recruitType(RecruitType.RECRUITING)
.host(host)
.place(place)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public class Spark extends BaseEntity {
@Lob
private String hostDetail;

// 채팅방 링크
@Column(name = "chatUrl")
private String chatUrl;

// 모집상태
@Column(name = "recruitType")
@Enumerated(value = EnumType.STRING)
Expand All @@ -102,7 +106,7 @@ public class Spark extends BaseEntity {
@Builder
public Spark(String title, String description, SparkType type, Always always, LocalDateTime sparkDate,
Long memberCount, Long price, CapacityType capacityType, Long capacity,
DurationHour durationHour, String hostDetail,
DurationHour durationHour, String hostDetail, String chatUrl,
RecruitType recruitType, Member host, Place place, String img
) {
this.title = title;
Expand All @@ -116,6 +120,7 @@ public Spark(String title, String description, SparkType type, Always always, Lo
this.capacity = capacity;
this.durationHour = durationHour;
this.hostDetail = hostDetail;
this.chatUrl = chatUrl;
this.recruitType = recruitType;
this.host = host;
this.place = place;
Expand Down

0 comments on commit 02aecd1

Please sign in to comment.