Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…step3/Team7_BE into docs/#185-readme
  • Loading branch information
suhyeon7497 committed Nov 14, 2024
2 parents c8567fa + b6fa60a commit 3421691
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 69 deletions.
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@

## 목차

> 1. [**_프로젝트 목적_**](#project-purpose)
> 2. [**_서비스 정보_**](#service-info)
> 3. [**_주요 기능_**](#main-function)
> 4. [**_프로그램 구조_**](#program-architecture)
> 5. [**_배포 주소_**](#deployment-link)
> 6. [**_API and ERD_**](#api-and-erd)
> 7. [**_Contributor_**](#contributor)
> 8. [**_Repository Info_**](#repository-info)
> 9. [**_개발 기간_**](#development-term)
> 10. [**_Dependency 버전_**](#main-dependency-version)
> 11. [**_Tech Stack_**](#tech-stack)
> 12. [**_기능 흐름_**](#function-flow)
> 13. [**_Example Usage_**](#example-usage)
## Project Purpose
> 1. [**_프로젝트 목적_**](#프로젝트-목적)
> 2. [**_서비스 정보_**](#서비스-정보)
> 3. [**_주요 기능_**](#주요-기능)
> 4. [**_프로그램 구조_**](#프로그램-구조)
> 5. [**_배포 주소_**](#배포-주소)
> 6. [**_API and ERD_**](#API-and-ERD)
> 7. [**_기여_**](#기여)
> 8. [**_저장소 주소_**](#저장소-주소)
> 9. [**_개발 기간_**](#개발-기간)
> 10. [**_Dependency 버전_**](#Dependency-버전)
> 11. [**_Tech Stack_**](#Tech-stack)
> 12. [**_기능 흐름_**](#기능-흐름)
> 13. [**_사용 예시_**](#사용-예시)
## 프로젝트 목적

> 저희의 아이디어는 **데이트 코스의 단조로움**을 어떻게 하면 해소할 수 있을까? 라는 생각에서 시작했습니다.
>
Expand All @@ -32,7 +32,7 @@
> 이를 관심있는 **인플루언서를 등록하고, 이에 따른 장소 추천 및, 장소에 대한 리뷰 기능**을 통해 풀어내어 **Inplace** 라는 저희만의 웹 애플리케이션으로
> 구현해보았습니다.
## Service Info
## 서비스 정보

> 긴 영상은 필요 없어요 인플루언서가 다녀간 쿨플, 한눈에 쏙!
Expand All @@ -52,7 +52,7 @@
- 정보 받은 후 3일 뒤 리뷰 페이지 전송 ( 카카오톡 나에게 메세지 보내기 )
- 리뷰 확인 및 수정 가능

## Main Function
## 주요 기능

> Inplace의 주요 기능
Expand Down Expand Up @@ -82,9 +82,9 @@
- 내가 작성한 리뷰를 관리할 수 있습니다
- 사용자 닉네임을 변경할 수 있습니다

## Program Architecture
## 프로그램 구조

## Deployment Link
## 배포 주소

> [**BackEnd**](https://api.inplace.my) : _api.inplace.my_
>
Expand All @@ -102,7 +102,7 @@ _https://www.notion.so/API-9e96d1ef1475414b861a50d0e4ca366e_
> [**ERD**](https://www.notion.so/ERD-36ec8e40cb264abe87588e97ae77ac55) :
> https://www.notion.so/ERD-36ec8e40cb264abe87588e97ae77ac55
## Contributor
## 기여

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<table>
Expand Down Expand Up @@ -161,7 +161,7 @@ _https://www.notion.so/API-9e96d1ef1475414b861a50d0e4ca366e_
</table>
<!-- ALL-CONTRIBUTORS-LIST:END -->

## Repository Info
## 저장소 주소

> **Using Language**
>
Expand All @@ -187,17 +187,17 @@ _https://www.notion.so/API-9e96d1ef1475414b861a50d0e4ca366e_
![GitHub pull requests](https://img.shields.io/github/issues-pr/kakao-tech-campus-2nd-step3/Team7_BE?label=open%20pull%20requests)
![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/kakao-tech-campus-2nd-step3/Team7_BE?label=closed%20pull%20requests)

## Development Term
## 개발 기간

> 2024.08.22 ~ 2024.11.15
## Main Dependency Version
## Dependency 버전

> **Spring Boots 3.3.3**
>
> **Java 17 LTS**
## Tech Stack
## Tech stack

> **Backend**
>
Expand Down Expand Up @@ -248,7 +248,7 @@ _https://www.notion.so/API-9e96d1ef1475414b861a50d0e4ca366e_
![Discord](https://img.shields.io/badge/Discord-5865F2?style=flat-square&logo=discord&logoColor=white)
![Slack](https://img.shields.io/badge/Slack-4A154B?style=flat-square&logo=slack&logoColor=white)

## Function Flow
## 기능 흐름

- ### Spring Security
- oauth 로그인 시, jwt로 accessToken과 refreshToken을 Cookie에 담아줍니다.
Expand All @@ -260,6 +260,6 @@ _https://www.notion.so/API-9e96d1ef1475414b861a50d0e4ca366e_
- ### TokenRefresh
- Redis DB에 username(key)로 refreshToken을 확인하고, RTR (Refresh Token Rotation)을 합니다.

## Example Usage
## 사용 예시

> 나중에 시연 영상 첨부하기
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
package team7.inplace.review.application.dto;

import java.util.Date;
import team7.inplace.place.application.dto.PlaceInfo.AddressInfo;
import team7.inplace.place.domain.Place;
import team7.inplace.review.domain.Review;

import java.util.Date;


public record MyReviewInfo(
Long reviewId,
boolean likes,
String comment,
Date createdDate,
ReviewPlaceInfo placeInfo
Long reviewId,
boolean likes,
String comment,
Date createdDate,
ReviewPlaceInfo placeInfo
) {

public record ReviewPlaceInfo(
Long placeId,
String imgUrl,
AddressInfo address
Long placeId,
String placeName,
String imgUrl,
AddressInfo address
) {

public static ReviewPlaceInfo from(Place place) {
return new ReviewPlaceInfo(
place.getId(),
place.getMenuImgUrl(),
AddressInfo.of(place.getAddress())
place.getId(),
place.getName(),
place.getMenuImgUrl(),
AddressInfo.of(place.getAddress())
);
}
}

public static MyReviewInfo from(Review review) {
return new MyReviewInfo(
review.getId(),
review.isLiked(),
review.getComment(),
review.getCreatedDate(),
ReviewPlaceInfo.from(review.getPlace())
review.getId(),
review.isLiked(),
review.getComment(),
review.getCreatedDate(),
ReviewPlaceInfo.from(review.getPlace())
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
import team7.inplace.influencer.application.dto.InfluencerInfo;

public record LikedInfluencerResponse(
Long influencerId,
String InfluencerName,
String InfluencerImgUrl,
String influencerJob,
boolean likes
Long influencerId,
String influencerName,
String influencerImgUrl,
String influencerJob,
boolean likes
) {

public static LikedInfluencerResponse from(InfluencerInfo influencerInfo) {
return new LikedInfluencerResponse(
influencerInfo.influencerId(),
influencerInfo.influencerName(),
influencerInfo.influencerImgUrl(),
influencerInfo.influencerJob(),
influencerInfo.likes()
influencerInfo.influencerId(),
influencerInfo.influencerName(),
influencerInfo.influencerImgUrl(),
influencerInfo.influencerJob(),
influencerInfo.likes()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import team7.inplace.global.exception.InplaceException;
import team7.inplace.global.exception.code.AuthorizationErrorCode;
import team7.inplace.global.exception.code.PlaceErrorCode;
import team7.inplace.global.exception.code.VideoErrorCode;
import team7.inplace.influencer.persistence.InfluencerRepository;
import team7.inplace.place.application.dto.PlaceForVideo;
import team7.inplace.place.domain.Place;
import team7.inplace.place.persistence.PlaceRepository;
import team7.inplace.security.util.AuthorizationUtil;
import team7.inplace.video.application.command.VideoCommand;
import team7.inplace.video.application.command.VideoCommand.Create;
import team7.inplace.video.application.dto.VideoInfo;
Expand All @@ -35,6 +37,10 @@ public class VideoService {

@Transactional(readOnly = true)
public List<VideoInfo> getVideosBySurround(VideoSearchParams videoSearchParams) {
// 토큰 정보에 대한 검증
if (AuthorizationUtil.isNotLoginUser()) {
throw InplaceException.of(AuthorizationErrorCode.TOKEN_IS_EMPTY);
}
// Place 엔티티 조회
Page<Place> places = placeRepository.findPlacesByDistanceAndFilters(
videoSearchParams.topLeftLongitude(),
Expand Down
15 changes: 10 additions & 5 deletions src/main/java/team7/inplace/video/domain/Video.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package team7.inplace.video.domain;

import jakarta.persistence.*;
import static jakarta.persistence.GenerationType.IDENTITY;
import static lombok.AccessLevel.PROTECTED;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import lombok.Getter;
import lombok.NoArgsConstructor;
import team7.inplace.influencer.domain.Influencer;
import team7.inplace.place.domain.Place;

import static jakarta.persistence.GenerationType.IDENTITY;
import static lombok.AccessLevel.PROTECTED;

@Entity
@Getter
@NoArgsConstructor(access = PROTECTED)
Expand Down Expand Up @@ -54,7 +59,7 @@ public String getVideoUUID() {
public void updateViewCount(Long viewCount) {
if (this.viewCount == -1L) {
this.viewCount = viewCount;
this.viewCountIncrease = viewCount;
this.viewCountIncrease = 0L;
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public interface VideoRepository extends JpaRepository<Video, Long> {
@Query("SELECT v FROM Video v JOIN FETCH v.place JOIN FETCH v.influencer ORDER BY v.viewCountIncrease DESC")
List<Video> findTop10ByOrderByViewCountIncreaseDesc(Pageable pageable);

@Query("SELECT v FROM Video v JOIN FETCH v.place JOIN FETCH v.influencer WHERE v.influencer.id IN :influencerIds")
@Query("SELECT v FROM Video v JOIN FETCH v.place JOIN FETCH v.influencer WHERE v.influencer.id IN :influencerIds ORDER BY v.id DESC")
List<Video> findTop10ByInfluencerIdIn(List<Long> influencerIds, Pageable pageable);

@Query("SELECT v FROM Video v JOIN FETCH v.place JOIN FETCH v.influencer ORDER BY v.id DESC")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package team7.inplace.crawling.application;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import team7.inplace.admin.crawling.application.AddressUtil;

import static org.junit.jupiter.api.Assertions.assertEquals;

class AddressUtilTest {

@DisplayName("주소 추출 테스트 1")
Expand All @@ -16,7 +16,7 @@ void extractAddressFromJsonNodeTest1() {
[참조은 생고기]
대구 북구 복현로 78 (복현2동 266-9)
""";
final String address = "대구 북구 복현로 78";
final String address = "복현로 78";

// when
String result = AddressUtil.extractAddressFromString(description);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package team7.inplace.crawling.client;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import team7.inplace.admin.crawling.client.YoutubeClient;

import static org.assertj.core.api.Assertions.assertThat;

@SpringBootTest
@ActiveProfiles("test")
class YoutubeClientTest {
Expand All @@ -22,9 +22,9 @@ void crawlingTest() {
final String videoId = null;
var response = youtubeClient.getVideos(playlistId, videoId);

// 2024. 10. 2기준 154개
// 2024. 11. 15일기준 157개
// regex로 판별되는 기준 138개
final int expectedSize = 154;
final int expectedSize = 157;
assertThat(response.size())
.isEqualTo(expectedSize);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import team7.inplace.config.annotation.CustomRepositoryTest;
import team7.inplace.place.domain.Place;
import team7.inplace.review.domain.Review;
Expand All @@ -20,7 +19,6 @@
import team7.inplace.user.domain.UserType;

@CustomRepositoryTest
@Transactional
class ReviewRepositoryTest {

@PersistenceContext
Expand Down

0 comments on commit 3421691

Please sign in to comment.