-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
43 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
src/main/java/com/example/busan/member/dto/UpdateProfileRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
package com.example.busan.member.dto; | ||
|
||
public record UpdateProfileRequest(String name, String company, String email) { | ||
import com.example.busan.member.domain.Region; | ||
|
||
public record UpdateProfileRequest(String name, String company, Region region) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,7 +154,7 @@ paths: | |
현재 유저 정보 조회하기: | ||
value: "{\"name\":\"연어\",\"phone\":\"01012341234\",\"email\":\"\ | ||
[email protected]\",\"role\":\"USER\",\"company\":\"우형\",\"region\"\ | ||
:\"BUSAN\",\"createdAt\":\"2023-11-29T02:23:02.327603\"}" | ||
:\"BUSAN\",\"createdAt\":\"2023-11-30T00:09:16.804123\"}" | ||
post: | ||
tags: | ||
- members | ||
|
@@ -216,16 +216,18 @@ paths: | |
put: | ||
tags: | ||
- members | ||
operationId: "회원 정보 수정하기 - 이름, 회사명, 이메일" | ||
operationId: "회원 정보 수정하기 - 이름, 회사명" | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/members-profile273689223' | ||
$ref: '#/components/schemas/members-profile-1939820512' | ||
examples: | ||
회원 정보 수정하기 - 이름, 회사명, 이메일: | ||
value: "{\"name\":\"name\",\"company\":\"company\",\"email\":\"[email protected]\"\ | ||
회원 정보 수정하기 - 이름, 회사명: | ||
value: "{\"name\":\"name\",\"company\":\"company\",\"region\":\"BUSAN\"\ | ||
}" | ||
회원 정보 수정하기 - 이름, 회사명, 이메일: | ||
value: "{\"name\":\"name\",\"company\":\"company\"}" | ||
responses: | ||
"204": | ||
description: "204" | ||
|
@@ -279,13 +281,13 @@ paths: | |
examples: | ||
자신의 회의실 예약 목록 최신 순으로 보기: | ||
value: "[{\"id\":1,\"status\":\"RESERVED\",\"cancelReason\":null,\"\ | ||
startTime\":\"2023-11-29T02:23:03.983094\",\"endTime\":\"2023-11-29T04:23:03.983099\"\ | ||
startTime\":\"2023-11-30T00:09:18.518235\",\"endTime\":\"2023-11-30T02:09:18.518239\"\ | ||
,\"name\":\"황재현\",\"phone\":\"01012341234\",\"reservedAt\":\"\ | ||
2023-11-29T02:23:03.98311\",\"roomId\":1,\"roomName\":\"대회의실\"\ | ||
2023-11-30T00:09:18.518249\",\"roomId\":1,\"roomName\":\"대회의실\"\ | ||
},{\"id\":2,\"status\":\"CANCELED\",\"cancelReason\":\"쓰기 싫어졌어\ | ||
요..\",\"startTime\":\"2023-11-29T02:23:03.98312\",\"endTime\"\ | ||
:\"2023-11-29T04:23:03.983122\",\"name\":\"황재현\",\"phone\":\"\ | ||
01012341234\",\"reservedAt\":\"2023-11-29T02:23:03.983124\",\"\ | ||
요..\",\"startTime\":\"2023-11-30T00:09:18.518257\",\"endTime\"\ | ||
:\"2023-11-30T02:09:18.518259\",\"name\":\"황재현\",\"phone\":\"\ | ||
01012341234\",\"reservedAt\":\"2023-11-30T00:09:18.518263\",\"\ | ||
roomId\":1,\"roomName\":\"대회의실\"}]" | ||
post: | ||
tags: | ||
|
@@ -378,6 +380,18 @@ paths: | |
}]}]" | ||
components: | ||
schemas: | ||
members-profile-1939820512: | ||
type: object | ||
properties: | ||
name: | ||
type: string | ||
description: 이름 | ||
company: | ||
type: string | ||
description: 회사명 | ||
region: | ||
type: string | ||
description: 지역 | ||
reservations-740649445: | ||
type: object | ||
properties: | ||
|
@@ -497,18 +511,6 @@ components: | |
name: | ||
type: string | ||
description: 회의실 이름 | ||
members-profile273689223: | ||
type: object | ||
properties: | ||
name: | ||
type: string | ||
description: 이름 | ||
company: | ||
type: string | ||
description: 회사명 | ||
email: | ||
type: string | ||
description: 이메일 | ||
members1182193868: | ||
type: object | ||
properties: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,19 +129,19 @@ void changeProfile() throws Exception { | |
//given | ||
httpSession.setAttribute(AUTHORIZATION, new Authentication("[email protected]", Role.ADMIN)); | ||
final String request = objectMapper.writeValueAsString( | ||
new UpdateProfileRequest("name", "company", "[email protected]")); | ||
new UpdateProfileRequest("name", "company", Region.BUSAN)); | ||
|
||
//when | ||
final MockHttpServletResponse response = mockMvc.perform( | ||
put("/members/profile").session(httpSession) | ||
.content(request) | ||
.contentType(MediaType.APPLICATION_JSON)) | ||
.andDo(print()) | ||
.andDo(document("회원 정보 수정하기 - 이름, 회사명, 이메일", | ||
.andDo(document("회원 정보 수정하기 - 이름, 회사명", | ||
requestFields( | ||
fieldWithPath("name").description("이름"), | ||
fieldWithPath("company").description("회사명"), | ||
fieldWithPath("email").description("이메일")))) | ||
fieldWithPath("region").description("지역"), | ||
fieldWithPath("company").description("회사명")))) | ||
.andReturn() | ||
.getResponse(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,18 +84,16 @@ private Member createMember() { | |
void updateProfile() { | ||
//given | ||
final Member member = createMember(); | ||
final UpdateProfileRequest request = new UpdateProfileRequest("updated", "updated", "[email protected]"); | ||
final UpdateProfileRequest request = new UpdateProfileRequest("updated", "updated", Region.BUSAN); | ||
|
||
//when | ||
memberService.updateProfile(member.getEmail(), request); | ||
|
||
//then | ||
final Member updated = memberRepository.findById("[email protected]").get(); | ||
final Member updated = memberRepository.findById(member.getEmail()).get(); | ||
assertSoftly(softAssertions -> { | ||
softAssertions.assertThat(updated.getEmail()).isEqualTo("[email protected]"); | ||
softAssertions.assertThat(updated.getCompany()).isEqualTo("updated"); | ||
softAssertions.assertThat(updated.getName()).isEqualTo("updated"); | ||
softAssertions.assertThat(memberRepository.findById(member.getEmail())).isEmpty(); | ||
}); | ||
} | ||
|
||
|