Skip to content

Commit

Permalink
후원자 기능 로직 추가 (#587)
Browse files Browse the repository at this point in the history
* [feat] 후원자 여부 필드 추가

* [test] 테스트 코드 반영(#586)

* [teat] API 문서 반영(#586)

* [feat] 마이페이지 유저 정보에 후원물품 필드 추가, API 문서 반영(#586)
  • Loading branch information
isprogrammingfun authored Aug 31, 2023
1 parent d36d858 commit 682c3e1
Show file tree
Hide file tree
Showing 17 changed files with 128 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@ public class LoginInfo {

private Boolean onBoardingCompleted;

private Boolean isSponsor;

public LoginInfo(String nickname, Token token) {
this.nickname = nickname;
this.token = token.getToken();
this.refreshToken = token.getRefreshToken();
}

public LoginInfo(String nickname, Token token, Boolean onBoardingCompleted) {
public LoginInfo(String nickname, Token token, Boolean onBoardingCompleted, Boolean isSponsor) {
this.nickname = nickname;
this.token = token.getToken();
this.refreshToken = token.getRefreshToken();
this.onBoardingCompleted = onBoardingCompleted;
this.isSponsor = isSponsor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public LoginInfo commonAuth(String accessToken, String providerInfo) {
// Redis에 Refresh Token 저장
tokenUtil.storeRefreshToken(authenticatedMember.getSocialId(), token);

return new LoginInfo(authenticatedMember.getNickname(), token, authenticatedMember.getRole().equals(Member.Role.USER));
return new LoginInfo(authenticatedMember.getNickname(), token, authenticatedMember.getRole().equals(Member.Role.USER), authenticatedMember.getGoods() != null);
}

@Counted("auth.api.count")
Expand All @@ -92,7 +92,7 @@ public LoginInfo appleAuth(String identityToken, String providerInfo) {
// Redis에 Refresh Token 저장
tokenUtil.storeRefreshToken(authenticatedMember.getSocialId(), token);

return new LoginInfo(authenticatedMember.getNickname(), token, authenticatedMember.getRole().equals(Member.Role.USER));
return new LoginInfo(authenticatedMember.getNickname(), token, authenticatedMember.getRole().equals(Member.Role.USER), authenticatedMember.getGoods() != null);
}

@Counted("auth.api.count")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import lombok.NoArgsConstructor;

import java.time.DayOfWeek;
import java.util.Optional;

@Builder
@AllArgsConstructor
Expand All @@ -28,6 +29,8 @@ public class RespGetUserDto {

private String retrospectAlarmTime;

private String goods;

public static RespGetUserDto createRespGetUserDto(Member member) {
Alarm alarm = member.getAlarm();
return RespGetUserDto.builder()
Expand All @@ -38,6 +41,7 @@ public static RespGetUserDto createRespGetUserDto(Member member) {
.diaryAlarmTime(alarm.getDiaryTime())
.retrospectAlarmActive(alarm.getRetrospectActive())
.retrospectAlarmTime(alarm.getRetrospectTime())
.goods(member.getGoods() != null ? member.getGoods() : null)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public class MypageService {
private final FeedbackRepository feedbackRepository;

@Counted("mypage.api.count")
@Transactional(readOnly = true)
public RespGetUserDto getUser(String socialId) {
// socialId 로 유저 조회
Member member = findMember(socialId);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/docs/Alarm-API.html
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ <h4 id="Alarm-회고-알림-변경_response_fields">Response fields</h4>
<div id="footer">
<div id="footer-text">
Version 0.0.1-SNAPSHOT<br>
Last updated 2023-08-22 12:37:52 +0900
Last updated 2023-08-31 17:15:38 +0900
</div>
</div>
</body>
Expand Down
42 changes: 33 additions & 9 deletions src/main/resources/static/docs/Auth-API.html
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ <h4 id="Auth-Naver-소셜-로그인_http_response">HTTP response</h4>
<div class="content">
<pre class="highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 272
Content-Length: 297

{
"isSuccess" : true,
Expand All @@ -500,7 +500,8 @@ <h4 id="Auth-Naver-소셜-로그인_http_response">HTTP response</h4>
"nickname" : "유저 닉네임",
"token" : "SERVER_ACCESS_TOKEN",
"refreshToken" : "SERVER_REFRESH_TOKEN",
"onBoardingCompleted" : true
"onBoardingCompleted" : true,
"isSponsor" : true
}
}</code></pre>
</div>
Expand Down Expand Up @@ -557,6 +558,11 @@ <h4 id="Auth-Naver-소셜-로그인_response_fields">Response fields</h4>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">온보딩 여부 확인</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>result.isSponsor</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">후원자 여부 확인 true : 후원자, false : 후원자 아님</p></td>
</tr>
</tbody>
</table>
</div>
Expand Down Expand Up @@ -609,7 +615,7 @@ <h4 id="Auth-Kakao-소셜-로그인_http_response">HTTP response</h4>
<div class="content">
<pre class="highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 272
Content-Length: 297

{
"isSuccess" : true,
Expand All @@ -619,7 +625,8 @@ <h4 id="Auth-Kakao-소셜-로그인_http_response">HTTP response</h4>
"nickname" : "유저 닉네임",
"token" : "SERVER_ACCESS_TOKEN",
"refreshToken" : "SERVER_REFRESH_TOKEN",
"onBoardingCompleted" : true
"onBoardingCompleted" : true,
"isSponsor" : true
}
}</code></pre>
</div>
Expand Down Expand Up @@ -676,6 +683,11 @@ <h4 id="Auth-Kakao-소셜-로그인_response_fields">Response fields</h4>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">온보딩 여부 확인</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>result.isSponsor</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">후원자 여부 확인 true : 후원자, false : 후원자 아님</p></td>
</tr>
</tbody>
</table>
</div>
Expand Down Expand Up @@ -728,7 +740,7 @@ <h4 id="Auth-Google-소셜-로그인_http_response">HTTP response</h4>
<div class="content">
<pre class="highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 272
Content-Length: 297

{
"isSuccess" : true,
Expand All @@ -738,7 +750,8 @@ <h4 id="Auth-Google-소셜-로그인_http_response">HTTP response</h4>
"nickname" : "유저 닉네임",
"token" : "SERVER_ACCESS_TOKEN",
"refreshToken" : "SERVER_REFRESH_TOKEN",
"onBoardingCompleted" : true
"onBoardingCompleted" : true,
"isSponsor" : true
}
}</code></pre>
</div>
Expand Down Expand Up @@ -795,6 +808,11 @@ <h4 id="Auth-Google-소셜-로그인_response_fields">Response fields</h4>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">온보딩 여부 확인</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>result.isSponsor</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">후원자 여부 확인 true : 후원자, false : 후원자 아님</p></td>
</tr>
</tbody>
</table>
</div>
Expand Down Expand Up @@ -847,7 +865,7 @@ <h4 id="Auth-Apple-소셜-로그인_http_response">HTTP response</h4>
<div class="content">
<pre class="highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 272
Content-Length: 297

{
"isSuccess" : true,
Expand All @@ -857,7 +875,8 @@ <h4 id="Auth-Apple-소셜-로그인_http_response">HTTP response</h4>
"nickname" : "유저 닉네임",
"token" : "SERVER_ACCESS_TOKEN",
"refreshToken" : "SERVER_REFRESH_TOKEN",
"onBoardingCompleted" : true
"onBoardingCompleted" : true,
"isSponsor" : true
}
}</code></pre>
</div>
Expand Down Expand Up @@ -914,6 +933,11 @@ <h4 id="Auth-Apple-소셜-로그인_response_fields">Response fields</h4>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">온보딩 여부 확인</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>result.isSponsor</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">후원자 여부 확인 true : 후원자, false : 후원자 아님</p></td>
</tr>
</tbody>
</table>
</div>
Expand Down Expand Up @@ -1029,7 +1053,7 @@ <h4 id="Auth-토큰-재발급_response_fields">Response fields</h4>
<div id="footer">
<div id="footer-text">
Version 0.0.1-SNAPSHOT<br>
Last updated 2023-08-22 12:37:52 +0900
Last updated 2023-08-31 17:15:38 +0900
</div>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/docs/Diary-API.html
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,7 @@ <h4 id="Diary-감정어-조회_response_fields">Response fields</h4>
<div id="footer">
<div id="footer-text">
Version 0.0.1-SNAPSHOT<br>
Last updated 2023-08-22 12:37:52 +0900
Last updated 2023-08-31 17:15:38 +0900
</div>
</div>
</body>
Expand Down
12 changes: 9 additions & 3 deletions src/main/resources/static/docs/MyPage-API.html
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ <h4 id="MyPage-마이페이지-탭_http_response">HTTP response</h4>
<div class="content">
<pre class="highlight nowrap"><code class="language-http" data-lang="http">HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 366
Content-Length: 386

{
"isSuccess" : true,
Expand All @@ -495,7 +495,8 @@ <h4 id="MyPage-마이페이지-탭_http_response">HTTP response</h4>
"diaryAlarmActive" : true,
"diaryAlarmTime" : "20:00",
"retrospectAlarmActive" : true,
"retrospectAlarmTime" : "20:00"
"retrospectAlarmTime" : "20:00",
"goods" : "A"
}
}</code></pre>
</div>
Expand Down Expand Up @@ -567,6 +568,11 @@ <h4 id="MyPage-마이페이지-탭_response_fields">Response fields</h4>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>String</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">회고 알림 시간</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>result.goods</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>String</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">후원 세트 이름</p></td>
</tr>
</tbody>
</table>
</div>
Expand Down Expand Up @@ -1275,7 +1281,7 @@ <h4 id="MyPage-회원탈퇴_response_fields">Response fields</h4>
<div id="footer">
<div id="footer-text">
Version 0.0.1-SNAPSHOT<br>
Last updated 2023-08-22 12:37:52 +0900
Last updated 2023-08-31 17:15:38 +0900
</div>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/docs/OnBoarding-API.html
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ <h4 id="OnBoarding-온보딩-회고일-변경_response_fields">Response fields</
<div id="footer">
<div id="footer-text">
Version 0.0.1-SNAPSHOT<br>
Last updated 2023-08-22 12:37:52 +0900
Last updated 2023-08-31 17:15:38 +0900
</div>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/docs/Overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ <h3 id="Overview-Retrospect-status-codes">Retrospect Status Codes</h3>
<div id="footer">
<div id="footer-text">
Version 0.0.1-SNAPSHOT<br>
Last updated 2023-08-22 12:37:52 +0900
Last updated 2023-08-31 17:15:38 +0900
</div>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/docs/Retrospect-API-V2.html
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ <h4 id="Retrospect-회고-삭제-v2_response_fields">Response fields</h4>
<div id="footer">
<div id="footer-text">
Version 0.0.1-SNAPSHOT<br>
Last updated 2023-08-22 14:33:46 +0900
Last updated 2023-08-31 17:15:38 +0900
</div>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/docs/Retrospect-API.html
Original file line number Diff line number Diff line change
Expand Up @@ -2017,7 +2017,7 @@ <h4 id="Retrospect-회고-삭제_response_fields">Response fields</h4>
<div id="footer">
<div id="footer-text">
Version 0.0.1-SNAPSHOT<br>
Last updated 2023-07-23 20:17:33 +0900
Last updated 2023-08-31 17:15:38 +0900
</div>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/docs/Search-API.html
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ <h4 id="_search_회고_검색_response_fields">Response fields</h4>
<div id="footer">
<div id="footer-text">
Version 0.0.1-SNAPSHOT<br>
Last updated 2023-08-22 12:37:52 +0900
Last updated 2023-08-31 17:15:38 +0900
</div>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/docs/Sponsor-API.html
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ <h4 id="Sponsor-후원자_response_fields">Response fields</h4>
<div id="footer">
<div id="footer-text">
Version 0.0.1-SNAPSHOT<br>
Last updated 2023-08-22 12:37:52 +0900
Last updated 2023-08-31 17:15:38 +0900
</div>
</div>
</body>
Expand Down
Loading

0 comments on commit 682c3e1

Please sign in to comment.