Skip to content

Commit

Permalink
ci: 충돌 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonyj1022 committed Sep 19, 2023
2 parents 83f9e71 + 66bb8ec commit 996290a
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,19 @@ public boolean validateToken(final String accessToken) {
@Transactional
public void withdrawal(
final Oauth2Type oauth2Type,
final String oauth2AccessToken,
final String accessToken,
final String refreshToken
) throws InvalidWithdrawalException {
final OAuth2UserInformationProvider provider = providerComposite.findProvider(oauth2Type);
final UserInformationDto userInformationDto = provider.findUserInformation(oauth2AccessToken);
final User user = userRepository.findByOauthIdAndDeletedIsFalse(userInformationDto.findUserId())
final PrivateClaims privateClaims = tokenDecoder.decode(TokenType.ACCESS, accessToken)
.orElseThrow(() ->
new InvalidTokenException("유효한 토큰이 아닙니다.")
);
final User user = userRepository.findByIdAndDeletedIsFalse(privateClaims.userId())
.orElseThrow(() -> new InvalidWithdrawalException("탈퇴에 대한 권한 없습니다."));

user.withdrawal();
blackListTokenService.registerBlackListToken(oauth2AccessToken, refreshToken);
provider.unlinkUserBy(oauth2AccessToken, user.getOauthId());
blackListTokenService.registerBlackListToken(accessToken, refreshToken);
provider.unlinkUserBy(user.getOauthId());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties("oauth2.client.providers.kakao")
public record KakaoProvidersConfigurationProperties(String userInfoUri, String userUnlinkUri) {
public record KakaoProvidersConfigurationProperties(String adminKey, String userInfoUri, String userUnlinkUri) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ public interface OAuth2UserInformationProvider {

UserInformationDto findUserInformation(final String accessToken);

UserInformationDto unlinkUserBy(final String accessToken, final String oauthId);
UserInformationDto unlinkUserBy(final String oauthId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
public class KakaoUserInformationProvider implements OAuth2UserInformationProvider {

private static final String TOKEN_TYPE = "Bearer ";
private static final String KAKAO_ADMIN_TOKEN_TYPE = "KakaoAK ";
private static final String REST_TEMPLATE_MESSAGE_SEPARATOR = ":";
private static final int MESSAGE_INDEX = 0;

Expand Down Expand Up @@ -58,16 +59,16 @@ public UserInformationDto findUserInformation(final String accessToken) {
}

@Override
public UserInformationDto unlinkUserBy(final String accessToken, final String oauthId) {
public UserInformationDto unlinkUserBy(final String oauthId) {
final HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set(HttpHeaders.AUTHORIZATION, TOKEN_TYPE + accessToken);
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
headers.set(HttpHeaders.AUTHORIZATION, KAKAO_ADMIN_TOKEN_TYPE + providersConfigurationProperties.adminKey());

final MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
parameters.add("target_id_type", "user_id");
parameters.add("target_id", oauthId);
final MultiValueMap<String, String> body = new LinkedMultiValueMap<>();
body.add("target_id_type", "user_id");
body.add("target_id", oauthId);

final HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(parameters, headers);
final HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(body, headers);

try {
final ResponseEntity<UserInformationDto> response = restTemplate.exchange(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private Bid saveBid(final CreateBidDto bidDto, final Auction auction, final User

public List<ReadBidDto> readAllByAuctionId(final Long auctionId) {
if (auctionRepository.existsById(auctionId)) {
final List<Bid> bids = bidRepository.findByAuctionId(auctionId);
final List<Bid> bids = bidRepository.findByAuctionIdOrderByIdAsc(auctionId);

return bids.stream()
.map(ReadBidDto::from)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public interface JpaBidRepository extends JpaRepository<Bid, Long> {

List<Bid> findByAuctionId(final Long id);
List<Bid> findByAuctionIdOrderByIdAsc(final Long id);

@Query("select b from Bid b where b.auction.id = :auctionId order by b.id desc limit 1")
Bid findLastBidByAuctionId(@Param("auctionId") final Long id);
Expand Down
1 change: 1 addition & 0 deletions backend/ddang/src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ oauth2:
client:
providers:
kakao:
admin-key: adminkey
user-info-uri: https://kapi.kakao.com/v2/user/me
user-unlink-uri: https://kapi.kakao.com/v1/user/unlink

Expand Down
99 changes: 28 additions & 71 deletions backend/ddang/src/main/resources/static/docs/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ <h3 id="_탈퇴"><a class="link" href="#_탈퇴">탈퇴</a></h3>
<h4 id="_요청_5"><a class="link" href="#_요청_5">요청</a></h4>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">DELETE /oauth2/withdrawal/kakao HTTP/1.1
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">POST /oauth2/withdrawal/kakao HTTP/1.1
Content-Type: application/json
Authorization: Bearer accessToken

Expand Down Expand Up @@ -1021,60 +1021,17 @@ <h4 id="_응답_6"><a class="link" href="#_응답_6">응답</a></h4>
<h3 id="_사용자_정보_수정"><a class="link" href="#_사용자_정보_수정">사용자 정보 수정</a></h3>
<div class="sect3">
<h4 id="_요청_7"><a class="link" href="#_요청_7">요청</a></h4>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">PATCH /users HTTP/1.1
Content-Type: multipart/form-data; boundary=6o2knFse3p53ty9dmcQvWAIx1zInP11uCfbm
Authorization: Bearer accessToken</code></pre>
</div>
<div class="paragraph">
<p>Unresolved directive in docs.adoc - include::/Users/jamie/Documents/IntelliJ_Project/2023-3-ddang/backend/ddang/build/generated-snippets/user-controller-test/사용자_정보를_수정한다/http-request.adoc[]</p>
</div>
</div>
<div class="sect3">
<h4 id="_응답_7"><a class="link" href="#_응답_7">응답</a></h4>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">HTTP/1.1 200 OK
Content-Type: application/json

{
"name" : "사용자1",
"profileImage" : "http://localhost:8080/users/images/1",
"reliability" : 4.6
}</code></pre>
<div class="paragraph">
<p>Unresolved directive in docs.adoc - include::/Users/jamie/Documents/IntelliJ_Project/2023-3-ddang/backend/ddang/build/generated-snippets/user-controller-test/사용자_정보를_수정한다/http-response.adoc[]
Unresolved directive in docs.adoc - include::/Users/jamie/Documents/IntelliJ_Project/2023-3-ddang/backend/ddang/build/generated-snippets/user-controller-test/사용자_정보를_수정한다/response-fields.adoc[]</p>
</div>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 33.3333%;">
<col style="width: 33.3333%;">
<col style="width: 33.3334%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Path</th>
<th class="tableblock halign-left valign-top">Type</th>
<th class="tableblock halign-left valign-top">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>name</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>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>profileImage</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>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>reliability</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Number</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">사용자 신뢰도</p></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -1442,7 +1399,7 @@ <h4 id="_요청_13"><a class="link" href="#_요청_13">요청</a></h4>
Content-Disposition: form-data; name=request; filename=request
Content-Type: application/json

{"title":"경매 상품 1","description":"이것은 경매 상품 1 입니다.","bidUnit":1000,"startPrice":1000,"closingTime":"2023-09-18T18:56:49.863763","subCategoryId":2,"thirdRegionIds":[3]}
{"title":"경매 상품 1","description":"이것은 경매 상품 1 입니다.","bidUnit":1000,"startPrice":1000,"closingTime":"2023-09-21T21:19:23.572151","subCategoryId":2,"thirdRegionIds":[3]}
--6o2knFse3p53ty9dmcQvWAIx1zInP11uCfbm--</code></pre>
</div>
</div>
Expand Down Expand Up @@ -1498,7 +1455,7 @@ <h4 id="_응답_13"><a class="link" href="#_응답_13">응답</a></h4>
{
"id" : 1,
"title" : "title",
"image" : "http://localhost:8080/auctions/images1",
"image" : "http://localhost:8080/auctions/images/1",
"auctionPrice" : 1000,
"status" : "UNBIDDEN",
"auctioneerCount" : 0
Expand Down Expand Up @@ -1616,14 +1573,14 @@ <h4 id="_응답_14"><a class="link" href="#_응답_14">응답</a></h4>
"auctions" : [ {
"id" : 2,
"title" : "경매 상품 2",
"image" : "http://localhost:8080/auctions/images1",
"image" : "http://localhost:8080/auctions/images/1",
"auctionPrice" : 1000,
"status" : "FAILURE",
"auctioneerCount" : 2
}, {
"id" : 1,
"title" : "경매 상품 1",
"image" : "http://localhost:8080/auctions/images1",
"image" : "http://localhost:8080/auctions/images/1",
"auctionPrice" : 1000,
"status" : "FAILURE",
"auctioneerCount" : 2
Expand Down Expand Up @@ -2038,7 +1995,7 @@ <h4 id="_응답_17"><a class="link" href="#_응답_17">응답</a></h4>
{
"auction" : {
"id" : 1,
"images" : [ "http://localhost:8080/auctions/images1" ],
"images" : [ "http://localhost:8080/auctions/images/1" ],
"title" : "경매 상품 1",
"category" : {
"main" : "main",
Expand All @@ -2049,8 +2006,8 @@ <h4 id="_응답_17"><a class="link" href="#_응답_17">응답</a></h4>
"lastBidPrice" : null,
"status" : "FAILURE",
"bidUnit" : 1000,
"registerTime" : "2023-09-15T18:56:49",
"closingTime" : "2023-09-15T18:56:49",
"registerTime" : "2023-09-18T21:19:23",
"closingTime" : "2023-09-18T21:19:23",
"directRegions" : [ {
"first" : "서울특별시",
"second" : "강서구",
Expand Down Expand Up @@ -2382,12 +2339,12 @@ <h4 id="_응답_20"><a class="link" href="#_응답_20">응답</a></h4>
"name" : "사용자1",
"profileImage" : "http://localhost:8080/users/images/1",
"price" : 10000,
"bidTime" : "2023-09-15T18:56:51"
"bidTime" : "2023-09-18T21:19:25"
}, {
"name" : "사용자2",
"profileImage" : "http://localhost:8080/users/images/2",
"price" : 12000,
"bidTime" : "2023-09-15T18:56:51"
"bidTime" : "2023-09-18T21:19:25"
} ]
}</code></pre>
</div>
Expand Down Expand Up @@ -2578,11 +2535,11 @@ <h4 id="_응답_22"><a class="link" href="#_응답_22">응답</a></h4>
"auction" : {
"id" : 1,
"title" : "경매1",
"image" : "http://localhost:8080/auctions/images1",
"image" : "http://localhost:8080/auctions/images/1",
"price" : 10000
},
"lastMessage" : {
"createdAt" : "2023-09-15T18:56:53",
"createdAt" : "2023-09-18T21:19:27",
"contents" : "메시지1"
},
"isChatAvailable" : true
Expand All @@ -2596,11 +2553,11 @@ <h4 id="_응답_22"><a class="link" href="#_응답_22">응답</a></h4>
"auction" : {
"id" : 2,
"title" : "경매2",
"image" : "http://localhost:8080/auctions/images1",
"image" : "http://localhost:8080/auctions/images/1",
"price" : 20000
},
"lastMessage" : {
"createdAt" : "2023-09-15T18:56:53",
"createdAt" : "2023-09-18T21:19:27",
"contents" : "메시지2"
},
"isChatAvailable" : true
Expand Down Expand Up @@ -2766,7 +2723,7 @@ <h4 id="_응답_23"><a class="link" href="#_응답_23">응답</a></h4>
"auction" : {
"id" : 1,
"title" : "경매 상품 1",
"image" : "http://localhost:8080/auctions/images1",
"image" : "http://localhost:8080/auctions/images/1",
"price" : 3000
},
"isChatAvailable" : true
Expand Down Expand Up @@ -3038,7 +2995,7 @@ <h4 id="_응답_25"><a class="link" href="#_응답_25">응답</a></h4>

[ {
"id" : 1,
"createdAt" : "2023-09-15T18:56:53",
"createdAt" : "2023-09-18T21:19:27",
"isMyMessage" : true,
"contents" : "메시지내용"
} ]</code></pre>
Expand Down Expand Up @@ -3188,7 +3145,7 @@ <h4 id="_응답_27"><a class="link" href="#_응답_27">응답</a></h4>
"id" : 1,
"name" : "회원1"
},
"createdTime" : "2023-09-15T18:56:55",
"createdTime" : "2023-09-18T21:19:29",
"auction" : {
"id" : 1,
"title" : "제목"
Expand All @@ -3200,7 +3157,7 @@ <h4 id="_응답_27"><a class="link" href="#_응답_27">응답</a></h4>
"id" : 2,
"name" : "회원2"
},
"createdTime" : "2023-09-15T18:56:55",
"createdTime" : "2023-09-18T21:19:29",
"auction" : {
"id" : 1,
"title" : "제목"
Expand All @@ -3212,7 +3169,7 @@ <h4 id="_응답_27"><a class="link" href="#_응답_27">응답</a></h4>
"id" : 3,
"name" : "회원3"
},
"createdTime" : "2023-09-15T18:56:55",
"createdTime" : "2023-09-18T21:19:29",
"auction" : {
"id" : 1,
"title" : "제목"
Expand Down Expand Up @@ -3376,7 +3333,7 @@ <h4 id="_응답_29"><a class="link" href="#_응답_29">응답</a></h4>
"id" : 1,
"name" : "회원1"
},
"createdTime" : "2023-09-15T18:56:55",
"createdTime" : "2023-09-18T21:19:29",
"chatRoom" : {
"id" : 1
},
Expand All @@ -3387,7 +3344,7 @@ <h4 id="_응답_29"><a class="link" href="#_응답_29">응답</a></h4>
"id" : 1,
"name" : "회원1"
},
"createdTime" : "2023-09-15T18:56:55",
"createdTime" : "2023-09-18T21:19:29",
"chatRoom" : {
"id" : 1
},
Expand All @@ -3398,7 +3355,7 @@ <h4 id="_응답_29"><a class="link" href="#_응답_29">응답</a></h4>
"id" : 1,
"name" : "회원1"
},
"createdTime" : "2023-09-15T18:56:55",
"createdTime" : "2023-09-18T21:19:29",
"chatRoom" : {
"id" : 1
},
Expand Down Expand Up @@ -3535,7 +3492,7 @@ <h4 id="_응답_30"><a class="link" href="#_응답_30">응답</a></h4>
<div id="footer">
<div id="footer-text">
Version 0.0.1-SNAPSHOT<br>
Last updated 2023-09-15 18:05:41 +0900
Last updated 2023-09-18 13:57:13 +0900
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/highlight.min.js"></script>
Expand Down
Loading

0 comments on commit 996290a

Please sign in to comment.