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

(데이터베이스) 리뷰 기능 개발 #42

Open
ghdcksgml1 opened this issue Dec 2, 2022 · 17 comments
Open

(데이터베이스) 리뷰 기능 개발 #42

ghdcksgml1 opened this issue Dec 2, 2022 · 17 comments
Assignees
Labels
💻 backend 백엔드 📦 DB 데이터베이스

Comments

@ghdcksgml1
Copy link
Collaborator

리뷰 기능이 활성화 되어야 앱에 생동감이 생길듯하다.

@ghdcksgml1 ghdcksgml1 added 📦 DB 데이터베이스 💻 backend 백엔드 labels Dec 27, 2022
@ghdcksgml1 ghdcksgml1 changed the title 리뷰 기능 개발 (데이터베이스) 리뷰 기능 개발 Dec 27, 2022
@ghdcksgml1 ghdcksgml1 self-assigned this Dec 27, 2022
@ghdcksgml1 ghdcksgml1 added this to the 12월 5주차(12.27-01.01) milestone Dec 27, 2022
ghdcksgml1 added a commit that referenced this issue Dec 30, 2022
@ghdcksgml1
Copy link
Collaborator Author

스크린샷 2022-12-30 오후 1 15 59

@ghdcksgml1
Copy link
Collaborator Author

ghdcksgml1 commented Dec 30, 2022

Review Table

  • id (PK)
  • 주문내역 (FK)
  • 음식 사진
  • 별점
  • 리뷰내용
  • 작성자
  • 상태 (리뷰를 보여줄지 말지)

이렇게 필드가 구성되어 있는데 추가로 넣을 컬럼이 뭐가 있을까요?

@rnwlstj
Copy link

rnwlstj commented Dec 30, 2022

Image

배달의 민족을 참고해봤는데

음식을 시킨 날짜[ex) 이번 달, 저번 달, 2개월 전 등],
시킨 음식 메뉴명[ex) 얌샘김밥, 버섯카레 등],
시킨 음식점 이름[ex) 고씨네 죽전단국대점, 얌샘 단국대점]

등을 넣으면 좋을 것 같습니다!

@ghdcksgml1
Copy link
Collaborator Author

ghdcksgml1 commented Dec 30, 2022

오 감사합니다!

해당 내용들은 FK인 UserOrderDetail에 모두 담겨있어서
API로 넘겨줄때 위 내용들을 가공해서 내보내면 좋을것같네요 ㅎㅎ

// (GET) https://eat-da.com:8000/api/review/{storeId}
data : [{
  "id": 1234,
  "imageUrl": "https://eat-da.com",
  "star": 4,
  "content": "맛이 좋네요.",
  "createdBy": "홍**",
  "menuName": "허니콤보 외 2건",
  "storeName": "교촌치킨",
  "orderDate": "이번주"
}, {
  "id": 1235,
  "imageUrl": "https://eat-da.com",
  "star": 4,
  "content": "맛이 좋네요.",
  "createdBy": "홍**",
  "menuName": "허니콤보 외 2건",
  "storeName": "교촌치킨",
  "orderDate": "이번주"
}, {
  "id": 1236,
  "imageUrl": "https://eat-da.com",
  "star": 4,
  "content": "맛이 좋네요.",
  "createdBy": "홍**",
  "menuName": "허니콤보 외 2건",
  "storeName": "교촌치킨",
  "orderDate": "이번주"
}]

@ghdcksgml1
Copy link
Collaborator Author

ghdcksgml1 commented Dec 30, 2022

리뷰 테스트

  • 데이터베이스
    • 데이터베이스 생성 시 createdBy 어노테이션 적용 여부
    • nullable = false 작동하는지

추가 테스트 필요 작업이 있으면 아래 체크박스를 추가해주세요.

ghdcksgml1 added a commit that referenced this issue Dec 30, 2022
ghdcksgml1 added a commit that referenced this issue Jan 6, 2023
데이터를 넣어주면 현재 날짜로부터 얼마나 시간이 지났는지 나타냄.
@ghdcksgml1
Copy link
Collaborator Author

ghdcksgml1 commented Jan 10, 2023

// (POST) https://eat-da.com:8000/api/review/{userOrderDetailId}
// 리뷰 작성

// (DELETE) https://eat-da.com:8000/api/review/visible/{reviewId}
// 리뷰 삭제 (숨기기)

// (GET) https://eat-da.com:8000/api/review/{reviewId}
// 리뷰 1개 가져오기

ghdcksgml1 added a commit that referenced this issue Jan 12, 2023
자바에서  코틀린 컴패니언 객체에 접근할 때 기존 자바 문법과 동일하게 접근시키기 위해 @JvmStatic 어노테이션을 추가해줌.
@ITKOO
Copy link
Collaborator

ITKOO commented Jan 12, 2023

Group 89035

가게 상세 페이지에 들어갔을 때 리뷰 화면을 기획해봤습니다

  1. 아래 json에서 memuName을 배열 형식으로, 고객이 주문한 메뉴 전체 목록을 받을 수 있을까요?
  2. 가게 전체 평점은 store 정보 조회 api에서 얻을 수 있을까요?
  3. 리뷰 상세 화면에서 1번, 2번 중에 어떤걸 할지 투표 부탁드립니다
  "id": 1234,
  "imageUrl": "https://eat-da.com",
  "star": 4,
  "content": "맛이 좋네요.",
  "createdBy": "홍**",
  "menuName": "허니콤보 외 2건",
  "storeName": "교촌치킨",
  "orderDate": "이번주"
}

항상 고생많으십니다!!
확인 하시고 답글 부탁드립니다~

@ghdcksgml1
Copy link
Collaborator Author

  1. 네 그렇게 진행하겠습니다.
  2. 전체 평점을 생각 못했네요 그 부분도 추가하겠습니다.
  3. 저는 1번이 좋을 것 같아요.

@rnwlstj
Copy link

rnwlstj commented Jan 13, 2023

3.저도 1번이 좋은 것 같아요!
그리고 혹시 아래 첨부한 사진처럼 가게명 뒤에 가게 대표 사진도 위치하도록 할 수 있을까요?

image

ghdcksgml1 added a commit that referenced this issue Jan 15, 2023
- visible 컬럼은 리뷰를 삭제할때 false 시킨다.
ghdcksgml1 added a commit that referenced this issue Jan 15, 2023
queryFactory를 한번만 생성시켜놓고 가져다 쓰기 위해서
ghdcksgml1 added a commit that referenced this issue Jan 17, 2023
(GET) localhost:8080/api/review/{storeId}?page=123
@ghdcksgml1
Copy link
Collaborator Author

// 예시 (GET) localhost:8080/api/review/{storeId}?page=123
// 최신순으로 나옵니다. page를 이용해서 가져오기 첫번째 리뷰가 0부터 시작
{
    "status": 200,
    "data": [
        {
            "id": 2,
            "imageUrl": null,
            "star": 3,
            "content": "음식이 친절하고 사장님이 맛있어요.",
            "createdBy": "g*********",
            "menuName": [
                {
                    "id": 2,
                    "name": "짜장면"
                }
            ],
            "orderDate": "2023-01-18T01:06:52",
            "visible": false,
            "relativeDate": "2분 전"
        },
        {
            "id": 1,
            "imageUrl": null,
            "star": 5,
            "content": "맛있네요",
            "createdBy": "g********",
            "menuName": [
                {
                    "id": 1,
                    "name": "마라탕"
                }
            ],
            "orderDate": "2023-01-18T01:06:52",
            "visible": false,
            "relativeDate": "2분 전"
        }
    ]
}

@ghdcksgml1
Copy link
Collaborator Author

ghdcksgml1 commented Jan 17, 2023

스크린샷 2023-01-18 오전 3 08 02

리뷰 생성의 경우 form-data로 넘겨주면 됩니다.

  • image : 이미지 파일
  • star : 별점
  • content : 내용

추가로 BearerToken도 필요합니다.

// 예시 (POST) localhost:8080/api/review/{userOrderDetailId}

{
    "status": 200,
    "data": "OK"
}

🤓 테스트

  • aws S3 이미지 업로드 확인
  • 이미 작성된 리뷰가 있는지 확인
  • 해당 유저의 주문이 맞는지 확인
  • 리뷰 작성이 완료되면 상태변경
  • 작성자 잘 들어가는지 확인

ghdcksgml1 added a commit that referenced this issue Jan 17, 2023
(POST) localhost:8080/api/review/{userOrderDetailId}
@ghdcksgml1
Copy link
Collaborator Author

ghdcksgml1 commented Jan 18, 2023

// (DELETE) https://eat-da.com:8000/api/review/visible/{reviewId}
// 리뷰 삭제 (숨기기)
{
    "status": 200,
    "data": "OK"
}

🤓 테스트

  • reviewId와 userId를 통해 리뷰 작성자 검증
  • visible 컬럼이 true이 댓글만 삭제 가능하도록
  • 삭제하고 난 뒤 visible이 false로 바뀌는지
  • 리뷰를 찾지 못했을때 exception 발생

@ITKOO
Copy link
Collaborator

ITKOO commented Jan 18, 2023

확인했습니다! 회의 끝나자마자 작업하는 당신은... 감사합니다 최고 👍
금욜 개발 데이 전까지 만들어 주신 api 한번씩 호출해보고 가겠습니다!

@ghdcksgml1
Copy link
Collaborator Author

ghdcksgml1 commented Jan 18, 2023

// (GET) https://eat-da.com:8000/api/review/select/{reviewId}
// 리뷰 1개 가져오기
{
    "status": 200,
    "data": {
        "id": 1,
        "imageUrl": null,
        "star": 5,
        "content": "맛있네요",
        "createdBy": "g********",
        "menuName": [
            {
                "id": 1,
                "name": "마라탕"
            },
            {
                "id": 3,
                "name": "탕수육"
            }
        ],
        "orderDate": "2023-01-18T21:21:18",
        "visible": true,
        "relativeDate": "56초 전"
    }
}

🤓 테스트

  • visible이 false일때 안나오지는 체크
  • 닉네임, relativeDate 적용이 제대로 되는지

@ITKOO
Copy link
Collaborator

ITKOO commented Jan 18, 2023

@ghdcksgml1

// 예시 (GET) localhost:8080/api/review/{storeId}?page=123

위 api에서 page에 나오는 리뷰의 갯수는 고정적인가요?
제가 요청시 함께 보내도 괜찮을까요?

ex) page=1&size=10

@ghdcksgml1
Copy link
Collaborator Author

@ITKOO

@ghdcksgml1

// 예시 (GET) localhost:8080/api/review/{storeId}?page=123

위 api에서 page에 나오는 리뷰의 갯수는 고정적인가요? 제가 요청시 함께 보내도 괜찮을까요?

ex) page=1&size=10

네 size도 받을 수 있도록 설정해놓을게요.

@ITKOO
Copy link
Collaborator

ITKOO commented Jan 18, 2023

@ITKOO

@ghdcksgml1

// 예시 (GET) localhost:8080/api/review/{storeId}?page=123

위 api에서 page에 나오는 리뷰의 갯수는 고정적인가요? 제가 요청시 함께 보내도 괜찮을까요?
ex) page=1&size=10

네 size도 받을 수 있도록 설정해놓을게요.

빠른 답변 앤 수정 감사합니다!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 backend 백엔드 📦 DB 데이터베이스
Projects
None yet
Development

No branches or pull requests

3 participants