Skip to content

Commit

Permalink
Release/0.2.0 (#388)
Browse files Browse the repository at this point in the history
* refactor: package and code style (#305)

* fix: release token expire length (#314) (#315)

* hotfix (#319)

* fix: release token expire length (#314)

* 뒤로가기 시 필터와 페이지네이션 유지 (#308)

* feature: url path params for history

* feature: url path params for history

* refactor: filter 중복 함수 훅으로 변경

* fix: 필요하지 않은 props 삭제

* fix: makeFilters 에러처리 추가

* refactor: makeFilters 함수 리팩토링

Co-authored-by: dudtjr913 <64782636+dudtjr913@users.noreply.github.com>

Co-authored-by: dudtjr913 <64782636+dudtjr913@users.noreply.github.com>

* jpa의 n+1을 유발할 수 있는 코드를 리팩토링하고, post에 포함된 태그가 적절한 쿼리를 통해 조회할 수 있도록 수정한다 (#323)

* fix: n+1 개선 및 PostTag에 등록된 태그만 조회하도록 리팩토링

* fix: 울부짖는 메시지 및 리포맷 과정에서 잘못 import된 클래스 수정

* feature: 선택된 레벨의 미션만 노출하기 (#343)

* fix: PostPage에서 markdown 넘어가는 버그 수정 (#345)

* fix: release token expire length (#314)

* 뒤로가기 시 필터와 페이지네이션 유지 (#308)

* feature: url path params for history

* feature: url path params for history

* refactor: filter 중복 함수 훅으로 변경

* fix: 필요하지 않은 props 삭제

* fix: makeFilters 에러처리 추가

* refactor: makeFilters 함수 리팩토링

Co-authored-by: dudtjr913 <64782636+dudtjr913@users.noreply.github.com>

* fix: PostPage에서 markdown 넘어가는 버그 수정

Co-authored-by: 류성현 <brown@woowahan.com>
Co-authored-by: dudtjr913 <64782636+dudtjr913@users.noreply.github.com>

* 백엔드 로깅을 도입한다. (#346)

* refactor: 스터디그 패키지 구조 정리 (#344)

* refactor: 패키지 리팩토링 및 포스트를 스터디로그로 명명 변경

* refactor: api 복구 (studylogs -> posts)

* 검색 환경설정 사전 작업 > 환경 변수 리팩터링  (#348)

* refactor: environment

* refactor: test annotation

* refactor: resolving conflicts

* refactor: feedback

* fix: 글 추가 페이지에서 제목이 잘리는 버그 수정 (#351)

* 검색 기능을 위해 elasticsearch를 연동한다. (#329)

* chore: elasticsearch dependency 추가

* fix: release token expire length (#314)

* 뒤로가기 시 필터와 페이지네이션 유지 (#308)

* feature: url path params for history

* feature: url path params for history

* refactor: filter 중복 함수 훅으로 변경

* fix: 필요하지 않은 props 삭제

* fix: makeFilters 에러처리 추가

* refactor: makeFilters 함수 리팩토링

Co-authored-by: dudtjr913 <64782636+dudtjr913@users.noreply.github.com>

* feat: ElasticSearch 설정 추가

* feat: StudyLogDocument 및 Repository 생성

* test: StudyLogDocumentService 테스트 추가

* feat&test: Post CUD 작업 시 StudyLogDocument와 동기화되도록 기능 구현 및 테스트

* test: 검색 및 필터 기능 AcceptanceTest 추가

* chore: yml파일 elasticsearch 설정 옮기기

* refactor: TestFixture 분리

* test: 검색 테스트 케이스 추가

* feat: ServiceTest DatabaseCleaner 추가

* chore: develop 변경사항 반영

* chore: 코드 포맷팅

* feat: DataLoader Elasticsearch 옵션 추가 및 host/port yml 분리

* feat&test: postController#showAll DTO로 변경, postService#findPostsWithFilter early-return 추가

* feature: test-container 적용

* test: ElasticSearchTestConfig 추가 및 test 환경에 적용

* feat: application.yml#elasticsearch 옵션 추가

* feat: dev, prod용 DataLoaderApplicationLister 추가

* refactor: merge

* refactor: merge

* refactor

* refactor

* fix: table and column name

* fix: default application properties

* fix: data initializer

* fix: application properties

* feature: es sync api

Co-authored-by: 류성현 <brown@woowahan.com>
Co-authored-by: dudtjr913 <64782636+dudtjr913@users.noreply.github.com>

* fix: application properties

* fix: default page config

* feat: 내 글에서 수정/삭제 기능 추가 (#352)

* feat: 내 글에서 수정/삭제 기능 추가

* refactor: 수정/삭제 버튼 UI 변경

* feat: GNB 드롭다운 메뉴에 내 학습로그 보기 링크 추가 (#357)

* fix: release token expire length (#314)

* 뒤로가기 시 필터와 페이지네이션 유지 (#308)

* feature: url path params for history

* feature: url path params for history

* refactor: filter 중복 함수 훅으로 변경

* fix: 필요하지 않은 props 삭제

* fix: makeFilters 에러처리 추가

* refactor: makeFilters 함수 리팩토링

Co-authored-by: dudtjr913 <64782636+dudtjr913@users.noreply.github.com>

* feat: NavBar의 드롭다운 메뉴에 '내 학습로그' 링크 추가

* feat: 학습로그 페이지에서 GNB 영역의 드롭다운 메뉴를 이용해 홈으로 이동 시 좌측 메뉴 표시 변경 안되는 이슈 해결

* refactor: Route 방식 통일

Co-authored-by: 류성현 <brown@woowahan.com>
Co-authored-by: dudtjr913 <64782636+dudtjr913@users.noreply.github.com>

* chore: 코드 스타일 적용 (#362)

* chore: prologJavaStyle 적용

* chore: log 커밋에서 제거

* chore: 코드 스타일 추가 적용

* chore: 코드 스타일 추가 적용

* fix: 백엔드 로깅 (#353)

* fix: debug-logger appender 오타 수정

* refactor: prod, dev 프로필에서 사용되지 않는 appender include 제거

* fix: http access 로깅 파일 appender name 오타 수정 및 파일명 변경

* refactor: appender 파일명, appender 이름 통일

* refactor: prod, dev 프로필 console 로깅 제거

* 로컬 및 테스트환경에서 es를 띄우지 않고 가짜 데이터를 응답받도록 한다. (#361)

* feat: CustomStudyLogDocumentRepository 생성

* feat: FakeStudyLogDocumentRepository 검색 메서드 구현

* feat&test: CustomElasticSearchRepository 적용 및 테스트 확인

* etc: conflict 해결

* refactor

Co-authored-by: gracefulBrown <brown@woowahan.com>

* 마크다운 에디터 개선 (#359)

* feature: auto-links

* feature: auto-links for editors

* feature: github style

* feature: code highlight

* fix: tui-editor => toastui-editor로 변경

Co-authored-by: dudtjr913 <64782636+dudtjr913@users.noreply.github.com>

* elasticsearch와 mysql의 학습로그 정보를 동기화 한다. (#363)

* feat: CustomStudyLogDocumentRepository 생성

* feat: FakeStudyLogDocumentRepository 검색 메서드 구현

* feat&test: CustomElasticSearchRepository 적용 및 테스트 확인

* etc: conflict 해결

* refactor

* refactor: StudylogDocument 관련 파일을 Studylog로 옮기기

* feat: studylog 수정, 삭제 시 studylogDocument도 수정,삭제되는 기능 추가

* test: 수정, 삭제 관련 StudylogServiceTest 및 StudylogDocumentTest 추가

* refactor: StudylogDocument#index명을 studylog-document로 변경

* refactor: StudyLog -> Studylog로 통일

Co-authored-by: gracefulBrown <brown@woowahan.com>

* feat: 제목 및 내용 검색 기능 구현 (#368)

* feat: Chip Compnent 구현

* feat: FilterList 스타일 분리 및 필터 선택 시 전달 props에 name 추가

* feat: FlexBox 컴포넌트 구현

* feat: 필터링 시 선택된 필터를 메인 화면에 보여주는 UI 추가

* refactor: COLOR 상수화 적용

* feat: GNB 영역에 검색바 추가

* Merge branch 'develop' of https://github.com/woowacourse/prolog into feature/search-fe

* refactor: 사용하지 않는 주석 삭제

* feat: 검색기능추가

* refactor: 불필요한 주석 삭제

* fix: 새로 고침 시 쿼리가 분리되는 문제 해결

* fix: Nav에 검색바 추가

- merge 시 컨플릭트 해결 오류로 인한 재 삽입

* feat: 검색어가 없을 시 전체 글을 조회하는 기능 추가

- 검색어가 없을 때 어떻게 처리할 것인지에 대한 논의 필요함.

* refactor: DocumentLoaderApplicationListener 제거 및 DataLoader에서 sync 추가

* feat: 프로필 페이지의 내 학습로그 페이지에서 필터 유지 및 선택된 필터 외부 노출 기능 추가

Co-authored-by: gracefulBrown <brown@woowahan.com>
Co-authored-by: seovalue <seominjeong.dev@gmail.com>

* feat: 오버뷰 기능 구현 (#367)

* feat: 나의 태그 조회 기능 구현 및 문서화

* feat: 유저 태그 조회 기능 리팩토링 및 유저 달력 포스트 조회 기능 구현

* feat: myPagePost에 tagList 추가

* feat: Calendar 컴포넌트 추가

* feat: 멤버 프로필 포스트 조회시 필터링 옵션 추가(date, tagId)

* refactor: 선택된 tag 스타일 수정

* feat: 선택된 태그에 따른 필터 쿼리 생성 로직 구현

* refactor: 404 페이지 변경

* feat: Calendar Provider 추가 및 date 필터 기능 추가

* refactor: Calendar Provider 삭제

* fix: main merge 후 없어진 부분 돌림

* fix: 백엔드 코드 충돌 해결

* feat: 날짜 선택 시 focus 효과 추가

* refactor: key 추가 및 first-of-type 변경

* feat: 프로필 페이지에서 날짜 클릭 시 학습로그로 이동

* fix: ? => &로 수정

* refactor: 필터링 기능 함수로 변경 및 선택된 날짜 상태 추가

- useEffect의 의존성으로 인해 원치 않는 버그 발생

* fix: Calendar 월 변경 시 데이터 조회하도록 변경

* feat: 유저 태그 목록 및 캘린더 포스트 목록 조회 기능 구현 (#301)

* fix: release token expire length (#314)

* 뒤로가기 시 필터와 페이지네이션 유지 (#308)

* feature: url path params for history

* feature: url path params for history

* refactor: filter 중복 함수 훅으로 변경

* fix: 필요하지 않은 props 삭제

* fix: makeFilters 에러처리 추가

* refactor: makeFilters 함수 리팩토링

Co-authored-by: dudtjr913 <64782636+dudtjr913@users.noreply.github.com>

* feat: conflict 해결

* feat: merge 후 깨지는 테스트 수정 및 전체 태그 관련 추가

* feat: acceptance test 레벨 생성 추가

* refactor: 머지 후 에러 수정 및 스타일 변경

* refactor: Calendar 컴폰너트 배경 스타일 제거

* refactor: 필터링 레이아웃, 스타일 수정

* refactor: MainPage 내 카드 스타일 수정

* refactor: 캘린더, 태그 ProfilePage로 이동

* refactor: ProfilePageSideBar 컴포넌트  분리

* fix: 달력 2개월씩 넘어가는 버그 수정 및 ellipsis 적용

* fix: 오버뷰와 학습로그 페이지에서 글이 넘칠 때 ellipsis를 적용

* feat: memberTag 틀 작성

* feat: 멤버 태그 도메인 생성 및 멤버 태그 소팅기능 추가

* feat: member-post 필터링 기능 추가

* refactor: localDateTime -> localDate로 바꿈

* fix: time NPE 수정

* feat: 태그가 0일 때 분기처리

* refactor: Profilepage에서 변경된 API 적용

* refactor: Calendar hover 스타일 수정

* feat: 시간 오류 처리

* refactor: Calendar 선택에 따른 포스트목록 보여주기 구현

* refactor: 메뉴명 수정(관리 홈 -> 오버뷰)

* refactor: 폴더 구조 변경

* refactor: 폴더 구조 변경

* refactor: 테스트 폴더구조 정리

* refactor: 머지 후 충돌 해결

* feat: 태그 아이디가 0 일 때는 모두 보여주기

* feat: 스터디로그 명명 수정

* feat: 컨트롤러 필터 리퀘스트 적용

* fix: StudylogsSearchRequest import 수정

* fix: @searchParams 어노테이션 추가

* Delete .idea directory

* fix: pagination 설정 추가

* feat: studylog filter 에 date 추가

* refactor: n+1 문제 jdbcTemplate 구현으로 해결

* fix: 컴파일 오류 수정

* refactor: 멤버태그 cascade 정책 삭제

* refactor: 사용하지 않는 메서드 삭제

* feat: 기존 멤버태그 업데이트 기능 추가

* fix: 한 번에 같은 멤버 태그 업데이트시 증가가 안되는 버그 수정

* fix: 업데이트 안 되었을 시에만 맴버 태그 업데이트

* refactor: 멤버 태그 중복 시 예외 설정

* refactor: 필터링을 /posts 에서 /members/{name}/posts 로 변경

* fix: SearchArgumentResolver

* fix: SearchArgumentResolver

* refactor: 유저별 포스트 조회 API 변경

* fix: merge

Co-authored-by: HyuuunjuKim <gus7wn@gmail.com>
Co-authored-by: dudtjr913 <64782636+dudtjr913@users.noreply.github.com>
Co-authored-by: 류성현 <brown@woowahan.com>

* fix: 제목이 길어질 시 닉네임이 잘리는 버그 수정 (#371)

* fix: 제목이 길어질 시 닉네임이 잘리는 버그 수정

* fix: 필터링이 잘리는 버그 수정

* refactor: 선택된 필터 목록에 필터 타입 추가 (#372)

* feature: chip css

* refactor: 선택된 필터 노출 시 필터 이름 표시

* feat: 선택된 필터목록에서 검색어 삭제 시 검색바 내용 초기화

Co-authored-by: gracefulBrown <brown@woowahan.com>

* feat: flyway적용을 위한 의존성과 설정 추가 (#356)

* feat: flyway적용을 위한 의존성과 설정 추가

* feat: flyway enabled 기본전략 false로 수정

* feat: 테이블 스키마 변경사항 반영

* feature: table and column name to studylog from post

* feat: 테이블 스키마 변경사항 반영 및 dialect 배포환경가 맞는 버전으로 수정

Co-authored-by: gracefulBrown <brown@woowahan.com>

* fix: flyway enable for docs and at

* fix: ProfilePage에서 글 목록 안 나타나는 현상 수정 (#380)

* fix: requestGetPosts 사용방식 통일

* fix: tag 많을 시 스크롤 추가

* 학습로그 검색 기능 버그 수정 및 전반적 기능 변경  (#382)

* fix: StudylogDocumentRepository 응답값 Page로 변경

* feat: StudylogDocument 관리 필드 추가

* feat: SearchDocument에 필드 추가 후 로직 뼈대 잡기

* feat: sample 쿼리 추가 및 studylog-document로 재수정

* feat: TODO 추가 및 일부 수정

* etc: TODO 추가

* feat: StudylogDocumentQueryBuilder 추가

* QueryBuilder 및 SearchPage로 Paging 응답은 잘 받아오지만, 역시나 StudylogRepository 조회 문제로 인해 페이징이 되지 않음.
* local 환경에서 QueryBuilder를 어떤 식으로 동작하게 해야할 지 고민해야함.

* etc: DataLoader 동기화 메서드 추가

* feat: Paging 기능 추가

* feat: local용 FakeStudylogDocumentService 생성

* feat: StudylogDocumentService의 응답을 DTO로 변경

* refactor: FakeStudylogDocumentService 패키지 이동

* feat: FakeStudylogDocumentRepository#findBySearchKeyword 구현

* fix: flyway test 및 local 환경에서 작동하지 않도록 수정

* fix: StudylogDocumentQueryBuilder에서 tagIds만 Filter 적용하고, 나머지는 Bool 쿼리 적용하도록 수정

* 학습로그 목록 조회 시 필요한 쿼리 스트링 변경 (#381)

* fix: 첫 페이지는 쿼리 스트링을 제거한다
fix: 사이즈와 정렬은 쿼리 스트링에서 제거한다
fix: 필터를 제거했을 때 첫 페이지로 이동한다
fix: 프로필>포스트usernames를 쿼리스트링에서 제거한다.

* fix: 메인 페이지 적용

* fix: 키워드가 없을 때 발생하는 에러 수정 (#384)

* fix: 포스트에 포함된 태그만 노출

* fix: 필터 및 페이징이 정상동작하지 않는 이슈 해결 (#387)

연관 이슈
- 2 > 1 페이지 이동 x
- 마지막 필터 취소 시 취소되지 않음

* fix: 머지 이슈 해결

Co-authored-by: dudtjr913 <64782636+dudtjr913@users.noreply.github.com>
Co-authored-by: SungSiHyung <51393021+sihyung92@users.noreply.github.com>
Co-authored-by: HyuuunjuKim <43339385+HyuuunjuKim@users.noreply.github.com>
Co-authored-by: Minsung Son <sns2831@gmail.com>
Co-authored-by: Bomin Yoon <63535027+qhals321@users.noreply.github.com>
Co-authored-by: 서민정 <seominjeong.dev@gmail.com>
Co-authored-by: sunhpark42 <67677561+sunhpark42@users.noreply.github.com>
Co-authored-by: Hyeon9mak <jinha3507@gmail.com>
Co-authored-by: HyuuunjuKim <gus7wn@gmail.com>
  • Loading branch information
10 people authored Sep 13, 2021
1 parent 22e60c1 commit 006e6eb
Show file tree
Hide file tree
Showing 303 changed files with 8,141 additions and 3,627 deletions.
2 changes: 2 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ out/

### VS Code ###
.vscode/

logs
20 changes: 12 additions & 8 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@ repositories {

sourceSets {
acceptanceTest {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
java {
}
compileClasspath += sourceSets.main.output + sourceSets.test.output
runtimeClasspath += sourceSets.main.output + sourceSets.test.output
}
documentation {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
java {
}
compileClasspath += sourceSets.main.output + sourceSets.test.output
runtimeClasspath += sourceSets.main.output + sourceSets.test.output
}

}
Expand Down Expand Up @@ -74,6 +70,14 @@ dependencies {
// reflections
implementation 'org.reflections:reflections:0.9.10'

// elastic-search
implementation 'org.springframework.boot:spring-boot-starter-data-elasticsearch'
implementation "org.testcontainers:elasticsearch:1.15.3"
testImplementation "org.testcontainers:elasticsearch:1.16.0"

//flyway
implementation 'org.flywaydb:flyway-core:6.4.2'

runtimeOnly 'com.h2database:h2'
runtimeOnly 'mysql:mysql-connector-java'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
import io.restassured.http.ContentType;
import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification;
import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Profile("acceptance")
@Component
@Scope(scopeName = "cucumber-glue")
public class AcceptanceContext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,26 @@
import io.cucumber.java.Before;
import io.cucumber.spring.CucumberContextConfiguration;
import io.restassured.RestAssured;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;
import wooteco.prolog.common.DataInitializer;

@ActiveProfiles("acceptance")
@DirtiesContext
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@CucumberContextConfiguration
@SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT)
public class AcceptanceHooks {

@LocalServerPort
private int port;

@Autowired
private DataInitializer dataInitializer;

@Before("@api")
public void setupForApi() {
RestAssured.port = port;
dataInitializer.execute();
}
}

Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package wooteco.prolog;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;

@Profile("acceptance")
public class AcceptanceSteps {

@Autowired
public AcceptanceContext context;

}
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
package wooteco.prolog.fixtures;

import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
import org.apache.commons.lang3.StringUtils;

public enum GithubResponses {
소롱("1", "access_token_1", "소롱", "soulG", "111111", "https://avatars.githubusercontent.com/u/52682603?v=4"),
웨지("2", "access_token_2", "웨지", "sihyung92", "222222", "https://avatars.githubusercontent.com/u/51393021?v=4"),
서니("3", "access_token_3", "서니", "sunhpark42", "333333", "https://avatars.githubusercontent.com/u/67677561?v=4"),
엘라("4", "access_token_4", "엘라", "HyuuunjuKim", "444444", "https://avatars.githubusercontent.com/u/43339385?v=4"),
브라운("5", "access_token_5", "브라운", "gracefulBrown", "555555", "https://avatars.githubusercontent.com/u/46308949?v=4"),
현구막("6", "access_token_6", "현구막", "Hyeon9mak", "666666", "https://avatars.githubusercontent.com/u/37354145?v=4");
소롱("1", "access_token_1", "소롱", "soulG", "111111",
"https://avatars.githubusercontent.com/u/52682603?v=4"),
웨지("2", "access_token_2", "웨지", "sihyung92", "222222",
"https://avatars.githubusercontent.com/u/51393021?v=4"),
서니("3", "access_token_3", "서니", "sunhpark42", "333333",
"https://avatars.githubusercontent.com/u/67677561?v=4"),
엘라("4", "access_token_4", "엘라", "HyuuunjuKim", "444444",
"https://avatars.githubusercontent.com/u/43339385?v=4"),
브라운("5", "access_token_5", "브라운", "gracefulBrown", "555555",
"https://avatars.githubusercontent.com/u/46308949?v=4"),
현구막("6", "access_token_6", "현구막", "Hyeon9mak", "666666",
"https://avatars.githubusercontent.com/u/37354145?v=4");

private String code;
private String accessToken;
Expand All @@ -19,7 +24,8 @@ public enum GithubResponses {
private String id;
private String avatarUrl;

GithubResponses(String code, String accessToken, String name, String login, String id, String avatarUrl) {
GithubResponses(String code, String accessToken, String name, String login, String id,
String avatarUrl) {
this.code = code;
this.accessToken = accessToken;
this.name = name;
Expand All @@ -28,6 +34,27 @@ public enum GithubResponses {
this.avatarUrl = avatarUrl;
}

public static GithubResponses findByName(String member) {
return Arrays.stream(values())
.filter(it -> StringUtils.equals(it.name, member))
.findFirst()
.orElseThrow(RuntimeException::new);
}

public static GithubResponses findByCode(String code) {
return Arrays.stream(values())
.filter(it -> StringUtils.equals(it.code, code))
.findFirst()
.orElseThrow(RuntimeException::new);
}

public static GithubResponses findByToken(String accessToken) {
return Arrays.stream(values())
.filter(it -> StringUtils.equals(it.accessToken, accessToken))
.findFirst()
.orElseThrow(RuntimeException::new);
}

public String getCode() {
return code;
}
Expand All @@ -51,25 +78,4 @@ public String getId() {
public String getAvatarUrl() {
return avatarUrl;
}

public static GithubResponses findByName(String member) {
return Arrays.stream(values())
.filter(it -> StringUtils.equals(it.name, member))
.findFirst()
.orElseThrow(RuntimeException::new);
}

public static GithubResponses findByCode(String code) {
return Arrays.stream(values())
.filter(it -> StringUtils.equals(it.code, code))
.findFirst()
.orElseThrow(RuntimeException::new);
}

public static GithubResponses findByToken(String accessToken) {
return Arrays.stream(values())
.filter(it -> StringUtils.equals(it.accessToken, accessToken))
.findFirst()
.orElseThrow(RuntimeException::new);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package wooteco.prolog.fixtures;

import org.springframework.context.annotation.Profile;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;
import wooteco.prolog.login.application.dto.GithubAccessTokenRequest;
import wooteco.prolog.login.application.dto.GithubAccessTokenResponse;
import wooteco.prolog.login.application.dto.GithubProfileResponse;

@Profile("acceptance")
@RestController
public class GithubTestController {

Expand All @@ -25,7 +27,9 @@ public ResponseEntity<GithubProfileResponse> user(
String accessToken = authorization.split(" ")[1];
GithubResponses githubResponse = GithubResponses.findByToken(accessToken);
GithubProfileResponse response = new GithubProfileResponse(githubResponse.getName(),
githubResponse.getLogin(), githubResponse.getId(), githubResponse.getAvatarUrl());
githubResponse.getLogin(),
githubResponse.getId(),
githubResponse.getAvatarUrl());
return ResponseEntity.ok(response);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wooteco.prolog.fixtures;

import wooteco.prolog.level.application.dto.LevelRequest;
import wooteco.prolog.studylog.application.dto.LevelRequest;

public class LevelAcceptanceFixture {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wooteco.prolog.fixtures;

import wooteco.prolog.mission.application.dto.MissionRequest;
import wooteco.prolog.studylog.application.dto.MissionRequest;

public class MissionAcceptanceFixture {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package wooteco.prolog.fixtures;

import wooteco.prolog.post.application.dto.PostRequest;
import wooteco.prolog.tag.dto.TagRequest;
import wooteco.prolog.studylog.application.dto.StudylogRequest;
import wooteco.prolog.studylog.application.dto.TagRequest;

import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -55,24 +55,24 @@ public enum PostAcceptanceFixture {
List<TagRequest> tagRequests = Arrays.stream(tags)
.map(TagAcceptanceFixture::getTagRequest)
.collect(toList());
this.postRequest = new PostRequest(title, content, missionId, tagRequests);
this.studylogRequest = new StudylogRequest(title, content, missionId, tagRequests);
}

private final PostRequest postRequest;
private final StudylogRequest studylogRequest;
private final List<TagAcceptanceFixture> tags;

public PostRequest getPostRequest() {
return postRequest;
public StudylogRequest getPostRequest() {
return studylogRequest;
}

public static List<PostRequest> findByMissionNumber(Long missionId) {
public static List<StudylogRequest> findByMissionNumber(Long missionId) {
return Arrays.stream(PostAcceptanceFixture.values())
.map(PostAcceptanceFixture::getPostRequest)
.filter(it -> it.getMissionId().equals(missionId))
.collect(toList());
}

public static List<PostRequest> findByTagNumber(Long tagId) {
public static List<StudylogRequest> findByTagNumber(Long tagId) {
return Arrays.stream(PostAcceptanceFixture.values())
.filter(it -> it.tags.stream().anyMatch(tag -> tag.getTagId().equals(tagId)))
.map(PostAcceptanceFixture::getPostRequest)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package wooteco.prolog.fixtures;

import static java.util.stream.Collectors.toList;
import static wooteco.prolog.fixtures.TagAcceptanceFixture.TAG1;
import static wooteco.prolog.fixtures.TagAcceptanceFixture.TAG2;
import static wooteco.prolog.fixtures.TagAcceptanceFixture.TAG3;
import static wooteco.prolog.fixtures.TagAcceptanceFixture.TAG4;
import static wooteco.prolog.fixtures.TagAcceptanceFixture.TAG5;
import static wooteco.prolog.fixtures.TagAcceptanceFixture.TAG6;

import java.util.Arrays;
import java.util.List;
import wooteco.prolog.studylog.application.dto.StudylogRequest;
import wooteco.prolog.studylog.application.dto.TagRequest;

public enum StudylogAcceptanceFixture {
STUDYLOG1(
"[자바][옵셔널] 학습log 제출합니다.",
"옵셔널은 NPE를 배제하기 위해 만들어진 자바8에 추가된 라이브러리입니다. \n " +
"다양한 메소드를 호출하여 원하는 대로 활용할 수 있습니다",
1L,
TAG1,
TAG2
),
STUDYLOG2(
"[자바스크립트][비동기] 학습log 제출합니다.",
"모던 JS의 fetch문, ajax라이브러리인 axios등을 통해 비동기 요청을 \n " +
"편하게 할 수 있습니다. 자바 최고",
2L,
TAG3,
TAG4
),
STUDYLOG3(
"[자료구조] 자료구조는 어려워요",
"진짜 어려움",
1L,
TAG1,
TAG5
),
STUDYLOG4(
"[DOM] DOM DOM Dance",
"덤덤 댄스 아니고",
2L
),
STUDYLOG5(
"[알고리즘] 자료구조의 big O에 관하여",
"big O는 small O보다 크다",
2L,
TAG5,
TAG6
);

private final StudylogRequest studylogRequest;
private final List<TagAcceptanceFixture> tags;

StudylogAcceptanceFixture(
String title,
String content,
Long missionId,
TagAcceptanceFixture... tags) {
this.tags = Arrays.asList(tags);
List<TagRequest> tagRequests = Arrays.stream(tags)
.map(TagAcceptanceFixture::getTagRequest)
.collect(toList());
this.studylogRequest = new StudylogRequest(title, content, missionId, tagRequests);
}

public static List<StudylogRequest> findByMissionNumber(Long missionId) {
return Arrays.stream(StudylogAcceptanceFixture.values())
.map(StudylogAcceptanceFixture::getStudylogRequest)
.filter(it -> it.getMissionId().equals(missionId))
.collect(toList());
}

public static List<StudylogRequest> findByTagNumber(Long tagId) {
return Arrays.stream(StudylogAcceptanceFixture.values())
.filter(it -> it.tags.stream().anyMatch(tag -> tag.getTagId().equals(tagId)))
.map(StudylogAcceptanceFixture::getStudylogRequest)
.collect(toList());
}

public StudylogRequest getStudylogRequest() {
return studylogRequest;
}
}
Loading

0 comments on commit 006e6eb

Please sign in to comment.