-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from donggukthon/dev
✨ [Feat] Swagger를 등록합니다.
- Loading branch information
Showing
31 changed files
with
673 additions
and
264 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
66 changes: 66 additions & 0 deletions
66
src/main/java/donggukthon/volunmate/controller/HelpController.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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package donggukthon.volunmate.controller; | ||
|
||
import donggukthon.volunmate.annotation.SocialId; | ||
import donggukthon.volunmate.dto.exception.ResponseDto; | ||
import donggukthon.volunmate.dto.help.*; | ||
import donggukthon.volunmate.service.HelpService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.annotation.Nullable; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.*; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/help") | ||
@Tag(name = "Help", description = "도와주세요 요청 관련 API입니다.") | ||
public class HelpController { | ||
private final HelpService helpService; | ||
|
||
@Operation(summary = "도움 요청 생성", description = "도움 요청을 생성합니다.") | ||
@PostMapping(consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.MULTIPART_FORM_DATA_VALUE}) | ||
public ResponseDto<Boolean> createHelp(@SocialId String socialId, | ||
@RequestPart("data") CreateHelpDto createHelpDto, | ||
@Nullable @RequestPart("file") MultipartFile imageFile) { | ||
return ResponseDto.created(helpService.createHelp(socialId, createHelpDto, imageFile)); | ||
} | ||
|
||
@Operation(summary = "도움 요청 리스트 조회", description = "도움 요청 리스트를 조회합니다.") | ||
@GetMapping | ||
public ResponseDto<HelpListDto> getHelp(@SocialId String socialId){ | ||
return ResponseDto.ok(helpService.getHelpList(socialId)); | ||
} | ||
|
||
@Operation(summary = "긴급 도움 요청 리스트 조회", description = "긴급 도움 요청 리스트를 조회합니다.") | ||
@GetMapping("/em") | ||
public ResponseDto<EmergencyHelpListDto> getEmergencyHelp(@SocialId String socialId){ | ||
return ResponseDto.ok(helpService.getEmergencyHelpList(socialId)); | ||
} | ||
|
||
@Operation(summary = "도움 요청 상세 조회", description = "도움 요청 상세 정보를 조회합니다.") | ||
@GetMapping("/{helpId}") | ||
public ResponseDto<ResponseHelpDetailDto> getHelpDetail(@PathVariable Long helpId){ | ||
return ResponseDto.ok(helpService.getHelpDetail(helpId)); | ||
} | ||
|
||
@Operation(summary = "도움 요청 수정", description = "도움 요청을 수정합니다.") | ||
@PatchMapping("/{helpId}") | ||
public ResponseDto<Boolean> helpUpdate(@SocialId String socialId, | ||
@RequestPart("data") CreateHelpDto createHelpDto, | ||
@Nullable @RequestPart("file") MultipartFile imageFile, | ||
@PathVariable Long helpId) { | ||
return ResponseDto.ok(helpService.helpUpdate(socialId, createHelpDto, imageFile, helpId)); | ||
} | ||
|
||
@Operation(summary = "도움 요청 삭제", description = "도움 요청을 삭제합니다.") | ||
@DeleteMapping("/{helpId}") | ||
public ResponseDto<Boolean> helpDelete(@SocialId String socialId, | ||
@PathVariable Long helpId){ | ||
return ResponseDto.ok(helpService.helpDelete(socialId, helpId)); | ||
} | ||
|
||
} |
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
86 changes: 43 additions & 43 deletions
86
src/main/java/donggukthon/volunmate/controller/VolunteerController.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,74 +1,74 @@ | ||
package donggukthon.volunmate.controller; | ||
|
||
import donggukthon.volunmate.annotation.SocialId; | ||
import donggukthon.volunmate.dto.CreateVolunteerDto; | ||
import donggukthon.volunmate.dto.RequestVolunteerSignDto; | ||
import donggukthon.volunmate.dto.ResponseVolunteerDetailDto; | ||
import donggukthon.volunmate.dto.ResponseVolunteerDto; | ||
import donggukthon.volunmate.dto.volunteer.request.CreateVolunteerDto; | ||
import donggukthon.volunmate.dto.volunteer.request.VolunteerSignDto; | ||
import donggukthon.volunmate.dto.volunteer.response.VolunteerDetailDto; | ||
import donggukthon.volunmate.dto.exception.ResponseDto; | ||
import donggukthon.volunmate.dto.volunteer.response.VolunteerListDto; | ||
import donggukthon.volunmate.service.VolunteerService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.annotation.Nullable; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.hibernate.annotations.Fetch; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.io.File; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/team") | ||
@Tag(name = "Volunteer", description = "봉사활동 관련 API") | ||
public class VolunteerController { | ||
|
||
private final VolunteerService volunteerService; | ||
|
||
@PostMapping("") | ||
public ResponseDto<Boolean> createVolunteer(@SocialId String socialId, @RequestBody CreateVolunteerDto createVolunteerDto, | ||
@Nullable @RequestPart("file") File imageFile) { | ||
|
||
return ResponseDto.ok(volunteerService.createVolunteer(socialId,createVolunteerDto,imageFile)); | ||
@Operation(summary = "봉사활동 생성", description = "봉사활동 정보와 이미지를 통해 봉사활동을 생성힙니다.") | ||
@PostMapping(consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.MULTIPART_FORM_DATA_VALUE}) | ||
public ResponseDto<Boolean> createVolunteer(@SocialId String socialId, | ||
@RequestPart("image") MultipartFile image, | ||
@RequestPart("data") CreateVolunteerDto createVolunteerDto) { | ||
return ResponseDto.ok(volunteerService.createVolunteer(socialId, createVolunteerDto, image)); | ||
} | ||
|
||
@PostMapping("/{team_id}") | ||
public ResponseDto<Boolean> volunteerSignUp(@SocialId String socialId, @PathVariable Long team_id, | ||
@RequestBody RequestVolunteerSignDto requestVolunteerSignDto) { | ||
|
||
return ResponseDto.ok(volunteerService.volunteerSignUp(socialId,team_id,requestVolunteerSignDto)); | ||
@Operation(summary = "봉사활동 리스트 조회", description = "봉사활동 리스트를 조회합니다.") | ||
@GetMapping | ||
public ResponseDto<VolunteerListDto> volunteerHeart(@SocialId String socialId) { | ||
return ResponseDto.ok(volunteerService.getVolunteerList(socialId)); | ||
} | ||
|
||
@PostMapping("/{team_id}/heart") | ||
public ResponseDto<Boolean> volunteerHeart(@SocialId String socialId, @PathVariable Long team_id) { | ||
@Operation(summary = "봉사활동 상세 조회", description = "봉사활동 상세 정보를 조회합니다.") | ||
@GetMapping("/{teamId}") | ||
public ResponseDto<VolunteerDetailDto> volunteerHeart(@PathVariable Long teamId) { | ||
|
||
return ResponseDto.ok(volunteerService.volunteerHeart(socialId,team_id)); | ||
return ResponseDto.ok(volunteerService.getVolunteerDetail(teamId)); | ||
} | ||
@GetMapping("") | ||
public ResponseDto<List<ResponseVolunteerDto>> volunteerHeart(@SocialId String socialId) { | ||
|
||
return ResponseDto.ok(volunteerService.getVolunteerList(socialId)); | ||
@Operation(summary = "봉사활동 신청", description = "봉사활동에 신청합니다. 자신이 생성한 봉사는 참가할 수 없습니다.") | ||
@PostMapping("/{teamId}") | ||
public ResponseDto<Boolean> volunteerSignUp(@SocialId String socialId, @PathVariable Long teamId, | ||
@RequestBody VolunteerSignDto volunteerSignDto) { | ||
return ResponseDto.ok(volunteerService.volunteerSignUp(socialId, teamId, volunteerSignDto)); | ||
} | ||
|
||
@GetMapping("/{team_id}") | ||
public ResponseDto<ResponseVolunteerDetailDto> volunteerHeart(@PathVariable Long team_id) { | ||
|
||
return ResponseDto.ok(volunteerService.getVolunteerDetail(team_id)); | ||
@Operation(summary = "봉사활동 좋아요하기", description = "내가 관심이 가는 봉사활동에 좋아요를 누릅니다.") | ||
@PostMapping("/{teamId}/heart") | ||
public ResponseDto<Boolean> volunteerHeart(@SocialId String socialId, @PathVariable Long teamId) { | ||
return ResponseDto.ok(volunteerService.volunteerHeart(socialId, teamId)); | ||
} | ||
|
||
@DeleteMapping("/{team_id}") | ||
public ResponseDto<Boolean> volunteerDelete(@SocialId String socialId, @PathVariable Long team_id) { | ||
|
||
return ResponseDto.ok(volunteerService.volunteerDelete(socialId,team_id)); | ||
@Operation(summary = "봉사활동 글을 삭제", description = "내가 생성한 봉사활동 글을 삭제합니다.") | ||
@DeleteMapping("/{teamId}") | ||
public ResponseDto<Boolean> volunteerDelete(@SocialId String socialId, @PathVariable Long teamId) { | ||
return ResponseDto.ok(volunteerService.volunteerDelete(socialId, teamId)); | ||
} | ||
|
||
@PatchMapping("/{team_id}") | ||
public ResponseDto<Boolean> volunteerUpdate(@SocialId String socialId, @RequestBody CreateVolunteerDto createVolunteerDto, | ||
@Nullable @RequestPart("file") File imageFile,@PathVariable Long team_id) { | ||
|
||
return ResponseDto.ok(volunteerService.volunteerUpdate(socialId,createVolunteerDto,imageFile,team_id)); | ||
@Operation(summary = "봉사활동 글을 수정", description = "내가 생성한 봉사활동 글을 수정합니다.") | ||
@PatchMapping(value = "/{teamId}", consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.MULTIPART_FORM_DATA_VALUE}) | ||
public ResponseDto<Boolean> volunteerUpdate(@SocialId String socialId, | ||
@RequestPart("data") CreateVolunteerDto createVolunteerDto, | ||
@Nullable @RequestPart("image") MultipartFile imageFile, | ||
@PathVariable Long teamId) { | ||
return ResponseDto.ok(volunteerService.volunteerUpdate(socialId, createVolunteerDto, imageFile, teamId)); | ||
} | ||
|
||
|
||
|
||
} |
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
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
Oops, something went wrong.