Skip to content

Commit 6e85c87

Browse files
authored
feat: 테스트용 API 추가 (#110)
1 parent c3a35ec commit 6e85c87

File tree

1 file changed

+51
-15
lines changed

1 file changed

+51
-15
lines changed

backend/src/main/java/com/back/domain/member/controller/ApiV1MemberController.java

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class ApiV1MemberController {
2323
private final Rq rq;
2424

2525
@PostMapping("/signup")
26-
@Operation(summary = "회원 가입(일반 계정)", description = "일반 계정(소셜 X) 회원 가입")
26+
@Operation(summary = "[Test] 회원 가입(일반 계정)", description = "일반 계정(소셜 X) 회원 가입")
2727
public ResponseEntity<ApiResponse<MemberDto>> signup(
2828
@Valid @RequestBody SignupReqDto reqBody
2929
) {
@@ -40,7 +40,7 @@ public ResponseEntity<ApiResponse<MemberDto>> signup(
4040
}
4141

4242
@PostMapping("/login")
43-
@Operation(summary = "로그인(일반 계정)", description = "일반 계정(소셜 X) 로그인")
43+
@Operation(summary = "[Test] 로그인(일반 계정)", description = "일반 계정(소셜 X) 로그인")
4444
public ResponseEntity<ApiResponse<LoginResDto>> login(
4545
@Valid @RequestBody LoginReqDto reqBody
4646
) {
@@ -116,6 +116,29 @@ public ResponseEntity<ApiResponse<MemberDto>> valid_set(
116116
);
117117
}
118118

119+
@DeleteMapping("/delete")
120+
@Operation(summary = "회원 탈퇴", description = "회원 탈퇴")
121+
public ResponseEntity<ApiResponse<Void>> delete() {
122+
Member actor = rq.getActorFromDb();
123+
String email = actor.getEmail();
124+
125+
if(actor.getSocialAccessToken() != null) {
126+
memberService.delete_social(actor);
127+
}
128+
memberService.delete(actor);
129+
rq.deleteCookie("apiKey");
130+
rq.deleteCookie("accessToken");
131+
rq.deleteCookie("JSESSIONID");
132+
133+
return ResponseEntity
134+
.status(HttpStatus.OK)
135+
.body(new ApiResponse<>(
136+
"200",
137+
"[Member] Success: 회원 탈퇴 (%s)".formatted(email)
138+
)
139+
);
140+
}
141+
119142
@PutMapping("/modify/profile")
120143
@Operation(summary = "회원 정보 수정", description = "닉네임, 생년월일, 성별 수정")
121144
public ResponseEntity<ApiResponse<MemberDto>> modifyProfile(
@@ -136,7 +159,7 @@ public ResponseEntity<ApiResponse<MemberDto>> modifyProfile(
136159

137160
public record PasswordReqDto(String password) {}
138161
@PutMapping("/modify/password")
139-
@Operation(summary = "비밀번호 변경(일반 계정)", description = "비밀번호 변경")
162+
@Operation(summary = "[Test] 비밀번호 변경", description = "비밀번호 변경")
140163
public ResponseEntity<ApiResponse<Void>> modifyPassword(
141164
@Valid @RequestBody PasswordReqDto reqBody
142165
) {
@@ -268,25 +291,38 @@ public ResponseEntity<ApiResponse<MemberDto>> unequipTitle() {
268291
);
269292
}
270293

271-
@DeleteMapping("/delete")
272-
@Operation(summary = "회원 탈퇴", description = "회원 탈퇴")
273-
public ResponseEntity<ApiResponse<Void>> delete() {
294+
@PutMapping("/obtain/item/{id}")
295+
@Operation(summary = "[Test] 아이템 획득", description = "아이템 획득")
296+
public ResponseEntity<ApiResponse<MemberDto>> obtainItem(
297+
@PathVariable String id
298+
) {
274299
Member actor = rq.getActorFromDb();
275-
String email = actor.getEmail();
300+
memberService.addItem(actor, Integer.parseInt(id));
276301

277-
if(actor.getSocialAccessToken() != null) {
278-
memberService.delete_social(actor);
279-
}
280-
memberService.delete(actor);
281-
rq.deleteCookie("apiKey");
282-
rq.deleteCookie("accessToken");
283-
rq.deleteCookie("JSESSIONID");
302+
return ResponseEntity
303+
.status(HttpStatus.OK)
304+
.body(new ApiResponse<>(
305+
"200",
306+
"[Member] Success: 아이템 획득",
307+
new MemberDto(actor)
308+
)
309+
);
310+
}
311+
312+
@PutMapping("/obtain/title/{id}")
313+
@Operation(summary = "[Test] 칭호 획득", description = "칭호 획득")
314+
public ResponseEntity<ApiResponse<MemberDto>> obtainTitle(
315+
@PathVariable String id
316+
) {
317+
Member actor = rq.getActorFromDb();
318+
memberService.addTitle(actor, Integer.parseInt(id));
284319

285320
return ResponseEntity
286321
.status(HttpStatus.OK)
287322
.body(new ApiResponse<>(
288323
"200",
289-
"[Member] Success: 회원 탈퇴 (%s)".formatted(email)
324+
"[Member] Success: 칭호 획득",
325+
new MemberDto(actor)
290326
)
291327
);
292328
}

0 commit comments

Comments
 (0)