[BE] 사용자 공유 상태 변경 API 및 공유 링크 조회 API 추가 #194
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📎 이슈번호
📃 변경사항
유저 닉네임 검색 API에 Swagger 데코레이터 추가
사용하지 않는 파일 및 코드 삭제
ShareLink Entity 추가
User와
@OneToOne관계 설정User에 status 속성 추가(기본 값은 'private')
공유 상태 여부를 나타내는 UserShareStatus enum 추가
User Entity 수정하면서 관련 코드 수정
유저 공유 상태를 변경할 수 있는
PATCH /auth/statusapi 추가status 요청에 지정된 값만 요청할 수 있도록 StatusValidationPipe 추가
유저 공유 링크를 조회할 수 있는 `GET /auth/sharelink' api 추가
api 요청이 들어오면 일단 서버는 쿠키에서 유저 정보를 읽음
만약 유저가 private인 상태다 → BadRequest 발생
아닌 경우는 데이터베이스에서 유저 정보로 링크 조회
만약 조회되는 링크가 없다면 새로 생성하여 데이터베이스에 저장하고 응답 메세지로 링크 반환
새로 생긴 api에 swagger 추가
🫨 고민한 부분
제가 구상한 순서는 다음과 같습니다.
프론트에서 유저의 공유 상태(공개, 링크만 공개, 비공개)를 변경 ->
PATCH /auth/status그 후 링크를 조회하고 싶으면 -> 'GET /auth/sharelink'
프론트에서 우선 유저 공유 상태를 변경 api를 요청하고, 그 다음에 공유 링크를 얻고 싶으면 다시 링크 조회 api를 요청하는 식으로 하는 쪽으로 구상했습니다.
링크는 uuid로 했습니다!!!
📌 중점적으로 볼 부분
🎇 동작 화면
우선 로그인�하여 쿠키를 발급!
유저 status 속성값 변경
body에 들어갈 정보들
400 BadRequest 에러 발생

400 BadRequest 에러 발생

유저 정보 반환

공유 링크 조회
400 BadRequest 에러 발생

링크 정보 반환

💫 기타사항