Skip to content

Commit

Permalink
Merge pull request #507 from Kernel360/develop
Browse files Browse the repository at this point in the history
main 병합 진행
  • Loading branch information
minson96 authored Mar 13, 2024
2 parents 1e5d04f + a178933 commit 9212130
Show file tree
Hide file tree
Showing 137 changed files with 4,159 additions and 1,446 deletions.
1 change: 1 addition & 0 deletions .github/workflows/prod-backend-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
if: >
github.event.pull_request.merged == true &&
contains(join(github.event.pull_request.labels.*.name, ','), '💻Frontend')
steps:
## jdk setting
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
사용자들은 자신의 경험을 다양한 면에서 기록하고 공유할 수 있습니다.

## 배포 주소

[이길 로그](https://yigil.co.kr)

## 주요 기능
Expand Down
20 changes: 11 additions & 9 deletions backend/support/domain/src/main/java/kr/co/yigil/member/Ages.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,22 @@
@Getter
@AllArgsConstructor
public enum Ages{
NONE("없음"),
UNDER_TEENAGERS("10대 이하"),
TEENAGERS("10대"),
TWENTIES("20대"),
THIRTIES("30대"),
FORTIES("40대"),
FIFTIES("50대"),
OVER_SIXTIES("60대 이상");
NONE("없음", "없음"),
UNDER_TEENAGERS("10대 이하", "0"),
TEENAGERS("10대", "10"),
TWENTIES("20대", "20"),
THIRTIES("30대", "30"),
FORTIES("40대", "40"),
FIFTIES("50대", "50"),
OVER_SIXTIES("60대 이상", "60");

private final String viewName;
private final String input;
@JsonCreator
public static Ages from(String s) {

for (Ages ages : Ages.values()) {
if (ages.getViewName().equals(s)) {
if (ages.getInput().equals(s)) {
return ages;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
@Getter
@AllArgsConstructor
public enum Gender {
MALE("남성"),
FEMALE("여성"),
NONE("없음");
MALE("남성", "male"),
FEMALE("여성", "female"),
NONE("없음", "none");

private final String viewName;
private final String input;
@JsonCreator
public static Gender from(String s) {
for (Gender gender : Gender.values()) {
if (gender.getViewName().equals(s)) {
if (gender.getInput().equals(s)) {
return gender;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,17 @@ public Member(final Long id, final String email, final String socialLoginId, fin

public void updateMemberInfo(final String nickname, final String age, final String gender,
final AttachFile profileImageFile, final List<MemberRegion> favoriteRegions) {
this.nickname = nickname;
this.ages = Ages.from(age);
this.gender = Gender.from(gender);

if (nickname != null) this.nickname = nickname;
if(age != null) this.ages = Ages.from(age);
if(gender != null) this.gender = Gender.from(gender);
if (profileImageFile != null) {
this.profileImageUrl = profileImageFile.getFileUrl();
}
this.favoriteRegions.clear();
this.favoriteRegions.addAll(favoriteRegions);
if(favoriteRegions != null) {
this.favoriteRegions.clear();
this.favoriteRegions.addAll(favoriteRegions);
}
}

public String getProfileImageUrl() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
package kr.co.yigil.region.domain;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor
public class Region {

@Id
private Long id;

Expand All @@ -24,4 +30,7 @@ public class Region {
@ManyToOne
@JoinColumn(name = "category_id")
private RegionCategory category;

@OneToMany(mappedBy = "region", fetch = FetchType.LAZY, cascade = CascadeType.PERSIST, orphanRemoval = true)
private final List<MemberRegion> members = new ArrayList<>();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package kr.co.yigil.travel.domain.dto;

import com.querydsl.core.annotations.QueryProjection;
import java.time.LocalDateTime;
import lombok.Data;

@Data
public class CourseListDto {

private final Long courseId;
private final String title;
private final Double rate;
private final String mapStaticImageUrl;
private final Integer spotCount;
private final LocalDateTime createdDate;
private final Boolean isPrivate;

@QueryProjection
public CourseListDto(Long courseId, String title, Double rate, String mapStaticImageUrl,
Integer spotCount, LocalDateTime createdDate, Boolean isPrivate) {
this.courseId = courseId;
this.title = title;
this.rate = rate;
this.mapStaticImageUrl = mapStaticImageUrl;
this.spotCount = spotCount;
this.createdDate = createdDate;
this.isPrivate = isPrivate;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package kr.co.yigil.travel.domain.dto;

import com.querydsl.core.annotations.QueryProjection;
import java.time.LocalDateTime;
import lombok.Data;

@Data
public class SpotListDto {

private final Long spotId;
private final Long placeId;
private final String title;
private final double rate;
private final String imageUrl;
private final LocalDateTime createdDate;
private final Boolean isPrivate;

@QueryProjection
public SpotListDto(Long spotId, Long placeId, String title, double rate, String imageUrl,
LocalDateTime createdDate, Boolean isPrivate) {
this.spotId = spotId;
this.placeId = placeId;
this.title = title;
this.rate = rate;
this.imageUrl = imageUrl;
this.createdDate = createdDate;
this.isPrivate = isPrivate;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
import java.util.ArrayList;
import java.util.List;
import kr.co.yigil.global.Selected;
import kr.co.yigil.travel.domain.Course;
import kr.co.yigil.travel.domain.QCourse;
import kr.co.yigil.travel.domain.dto.CourseListDto;
import kr.co.yigil.travel.domain.dto.QCourseListDto;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
Expand All @@ -27,7 +28,7 @@ public class CourseQueryDslRepository {

private final JPAQueryFactory jpaQueryFactory;

public Page<Course> findAllByMemberIdAndIsPrivate(Long memberId, Selected visibility,
public Page<CourseListDto> findAllByMemberIdAndIsPrivate(Long memberId, Selected visibility,
Pageable pageable) {
QCourse course = QCourse.course;
BooleanBuilder builder = new BooleanBuilder();
Expand All @@ -48,7 +49,18 @@ public Page<Course> findAllByMemberIdAndIsPrivate(Long memberId, Selected visibi
Predicate predicate = builder.getValue();
List<OrderSpecifier<?>> orderSpecifiers = getOrderSpecifiers(pageable.getSort());

List<Course> courses = jpaQueryFactory.select(course)
List<CourseListDto> courses = jpaQueryFactory
.select(
new QCourseListDto(
course.id,
course.title,
course.rate,
course.mapStaticImageFile.fileUrl,
course.spots.size(),
course.createdAt,
course.isPrivate
)
)
.from(course)
.where(predicate)
.orderBy(orderSpecifiers.toArray(new OrderSpecifier[0]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
import java.util.List;
import kr.co.yigil.global.Selected;
import kr.co.yigil.travel.domain.QSpot;
import kr.co.yigil.travel.domain.Spot;
import kr.co.yigil.travel.domain.dto.QSpotListDto;
import kr.co.yigil.travel.domain.dto.SpotListDto;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
Expand All @@ -26,7 +27,7 @@
public class SpotQueryDslRepository {

private final JPAQueryFactory jpaQueryFactory;
public Page<Spot> findAllByMemberIdAndIsPrivate(Long memberId, Selected visibility, Pageable pageable) {
public Page<SpotListDto> findAllByMemberIdAndIsPrivate(Long memberId, Selected visibility, Pageable pageable) {
QSpot spot = QSpot.spot;
BooleanBuilder builder = new BooleanBuilder();

Expand All @@ -47,7 +48,18 @@ public Page<Spot> findAllByMemberIdAndIsPrivate(Long memberId, Selected visibili
Predicate predicate = builder.getValue();
List<OrderSpecifier<?>> orderSpecifiers = getOrderSpecifiers(pageable.getSort());

List<Spot> spots = jpaQueryFactory.select(spot)
List<SpotListDto> spots = jpaQueryFactory
.select(
new QSpotListDto(
spot.id,
spot.place.id,
spot.title,
spot.rate,
spot.place.imageFile.fileUrl,
spot.createdAt,
spot.isPrivate
)
)
.from(spot)
.where(predicate)
.orderBy(orderSpecifiers.toArray(new OrderSpecifier[0]))
Expand All @@ -60,7 +72,6 @@ public Page<Spot> findAllByMemberIdAndIsPrivate(Long memberId, Selected visibili
.fetchCount();

return new PageImpl<>(spots, pageable, total);

}

private List<OrderSpecifier<?>> getOrderSpecifiers(Sort sort){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.time.LocalDateTime;
import java.util.Optional;
import kr.co.yigil.travel.domain.Spot;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
Expand All @@ -11,6 +11,8 @@
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import kr.co.yigil.travel.domain.Spot;

@Repository
public interface SpotRepository extends JpaRepository<Spot, Long> {

Expand All @@ -35,4 +37,6 @@ public interface SpotRepository extends JpaRepository<Spot, Long> {

@Query("SELECT s.place, COUNT(s) AS referenceCount, m.ages, m.gender FROM Spot s INNER JOIN s.member m WHERE s.createdAt BETWEEN :startDate AND :endDate GROUP BY s.place, m.ages, m.gender ORDER BY referenceCount DESC, m.ages asc, m.gender ASC")
Slice<Object[]> findPlaceReferenceCountGroupByDemographicBetweenDates(LocalDateTime startDate, LocalDateTime endDate, Pageable pageable);

boolean existsByPlaceIdAndMemberId(Long placeId, Long memberId);
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package kr.co.yigil.member.interfaces.dto.response;

import kr.co.yigil.member.Ages;
import kr.co.yigil.member.Gender;
import kr.co.yigil.member.MemberStatus;
import kr.co.yigil.member.SocialLoginType;
import lombok.Builder;
import lombok.Getter;
import lombok.ToString;
Expand All @@ -13,7 +16,9 @@ public class MemberInfoDto {
private final String nickname;
private final String profileImageUrl;
private final MemberStatus status;
private final SocialLoginType socialLoginType;
private final Ages ages;
private final Gender gender;
private final String email;
private final String joinedAt;


}
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
package kr.co.yigil.notice.interfaces.controller;

import kr.co.yigil.global.SortBy;
import kr.co.yigil.global.SortOrder;
import kr.co.yigil.notice.application.NoticeFacade;
import kr.co.yigil.notice.interfaces.dto.NoticeDto.NoticeCreateRequest;
import kr.co.yigil.notice.interfaces.dto.NoticeDto.NoticeCreateResponse;
import kr.co.yigil.notice.interfaces.dto.NoticeDto.NoticeDeleteResponse;
import kr.co.yigil.notice.interfaces.dto.NoticeDto.NoticeDetailResponse;
import kr.co.yigil.notice.interfaces.dto.NoticeDto.NoticeListResponse;
import kr.co.yigil.notice.interfaces.dto.NoticeDto.NoticeUpdateRequest;
import kr.co.yigil.notice.interfaces.dto.NoticeDto.NoticeUpdateResponse;
import kr.co.yigil.notice.interfaces.dto.mapper.NoticeMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.web.PageableDefault;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2024-03-04T18:48:06+0900",
comments = "version: 1.5.5.Final, compiler: javac, environment: Java 21.0.1 (Oracle Corporation)"
date = "2024-03-11T15:27:23+0900",
comments = "version: 1.5.5.Final, compiler: javac, environment: Java 21.0.2 (Oracle Corporation)"
)
@Component
public class BookmarkMapperImpl implements BookmarkMapper {
Expand Down
Loading

0 comments on commit 9212130

Please sign in to comment.