Skip to content

Commit

Permalink
Merge branch 'develop' into feature/#32
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbbin authored Jul 9, 2024
2 parents c0adfa1 + e5571a8 commit 3da197e
Show file tree
Hide file tree
Showing 19 changed files with 275 additions and 21 deletions.
154 changes: 152 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,152 @@
# Recordy-Server
레코디레코디 잉잉
![image](https://github.com/Team-Recordy/Recordy-Server/assets/94737768/34b93fd0-0dc3-4838-8c58-34c5ef72419e)


## 🌊 유영
<span style="color:#ADD8E6">**유저가 ‘공간’을 ‘영상’으로 디깅하고, 나만의 ‘공간 취향’을 발견하는 서비스**</span>

## 🔢 목차
[프로젝트 설명](#프로젝트-설명) </br>
[팀원](#팀원) </br>
[Git Flow](#Git-Flow) </br>
[ERD](#ERD) </br>
[폴더링](#폴더링) </br>
[레코디 컨벤션 및 API docs](#레코디-컨벤션-및-API-docs) </br>
[폴더링](#폴더링) </br>

## 🅿️ 프로젝트 설명

### 🪼 우리가 해결하고자 하는 문제
**- 취향에 맞는 공간 정보를 받을 수 있는 플랫폼의 분산**</br>
**- 공간감을 느낄 수 없는 가공된 사진**</br>
**- 기존 플랫폼의 영상 알고리즘으로 내 취향에 맞지 않는 공간 노출**

### 📔 해결책
**- 내 취향에 맞는 공간을 영상을 통해 향유할 수 있는 서비스가 필요**

### 🙋‍♀️ 타겟
**-공간을 좋아하는 1020 유저. 자신의 취향이 뚜렷한 유저**

### 🧩 우리의 서비스
**-유저가 ‘공간’을 ‘영상’으로 디깅하고, 나만의 ‘공간 취향’을 발견하는 서비스**

### 🔑 핵심 키워드
### '취향' '공간' '영상'

### 🏅 기능 우선순위 3가지 (MVP에서 가져갈 기능)
**- 영상 업로드** </br>
**- 취향 키워드칩 선택** </br>
**- 타 유저 영상 시청 후 북마크**
</br>
![image]()


## 👤 팀원
|<img src="https://github.com/Team-Recordy/Recordy-Server/assets/94737768/76b261b4-bc99-49ef-b221-abd32126db78" width="200" /> |<img src="https://github.com/Team-Recordy/Recordy-Server/assets/94737768/b38469c6-9239-4972-b821-ca5263f889be" width="200" /> |<img src="https://github.com/Team-Recordy/Recordy-Server/assets/94737768/e334819f-fbd4-4786-a7de-495603d0cfe7" width="200" />|
|:---------:|:---------:|:---------:|
|[나세빈](https://github.com/sebbbin)|[박수빈](https://github.com/elive7)|[진건우](https://github.com/jinkonu)|
| `나세빈` | `박수빈` | `👑 진건우` |
</br>

|기능명|담당자|
|:---------:|:---------:|
| 프로젝트 기초 세팅 | 세빈, 수빈 건우 |
| EC2 세팅, RDS 세팅 | 세빈, 수빈 건우 |
| API 작업 | 세빈, 수빈 건우 |

</br>


## 🐬 Git Flow
<img width="757" alt="image" src="https://github.com/Team-Recordy/Recordy-Server/assets/94737768/d70f51f0-cc0f-4208-91d9-6aed63ef8ab9">

| 브랜치 명 | 설명 |
| :-------: | :--------------------------------------------------------------------------------- |
| main | 소프트웨어 제품 배포하는 용도로 쓰는 브랜치 |
| develop | 개발용 default 브랜치로, 이 브랜치를 기준으로 feature 브랜치를 따고, 합치는 브랜치 |
| feat | 단위 기능 개발용 브랜치 |
| fix | 단위 기능 개발 수정용 브랜치 |
| hotfix | master에 배포 코드가 합쳐진 후 버그 발생 시 긴급 수정하는 브랜치 |

### **📌 Branch**

- 깃플로우에 따라 기능별로 브랜치 생성
- 형식: `브랜치 명/#이슈번호`
</br>

## 🛠️ Architecture
<img width="747" alt="스크린샷 2024-07-08 오후 7 36 22" src="https://github.com/Team-Recordy/Recordy-Server/assets/94737768/c37583a4-ca8d-4f66-aa99-eb5dc3cf961b">

## 🌱 ERD
<img width="1006" alt="스크린샷 2024-07-03 오후 5 28 07" src="https://github.com/Team-Recordy/Recordy-Server/assets/94737768/c1c53d3b-7774-4fce-89a3-98d1ac558926">


## ❗ 레코디 컨벤션 및 API docs
**레코디 컨벤션 및 협업 규칙:** [Git Convention](https://bohyunnkim.notion.site/0c9e0fe52b204329a7a927e05c125c16?pvs=4) </br>
**API docs:** [API docs](https://www.notion.so/bohyunnkim/API-Docs-365270d3fb184ac0b3599dc28be5337d) </br>

## 🗂️ 폴더링
```
.
├── build
│   ├── classes
│   │   └── java
│   │   ├── main
│   │   │   └── org
│   │   │   └── recordy
│   │   │   └── server
│   │   │   ├── 📁 auth
│   │   │   │   ├── domain
│   │   │   │   ├── exception
│   │   │   │   ├── repository
│   │   │   │   │   └── impl
│   │   │   │   ├── security
│   │   │   │   │   └── handler
│   │   │   │   └── service
│   │   │   │   ├── dto
│   │   │   │   └── impl
│   │   │   │   ├── apple
│   │   │   │   ├── kakao
│   │   │   │   └── token
│   │   │   ├── 📁 common
│   │   │   │   ├── config
│   │   │   │   ├── domain
│   │   │   │   ├── dto
│   │   │   │   │   └── response
│   │   │   │   ├── exception
│   │   │   │   ├── handler
│   │   │   │   ├── message
│   │   │   │   └── util
│   │   │   ├── 📁 external
│   │   │   ├── 📁 keyword
│   │   │   ├── 📁 record
│   │   │   ├── 📁 record_stat
│   │   │   └── 📁 user
│   │   │   ├── controller
│   │   │   │   └── dto
│   │   │   │   ├── request
│   │   │   │   └── response
│   │   │   ├── domain
│   │   │   │   └── usecase
│   │   │   ├── exception
│   │   │   ├── repository
│   │   │   │   └── impl
│   │   │   └── service
│   │   │   └── impl
│   │   └── test
│   │   └── org
│   │   └── recordy
│   │   └── server
│   │   ├── 📁 auth
│   │   ├── 📁 common
│   │   ├── 📁 external
│   │   ├── 📁 keyword
│   │   ├── 📁 mock
│   │   │   ├── auth
│   │   │   ├── keyword
│   │   │   ├── record
│   │   │   └── user
│   │   ├── 📁 record
│   │   ├── 📁 user
│   │   └── 📁 util
```
</br>
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ public String issueAccessToken(long userId) {
private String removePrefix(String value) {
return Optional.ofNullable(value)
.filter(t -> t.startsWith(tokenPrefix))
.map(t -> t.substring(tokenPrefix.length() + 1))
.map(t -> t.substring(tokenPrefix.length()))
.map(String::trim)
.orElseThrow(() -> new AuthException(ErrorMessage.INVALID_TOKEN));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ public FileUrl save(File file) {
} catch (IOException e) {
throw new RecordException(ErrorMessage.FAILED_TO_UPLOAD_TO_S3);
}

return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public Record create(RecordCreate recordCreate, File file) {
.location(recordCreate.location())
.content(recordCreate.content())
.uploader(user)
.keywords(recordCreate.keywords())
.build());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public ResponseEntity<Void> delete(
userService.delete(userId);

return ResponseEntity
.status(HttpStatus.OK)
.noContent()
.build();
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/recordy/server/user/domain/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private void validateNicknameFormat(String nickname) {
}

private void validateTermsAgreed(TermsAgreement termsAgreement) {
if (termsAgreement.ageTerm() && termsAgreement.useTerm() && termsAgreement.personalInfoTerm()) {
if (!termsAgreement.ageTerm() || !termsAgreement.useTerm() || !termsAgreement.personalInfoTerm()) {
throw new UserException(ErrorMessage.INVALID_REQUEST_TERM);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,20 +180,23 @@ void init() {
authRepository.save(new Auth(authPlatform, authToken, true));

//when
String platformId = authTokenService.getPlatformIdFromRefreshToken(authToken.getRefreshToken());
String refreshToken = "Bearer " + authToken.getRefreshToken();
String platformId = authTokenService.getPlatformIdFromRefreshToken(refreshToken);

//then
assertThat(platformId).isEqualTo(authPlatform.getId());

}

// TODO : fix
@Test
void 주어진_refreshToken으로부터_platformId_반환하지_못하면_에러를_던진다() {
//given
AuthToken authToken = authTokenService.issueToken(DomainFixture.USER_ID);

// when, then
assertThatThrownBy(() -> authTokenService.getPlatformIdFromRefreshToken(authToken.getRefreshToken()))
String refreshToken = "Bearer " + authToken.getRefreshToken();
assertThatThrownBy(() -> authTokenService.getPlatformIdFromRefreshToken(refreshToken))
.isInstanceOf(AuthException.class)
.hasMessageContaining(ErrorMessage.AUTH_NOT_FOUND.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.junit.jupiter.api.Test;
import org.recordy.server.keyword.domain.Keyword;
import org.recordy.server.util.DomainFixture;
import org.recordy.server.util.db.IntegrationTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.jdbc.Sql;
Expand All @@ -18,7 +19,7 @@
@Sql(value = "/sql/keyword-repository-test-clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
})
@SpringBootTest
class KeywordRepositoryIntegrationTest {
class KeywordRepositoryIntegrationTest extends IntegrationTest {

@Autowired
private KeywordRepository keywordRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public Record save(Record record) {
.fileUrl(record.getFileUrl())
.location(record.getLocation())
.content(record.getContent())
.keywords(record.getKeywords())
.uploader(record.getUploader())
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public User save(User user) {
.authPlatform(user.getAuthPlatform())
.status(user.getStatus())
.nickname(user.getNickname())
.termsAgreement(user.getTermsAgreement())
.build();

users.put(autoIncrementId++, realUser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.recordy.server.record.domain.UploadEntity;
import org.recordy.server.record.repository.impl.UploadJpaRepository;
import org.recordy.server.util.DomainFixture;
import org.recordy.server.util.db.IntegrationTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.PageRequest;
Expand All @@ -27,7 +28,7 @@
})
@Transactional
@SpringBootTest
class RecordRepositoryIntegrationTest {
class RecordRepositoryIntegrationTest extends IntegrationTest {

@Autowired
private RecordRepository recordRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void init() {
void reissueToken_통해_accessToken_재발급_받을__있다() {
//given
Auth auth = userService.signIn(DomainFixture.createUserSignIn(AuthPlatform.Type.KAKAO));
String refreshToken = auth.getToken().getRefreshToken();
String refreshToken = "Bearer " + auth.getToken().getRefreshToken();


//when
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.recordy.server.user.repository;

import org.junit.jupiter.api.Test;
import org.recordy.server.user.controller.dto.request.TermsAgreement;
import org.recordy.server.user.domain.UserStatus;
import org.recordy.server.util.DomainFixture;
import org.recordy.server.user.domain.User;
import org.recordy.server.util.db.IntegrationTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.jdbc.Sql;
Expand All @@ -13,22 +15,28 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.fail;
import static org.recordy.server.util.DomainFixture.*;

@SqlGroup({
@Sql(value = "/sql/user-repository-test-data.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD),
@Sql(value = "/sql/user-repository-test-clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
})
@SpringBootTest
class UserRepositoryIntegrationTest {
class UserRepositoryIntegrationTest extends IntegrationTest {

@Autowired
private UserRepository userRepository;

@Test
void save_통해_유저_데이터를_저장할__있다() {
// given
User user = DomainFixture.createUser(UserStatus.PENDING);
User user = User.builder()
.id(USER_ID + 1)
.authPlatform(createAuthPlatform())
.status(UserStatus.PENDING)
.nickname(USER_NICKNAME)
.termsAgreement(TermsAgreement.of(USE_TERM_AGREEMENT, PERSONAL_INFO_TERM_AGREEMENT, AGE_TERM_AGREEMENT))
.build();

// when
User result = userRepository.save(user);
Expand Down Expand Up @@ -82,9 +90,10 @@ class UserRepositoryIntegrationTest {
void existsByNickname_통해_닉네임이_존재하는_경우_true_반환한다() {
// given
userRepository.save(User.builder()
.id(DomainFixture.USER_ID + 1)
.id(USER_ID + 1)
.nickname(DomainFixture.USER_NICKNAME)
.authPlatform(DomainFixture.createAuthPlatform())
.termsAgreement(TermsAgreement.of(true, true, true))
.build());

// when
Expand All @@ -106,11 +115,11 @@ class UserRepositoryIntegrationTest {
@Test
void findById_통해_유저_ID_유저_데이터를_조회할__있다() {
// when
User result = userRepository.findById(DomainFixture.USER_ID).orElse(null);
User result = userRepository.findById(USER_ID).orElse(null);

// then
assertAll(
() -> assertThat(result.getId()).isEqualTo(DomainFixture.USER_ID),
() -> assertThat(result.getId()).isEqualTo(USER_ID),
() -> assertThat(result.getAuthPlatform().getId()).isEqualTo(DomainFixture.PLATFORM_ID),
() -> assertThat(result.getAuthPlatform().getType()).isEqualTo(DomainFixture.KAKAO_PLATFORM_TYPE),
() -> assertThat(result.getStatus()).isEqualTo(DomainFixture.DEFAULT_USER_STATUS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ void init() {
Auth auth = userService.signIn(userSignIn);

//when
String accessToken = userService.reissueToken(auth.getToken().getRefreshToken());
String refreshToken = "Bearer " + auth.getToken().getRefreshToken();
String accessToken = userService.reissueToken(refreshToken);

//then
assertThat(accessToken).isNotEmpty();
Expand Down
Loading

0 comments on commit 3da197e

Please sign in to comment.