-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrainerProfileController.java
More file actions
48 lines (40 loc) · 1.62 KB
/
TrainerProfileController.java
File metadata and controls
48 lines (40 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.demo.pteam.trainer.profile.controller;
import com.demo.pteam.global.response.ApiResponse;
import com.demo.pteam.trainer.profile.controller.dto.TrainerProfileRequest;
import com.demo.pteam.trainer.profile.service.TrainerProfileService;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/trainers/me/profile")
public class TrainerProfileController {
private final TrainerProfileService trainerProfileService;
/**
* 트레이너 프로필 등록 API
* @param request 트레이너 프로필 요청 DTO
* @return 등록 성공 여부
*/
@PostMapping
public ResponseEntity<ApiResponse<Void>> createProfile(
@RequestBody @Valid TrainerProfileRequest request
) {
Long userId = 4L; // TODO: 로그인 사용자 임시
trainerProfileService.createProfile(request, userId);
return ResponseEntity.status(201).body(ApiResponse.created("트레이너 프로필이 성공적으로 등록되었습니다."));
}
/**
* 트레이너 프로필 수정 API
* @param request 트레이너 프로필 요청 DTO
* @return 수정 성공 여부
*/
@PutMapping
public ResponseEntity<ApiResponse<Void>> updateProfile(
@RequestBody @Valid TrainerProfileRequest request
) {
Long userId = 3L; // TODO: 로그인 사용자 임시
trainerProfileService.updateProfile(request, userId);
return ResponseEntity.ok(ApiResponse.success("트레이너 프로필이 성공적으로 수정되었습니다."));
}
}