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

[Feat/#293] 작가 description json 필드 추가 - imageUrl(required) #299

Merged
merged 4 commits into from
Aug 5, 2024

Conversation

hun-ca
Copy link
Member

@hun-ca hun-ca commented Aug 4, 2024

🎫 연관 이슈

resolved #293

💁‍♂️ PR 내용

🙏 작업

NOTE - 추후 작가 추가 API 추가될 때 디폴트 이미지 넣는 코드 들어가야 합니다

🙈 PR 참고 사항

보정쿼리

  • 현재 Member, article_main_card 테이블의 description, writer_description 제이슨 컬럼에 'imageUrl' 필드를 추가해 줘야 함

1. Member 테이블 보정

-- 보정 쿼리
WITH random_url AS (
    SELECT 'https://github.com/user-attachments/assets/28df9078-488c-49d6-9375-54ce5a250742' AS value
    UNION ALL
    SELECT 'https://github.com/user-attachments/assets/385dcafd-6737-41d7-aaa0-9db4ea6f27ea'
    UNION ALL
    SELECT 'https://github.com/user-attachments/assets/209da8ff-7c78-41b7-8e3e-40a2705f714a'
)
UPDATE MEMBER
SET description = JSON_SET(description, '$.imageUrl', 
    (SELECT value FROM random_url ORDER BY RAND() LIMIT 1))
where type_cd = 120;

2. article_main_card 테이블 보정

UPDATE ARTICLE_MAIN_CARD a
JOIN MEMBER m ON a.writer_id = m.id
SET a.writer_description = m.description
WHERE a.writer_id = m.id;

📸 스크린샷

1. Member 테이블 보정 테스트

  • as-is
    image

  • to-be
    image

2. article_main_card 테이블 보정 테스트

image


API-test

아티클 신규 저장 후 article_main_card 테이블 확인

image

  • imageUrl 정상 저장 확인

아티클 목록 조회

image

아티클 단건 조회

image

🤖 테스트 체크리스트

  • 체크 미완료
  • 체크 완료

@hun-ca hun-ca added the feature 새로운 기능을 만들 때 사용됩니다 label Aug 4, 2024
@hun-ca hun-ca self-assigned this Aug 4, 2024
@hun-ca hun-ca requested a review from belljun3395 as a code owner August 4, 2024 12:09
Copy link
Member Author

@hun-ca hun-ca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테이블 스키마 변경 없이 member, article_main_card 테이블의 description, writer_description 제이슨 컬럼에 "imageUrl" 필드 추가되었습니다.

기존 테이블은 imagUrl 제이슨 필드를 안갖고 있어서 배포시 보정 쿼리 수행 필요합니다. (위 참고)

@hun-ca
Copy link
Member Author

hun-ca commented Aug 4, 2024

코드보다 보정쿼리 위주로 봐주세요

@belljun3395 belljun3395 changed the base branch from main to dev August 4, 2024 13:40
Copy link
Collaborator

@belljun3395 belljun3395 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네네! 보정쿼리도 정상적으로 동작하는것 확인했습니다.!

너무 수고하셨어요!

Comment on lines 136 to +143
fun selectMemberByEmailQuery(query: SelectMemberByEmailQuery) = dslContext.select(
Member.MEMBER.ID.`as`(MemberIdAndNameRecord::memberId.name),
jsonGetAttributeAsText(Member.MEMBER.DESCRIPTION, "name").`as`(MemberIdAndNameRecord::writerName.name) // writer only(nullable)
Member.MEMBER.ID.`as`(MemberRecord::memberId.name),
// writer only(nullable)
jsonGetAttributeAsText(Member.MEMBER.DESCRIPTION, "name").`as`(MemberRecord::writerName.name),
// writer only(nullable)
jsonGetAttribute(Member.MEMBER.DESCRIPTION, "url").`as`(MemberRecord::url.name),
// writer only(nullable)
jsonGetAttribute(Member.MEMBER.DESCRIPTION, "imageUrl").`as`(MemberRecord::imageUrl.name)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

멤버랑 작가랑 조회하는 쿼리를 분리할까요?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

널 들어가는 것 보다 좋지 않을까 해서요!

@belljun3395 belljun3395 merged commit a23ee70 into dev Aug 5, 2024
12 checks passed
hun-ca added a commit that referenced this pull request Aug 7, 2024
* [Refactor/#275]: 인덱스 제약 수정 및 추가  (#294)

* [Refactor/#300] 컨트롤러 인증 구현 (#301)

* [Feat/#293] 작가 description json 필드 추가 - imageUrl(required) (#299)

* [#298/refactor]: 가입/인증에 따라 다른 내용 채워서 이메일 보내도록 수정 (#302)

* [Chore/#303] 단순 이메일 스타일 변경입니다  (#304)

* [Refactor/#305] 액션 개선 및 수정 (#306)

* [Fix/#308]: 시큐리티 필터 파싱 오류 해결 (#309)

* [Feat/#310] 이미지 Webp 변환 코드 구현 (#311)

* [Fix/#315] 멤버의 구독 정보 제공을 위한 조회시 취소를 구분하지 않은 문제 해결 (#316)

* [#317/Refactor] 시큐리티 필터 제외 목록 점검 및 수정 (#318)

---------

Co-authored-by: 지훈 <[email protected]>
Co-authored-by: belljun3395 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 새로운 기능을 만들 때 사용됩니다
Projects
None yet
Development

Successfully merging this pull request may close these issues.

작가 기본 이미지 등록
2 participants