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

24.03.26 prod 서버 배포 #665

Merged
merged 84 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
ac5a615
feat: 장소 상세 화면에서 스팟 추가로 넘어가는 기능 작성
hatchling13 Mar 25, 2024
92c5e80
feat: 네이버 로그인 완료
ollehkt Mar 25, 2024
18b006b
Merge branch 'develop' into feat-naver-login
ollehkt Mar 25, 2024
0b58fa6
Merge branch 'develop' into fix-place-detail
hatchling13 Mar 25, 2024
47df5b2
admin 통계 refactoring
ShineCorine Mar 25, 2024
d62edb1
매일 총 좋아요 수를 집계하는 배치 작성
ShineCorine Mar 25, 2024
3c3dedc
매일의 totalFavorCount를 조회하는 api 작성
ShineCorine Mar 25, 2024
786fd3f
테스트 작성
ShineCorine Mar 25, 2024
d919d99
feat: 장소 상세 화면에서 Spot 추가 화면으로 넘어가는 기능 구현
hatchling13 Mar 25, 2024
7361982
기타 변경사항
ShineCorine Mar 25, 2024
aec8624
Merge pull request #634 from Kernel360/633-admin-통계api-endpoint-한-곳으로…
stoneHee99 Mar 25, 2024
30c6ac8
feat: 댓글 작업 중
hatchling13 Mar 25, 2024
6735276
fix error with push json to redis
stoneHee99 Mar 25, 2024
3cf96b2
add test for admin api with stats
stoneHee99 Mar 25, 2024
577ea22
merge with upstream
stoneHee99 Mar 25, 2024
da8a91a
fix: 무한 스크롤 대신 더보기 버튼 쓰도록 변경
hatchling13 Mar 25, 2024
b76e090
fix gradle
stoneHee99 Mar 25, 2024
c521bc2
Merge pull request #637 from Kernel360/607-좋아요-api가-반응이-느린-문제
minson96 Mar 25, 2024
7b2c0fe
Update application.yml
minson96 Mar 25, 2024
bac40d9
Update application.yml
minson96 Mar 25, 2024
1ab117d
Update application.yml
minson96 Mar 25, 2024
71094d2
Merge pull request #638 from Kernel360/yaml-restore
minson96 Mar 25, 2024
7712905
Update application.yml
minson96 Mar 25, 2024
5351515
Update README.md
minson96 Mar 25, 2024
35fe1d4
Merge pull request #639 from Kernel360/minson96-patch-6
minson96 Mar 25, 2024
810f694
courses in place에 담기는 정보 변경
ShineCorine Mar 25, 2024
6a8cf52
20240226 refactoring merge conflict resolve
ShineCorine Mar 25, 2024
f14f443
병합 후 api 파일 새로 생성
ShineCorine Mar 25, 2024
9f372d7
fix: 댓글 동작 자연스럽게 수정
hatchling13 Mar 25, 2024
5a13dad
fix: 더보기 버튼으로 남은 댓글들 가져오는 기능 구현
hatchling13 Mar 25, 2024
ab8225f
Merge pull request #640 from Kernel360/635-place-in-course
Uknow928 Mar 25, 2024
be6576e
remove: 백엔드 데이터 구조 수정으로 인한 별점순 정렬 UI 막아두기
hatchling13 Mar 25, 2024
545faf7
fix: 로딩 더미 장소 목록 제목 수정
hatchling13 Mar 25, 2024
e8cf845
feat : 네이버 로그인 방식 추가
Uknow928 Mar 25, 2024
94d1193
feat: 코스에 댓글 달기 및 좋아요 기능 구현
hatchling13 Mar 25, 2024
6d251e3
Merge pull request #642 from Kernel360/641-네이버-소셜-로그인-기능
minson96 Mar 25, 2024
903760d
spot in place에 작성자 id 추가
ShineCorine Mar 25, 2024
8a08518
Merge branch 'develop' of https://github.com/Kernel360/f1-Yigil into …
ShineCorine Mar 25, 2024
78ca4ff
20240226 refactoring merge conflict resolve
ShineCorine Mar 25, 2024
f1544c0
병합 후 문서 업데이트
ShineCorine Mar 25, 2024
dc4db04
Merge pull request #643 from Kernel360/635-place-in-course
minson96 Mar 25, 2024
a462a6e
fix: 백엔드와 데이터 구조 맞추기
hatchling13 Mar 25, 2024
bc7f8d0
fix: 내 스팟, 코스가 아니어도 나오던 수정 버튼 수정
ollehkt Mar 25, 2024
3589abb
hotfix TotalFavorCount 배치 수정
ShineCorine Mar 26, 2024
94f49e8
refactor api for admin page
stoneHee99 Mar 26, 2024
3ac9509
Merge branch 'develop' of https://github.com/Kernel360/f1-Yigil into …
stoneHee99 Mar 26, 2024
c448cd5
fix: 링크 href 수정
hatchling13 Mar 26, 2024
4737810
fix: 시간 hydration 에러 수정
ollehkt Mar 26, 2024
a4661be
Merge pull request #645 from davidktlee/feat-course-detail
ollehkt Mar 26, 2024
a06744c
fix: 피드백 반영
hatchling13 Mar 26, 2024
0ca85d2
follow 에 createdAt 필드 추가
ShineCorine Mar 26, 2024
8d7f67d
Merge branch 'develop' of https://github.com/Kernel360/f1-Yigil into …
ShineCorine Mar 26, 2024
9ae89aa
Merge pull request #649 from Kernel360/fix-spot/course-detail
ollehkt Mar 26, 2024
66e2965
Merge pull request #644 from Kernel360/fix-place-detail
ollehkt Mar 26, 2024
6222d3f
fix bug for demo batch
stoneHee99 Mar 26, 2024
a5f0e86
Merge branch 'develop' of https://github.com/Kernel360/f1-Yigil into …
stoneHee99 Mar 26, 2024
1e661b7
Merge pull request #646 from Kernel360/635-place-in-course
minson96 Mar 26, 2024
941f102
push yml
stoneHee99 Mar 26, 2024
f27bf17
Merge pull request #648 from Kernel360/647-어드민-모듈의-통계-메뉴-추가
minson96 Mar 26, 2024
5d2af4e
Merge pull request #651 from Kernel360/650-demographic-배치-job이-중복-데이터…
minson96 Mar 26, 2024
ee28396
장소 내 스팟 코스에 사용자가 작성자를 팔로잉했는지 여부 추가
ShineCorine Mar 26, 2024
6b2d688
20240226 refactoring merge conflict resolve
ShineCorine Mar 26, 2024
198297f
fix error with test
stoneHee99 Mar 26, 2024
bc62a78
Merge pull request #652 from Kernel360/650-demographic-배치-job이-중복-데이터…
minson96 Mar 26, 2024
d49575c
Merge branch 'develop' of https://github.com/Kernel360/f1-Yigil into …
ShineCorine Mar 26, 2024
c9a84ef
관련 api 문서 업데이트
ShineCorine Mar 26, 2024
aa77396
Merge pull request #653 from Kernel360/635-place-in-course
stoneHee99 Mar 26, 2024
8c9941b
Update application.yml
minson96 Mar 26, 2024
1dc8276
fix 장소 내 spot 정보 중 image urls가 매핑이 되지 않는 문제 해결
ShineCorine Mar 26, 2024
eed1961
Merge branch 'develop' of https://github.com/Kernel360/f1-Yigil into …
ShineCorine Mar 26, 2024
04ea185
문서 업데이트
ShineCorine Mar 26, 2024
de19662
Merge pull request #654 from Kernel360/635-place-in-course
minson96 Mar 26, 2024
e6da9c8
add api for check my place ids
stoneHee99 Mar 26, 2024
01b2513
Merge branch 'develop' of https://github.com/Kernel360/f1-Yigil into …
stoneHee99 Mar 26, 2024
087419c
Merge pull request #657 from Kernel360/656-사용자의-place-id를-조회하는-api-생성
ShineCorine Mar 26, 2024
2511020
notification에 sender 정보 포함하기
ShineCorine Mar 26, 2024
d00327c
Merge branch 'develop' of https://github.com/Kernel360/f1-Yigil into …
ShineCorine Mar 26, 2024
e373b66
api 문서 업데이트
ShineCorine Mar 26, 2024
615b8f3
chore: naver 이미지 next 설정 추가
ollehkt Mar 26, 2024
37296ca
add validate when new member request signup
stoneHee99 Mar 26, 2024
6701515
Merge pull request #658 from Kernel360/635-place-in-course
minson96 Mar 26, 2024
2ad22eb
Merge pull request #663 from davidktlee/feat-naver-login
ollehkt Mar 26, 2024
4c0983f
Merge pull request #661 from Kernel360/660-회원가입-시-validation-로직-추가
minson96 Mar 26, 2024
9b94a83
Merge pull request #664 from Kernel360/feat-naver-map
minson96 Mar 26, 2024
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[이길 로그](https://yigil.co.kr)

## 주요 기능

### 별점 기능
redis 캐싱을 활용하여 사용자들이 빠르게 볼 수 있도록 구현되어있다. 추후에 batch를 통해 실시간이 아닌
주기적인 갱신을 진행하려고 합니다. 혹시 여기서 비효율적이거나 더 나은 방법이 있는지 궁금합니다.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package kr.co.yigil.batch.job;

import jakarta.persistence.EntityManagerFactory;
import kr.co.yigil.favor.domain.DailyTotalFavorCount;
import kr.co.yigil.favor.infrastructure.DailyTotalFavorCountRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.job.builder.JobBuilder;
import org.springframework.batch.core.launch.support.RunIdIncrementer;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.step.builder.StepBuilder;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.data.builder.RepositoryItemWriterBuilder;
import org.springframework.batch.item.database.JpaPagingItemReader;
import org.springframework.batch.item.database.builder.JpaPagingItemReaderBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.PlatformTransactionManager;

import java.time.LocalDate;
import java.util.HashMap;

@Configuration
@RequiredArgsConstructor
public class DailyTotalFavorCountJobConfig {
private final EntityManagerFactory em;
private final DailyTotalFavorCountRepository dailyTotalFavorCountRepository;

@Bean
public Job totalCountJob(
JobRepository jobRepository,
Step calculateTotalCountStep
) {
return new JobBuilder("DailyTotalCountJob", jobRepository)
.start(calculateTotalCountStep)
.incrementer(new RunIdIncrementer())
.build();
}

@Bean
public Step calculateTotalCountStep(
JobRepository jobRepository,
PlatformTransactionManager platformTransactionManager,
ItemReader<Object[]> totalCountItemReader,
ItemProcessor<Object[], DailyTotalFavorCount> totalFavorCountItemProcessor,
ItemWriter<DailyTotalFavorCount> dailyTotalFavorCountItemWriter
) {
return new StepBuilder("calculateTotalCountStep", jobRepository)
.<Object[], DailyTotalFavorCount>chunk(30, platformTransactionManager)
.reader(totalCountItemReader)
.processor(totalFavorCountItemProcessor)
.writer(dailyTotalFavorCountItemWriter)
.build();
}

@Bean
public JpaPagingItemReader<Object[]> totalCountItemReader() {
LocalDate yesterday = LocalDate.now().minusDays(1);
LocalDate today = LocalDate.now();

HashMap<String, Object> parameters = new HashMap<>();
parameters.put("yesterday", yesterday);
parameters.put("today", today);

return new JpaPagingItemReaderBuilder<Object[]>()
.queryString("SELECT count(f.id), f.createdAt FROM DailyFavorCount f WHERE f.createdAt >= :yesterday AND f.createdAt < :today GROUP BY f.createdAt")
.entityManagerFactory(em)
.name("totalCountItemReader")
.parameterValues(parameters)
.pageSize(100)
.build();
}

@Bean
public ItemProcessor<Object[], DailyTotalFavorCount> totalFavorCountItemProcessor() {
return item ->{
Long count = (Long) item[0];
LocalDate createdAt = (LocalDate) item[1];
return new DailyTotalFavorCount(count, createdAt);
};
}

@Bean
public ItemWriter<DailyTotalFavorCount> dailyTotalFavorCountItemWriter() {
return new RepositoryItemWriterBuilder<DailyTotalFavorCount>()
.repository(dailyTotalFavorCountRepository)
.methodName("save")
.build();
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package kr.co.yigil.batch.job;

import java.time.LocalDateTime;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import kr.co.yigil.member.Ages;
import kr.co.yigil.member.Gender;
import kr.co.yigil.place.domain.DemographicPlace;
Expand Down Expand Up @@ -34,6 +36,7 @@ public class DemographicPlaceJobConfig {

private final SpotRepository spotRepository;
private final DemographicPlaceRepository demographicPlaceRepository;
private final Set<String> processedCombination = new HashSet<>();

@Bean
public Job demographicPlaceJob(
Expand Down Expand Up @@ -96,6 +99,11 @@ public ItemProcessor<Object[], DemographicPlace> demographicPlaceItemProcessor()
long referenceCount = (long) item[1];
Ages ages = (Ages) item[2];
Gender gender = (Gender) item[3];

String uniqueKey = place.getId() + "-" + ages.toString() + "-" + gender.toString();
if (!processedCombination.add(uniqueKey)) {
return null;
}
return new DemographicPlace(place, referenceCount, ages, gender);
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
spring:
batch:
job:
enabled: true
enabled: false
jpa:
database: postgresql
database-platform: org.hibernate.spatial.dialect.postgis.PostgisPG95Dialect
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package kr.co.yigil.favor.domain;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalDate;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class DailyTotalFavorCount {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

private Long count;

private LocalDate date;

public DailyTotalFavorCount(Long count, LocalDate date) {
this.count = count;
this.date = date;
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package kr.co.yigil.favor.infrastructure;

import kr.co.yigil.favor.domain.DailyFavorCount;
import kr.co.yigil.travel.TravelType;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.time.LocalDate;

public interface DailyFavorCountRepository extends JpaRepository<DailyFavorCount, Long>, DailyFavorCountRepositoryCustom {
@Query("SELECT d FROM DailyFavorCount d WHERE d.createdAt BETWEEN :startDate AND :endDate AND (d.travelType = :travelType OR :travelType = 'ALL') ORDER BY d.count DESC")
Page<DailyFavorCount> findAllByCreatedAtBetweenAndTravelTypeOrAllOrderByCountDesc(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate, @Param("travelType") TravelType travelType, Pageable pageable);

@Query("SELECT d.createdAt, SUM(d.count) FROM DailyFavorCount d GROUP BY d.createdAt")
Page<Object[]> findTotalLikesPerDay(Pageable pageable);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
import java.util.List;

public interface DailyFavorCountRepositoryCustom {
List<DailyFavorCount> findTopByTravelTypeOrderByCountDesc(LocalDate startDate, LocalDate endDate, TravelType travelType, Integer limit);
List<DailyFavorCount> findTopByTravelTypeOrderByCountDesc(LocalDate startDate, LocalDate endDate);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,21 @@ public class DailyFavorCountRepositoryCustomImpl implements DailyFavorCountRepos
private final JPAQueryFactory queryFactory;

@Override
public List<DailyFavorCount> findTopByTravelTypeOrderByCountDesc(LocalDate startDate, LocalDate endDate, TravelType travelType, Integer limit){
public List<DailyFavorCount> findTopByTravelTypeOrderByCountDesc(LocalDate startDate, LocalDate endDate){
QDailyFavorCount dailyFavorCount = QDailyFavorCount.dailyFavorCount;

BooleanExpression expression;
if (travelType == TravelType.ALL) {
expression = dailyFavorCount.travelType.eq(TravelType.SPOT)
.or(dailyFavorCount.travelType.eq(TravelType.COURSE));
} else {
expression = dailyFavorCount.travelType.eq(travelType);
}
expression = dailyFavorCount.travelType.eq(TravelType.SPOT)
.or(dailyFavorCount.travelType.eq(TravelType.COURSE));


BooleanExpression dateExpression = dailyFavorCount.createdAt.between(startDate, endDate);

if(limit == null){
limit = 10;
}

return queryFactory.selectFrom(dailyFavorCount)
.where(expression.and(dateExpression))
.orderBy(dailyFavorCount.count.desc())
.limit(limit)
.limit(5)
.fetch();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package kr.co.yigil.favor.infrastructure;

import java.time.LocalDate;
import java.util.List;
import kr.co.yigil.favor.domain.DailyTotalFavorCount;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface DailyTotalFavorCountRepository extends JpaRepository<DailyTotalFavorCount, Long>{
@Query("SELECT new kr.co.yigil.favor.domain.DailyTotalFavorCount(dtf.count, dtf.date) FROM DailyTotalFavorCount dtf WHERE dtf.date >= :startDate AND dtf.date <= :endDate")
List<DailyTotalFavorCount> findBetweenDates(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package kr.co.yigil.favor.domain.repository;
package kr.co.yigil.favor.infrastructure;

import java.util.Optional;
import kr.co.yigil.favor.domain.Favor;
import kr.co.yigil.member.Member;
import kr.co.yigil.travel.domain.Travel;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Optional;

public interface FavorRepository extends JpaRepository<Favor, Long> {
int countByTravelId(Long travelId);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package kr.co.yigil.follow.domain;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import java.util.Objects;
import jakarta.persistence.*;
import kr.co.yigil.member.Member;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.CreatedDate;

import java.time.LocalDateTime;
import java.util.Objects;

@Entity
@Getter
Expand All @@ -28,6 +26,9 @@ public class Follow {
@JoinColumn(name = "following_id")
private Member following;

@CreatedDate
private LocalDateTime createdAt;

public Follow(final Member follower, final Member following) {
this.follower = follower;
this.following = following;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
public enum SortBy {
CREATED_AT("createdAt"),
RATE("rate"),
TITLE("title"),
ID("id"),
PLACE_NAME("place.name"),
NAME("name"),
LATEST_UPLOADED_TIME("latestUploadedTime");

private String value;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package kr.co.yigil.member;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
Expand All @@ -19,6 +20,7 @@
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import kr.co.yigil.file.AttachFile;
import kr.co.yigil.region.domain.MemberRegion;
import kr.co.yigil.region.domain.Region;
Expand Down Expand Up @@ -71,6 +73,7 @@ public class Member {
private Ages ages = Ages.NONE;

@OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.PERSIST, orphanRemoval = true)
@JsonIgnore
private final List<MemberRegion> favoriteRegions = new ArrayList<>();

@JsonSerialize(using = LocalDateTimeSerializer.class)
Expand Down Expand Up @@ -163,7 +166,7 @@ public void updateMemberInfo(final String nickname, final String age, final Stri
public List<Long> getFavoriteRegionIds() {
return favoriteRegions.stream().map(
memberRegion -> memberRegion.getRegion().getId()
).toList();
).collect(Collectors.toList());
}

public boolean isFavoriteRegion(Region region) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ public interface MemberRepository extends JpaRepository <Member, Long> {
void unbanMemberById(@Param("memberId") Long memberId);

boolean existsByNickname(String nickname);

boolean existsByEmail(String email);
}
Loading
Loading