Skip to content

Commit

Permalink
refactor: 피드백 검증이 이뤄지지 않는 문제를 해결한다. (#446)
Browse files Browse the repository at this point in the history
* feat: id를 사용하는 entity는 BaseEntity를 상속하도록 수정 (#293)

* feat: id를 사용하는 entity는 BaseEntity를 상속하도록 수정

* refactor: flyway 사용 규칙에 따라 스크립트 수정

* refactor: 룸 업로드 페이지 리팩터링 (#307)

* refactor: 룸, 트랙, 미디어소스 역정규화 (#309)

* feat: 카카오 소셜 로그인 기능을 구현한다. (#301)

* refactor: 패키지 및 클래스 명 수정

* feat: 카카오 소셜로그인 idToken 검증 및 payload 추출 기능 구현

* feat: 카카오 소셜로그인 기능 구현

* refactor: jwkProvider를 static 변수로 가지도록 수정

* refactor: 구글 소셜로그인 검증 방식 통일

* refactor: 구글 소셜로그인 검증 방식 추상화

* feat: 멤버 객체 내 nickname 필드 추가

* feat: 닉네임 객체 구현

* refactor: 클래스 네이밍 변경

* feat: JwkProvider를 찾지 못할 때 예외 구현 및 record -> class로 변경

* refactor: final 키워드 추가

* chore: 닉네임 추가 sql 버전 변경 5.3 -> 5.4

---------

Co-authored-by: thdwoqor <[email protected]>

* chore: 데이터 베이스 테이블 컬럼 수정 (#311)

* feat: IdTokenResolver가 Provider에 맞게 동작한다 (#314)

* feat: IdTokenResolver가 Provider에 맞게 동작한다

* test: 지원하지 않는 Issuer 예외 테스트 추가

* refactor: 유지보수가 용이하도록 구조 개선

* refactor: 누락된 final 추가

* feat: 게스트로 로그인한다 (#316)

* feat: 게스트로 로그인한다

* feat: 빈 패스워드는 어떤 문자열과도 일치하지 않는다

* refactor: Member 클래스 내 생성자를 정적 팩토리 메소드로 변경

* refactor: final 키워드 추가

* fix: 머지 중 누락

---------

Co-authored-by: Kong-hana01 <[email protected]>

* chore: 중복된 ci 파일 제거 (#323)

* fix: 피드백 검증을 하지 않는 문제 해결

* chore: 컨벤션 통일

* docs: ci dev db 파일 수정

* fix: db url 수정

* fix: runs-on 수정

* chore: ci 스크립트 수정 복원

* chore: DB CI 복구

---------

Co-authored-by: Jae-Baek Song <[email protected]>
Co-authored-by: Songusika <[email protected]>
Co-authored-by: 0chil <[email protected]>
Co-authored-by: thdwoqor <[email protected]>
  • Loading branch information
5 people authored Jan 24, 2024
1 parent b6b5a4d commit cf8a1a1
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-dev-application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ permissions:

jobs:
build:
runs-on: jolla-ppalla
runs-on: development
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-dev-db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
working-directory: ./backend
env:
MYSQL_CONTAINER_NAME: temp-mysql
SOURCE_DB_HOSTNAME: ip-192-168-2-43.ap-northeast-2.compute.internal
SOURCE_DB_HOSTNAME: digginroom-db-1.cxyy6oukuxsh.ap-northeast-2.rds.amazonaws.com
SOURCE_DB_PORT: 3306
SOURCE_DB_SCHEMA: digginroom_dev
steps:
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
- name: 개발 DB 덤프
env:
DUMP_OPTIONS: --single-transaction --no-tablespaces
DUMP_OPTIONS:
# 테이블 락킹 권한과 테이블 스페이스 열람 권한 (PROCESS 권한) 없이 덤프할 수 있다.
run: |
sudo docker exec $MYSQL_CONTAINER_NAME sh -c ' \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
package com.digginroom.digginroom.feedback.controller;

import com.digginroom.digginroom.controller.Auth;
import com.digginroom.digginroom.domain.member.Member;
import com.digginroom.digginroom.feedback.FeedbackService;
import com.digginroom.digginroom.feedback.dto.FeedbackRequest;
import com.digginroom.digginroom.feedback.dto.FeedbackResponse;
import jakarta.validation.Valid;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequiredArgsConstructor
@RequestMapping("/feedbacks")
public class FeedbackController {

private final FeedbackService feedbackService;

@PostMapping("/feedbacks")
public ResponseEntity<Void> takeFeedbackFrom(final @Auth Long memberId, final @RequestBody FeedbackRequest feedback) {
@PostMapping
public ResponseEntity<Void> takeFeedbackFrom(
@Auth final Long memberId,
@Valid @RequestBody final FeedbackRequest feedback
) {
feedbackService.accept(memberId, feedback);
return ResponseEntity.ok().build();
}

@GetMapping("/feedbacks")
@GetMapping
public ResponseEntity<List<FeedbackResponse>> showFeedbacks() {
return ResponseEntity.ok().body(feedbackService.getAll());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class Feedback extends BaseEntity {
private Long writerId;
private String content;

public Feedback(Long writerId, String content) {
public Feedback(final Long writerId, final String content) {
this.writerId = writerId;
this.content = content;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,18 @@ void login() {
.usingRecursiveFieldByFieldElementComparatorIgnoringFields("writerId")
.containsExactly(FeedbackResponse.of(new Feedback(파워().getId(), content)));
}

@Test
void 피드백_문구가_비어있으면_예외가_발생한다() {
String content = "";

RestAssured.given().log().all()
.body(new FeedbackRequest(content))
.contentType(ContentType.JSON)
.cookie(cookie)
.when()
.post("/feedbacks")
.then()
.statusCode(HttpStatus.BAD_REQUEST.value());
}
}

0 comments on commit cf8a1a1

Please sign in to comment.