forked from kookmin-sw/cap-template
-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
e99df3f
commit edc4609
Showing
1 changed file
with
27 additions
and
1 deletion.
There are no files selected for viewing
28 changes: 27 additions & 1 deletion
28
back/src/main/java/com/example/capstone/domain/help/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 |
---|---|---|
@@ -1,13 +1,39 @@ | ||
package com.example.capstone.domain.help.controller; | ||
|
||
import com.example.capstone.domain.help.dto.*; | ||
import com.example.capstone.domain.help.service.HelpService; | ||
import com.example.capstone.domain.jwt.JwtTokenProvider; | ||
import com.example.capstone.global.dto.ApiResult; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.UUID; | ||
|
||
@Controller | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/help") | ||
public class HelpController { | ||
|
||
private final HelpService helpService; | ||
private final JwtTokenProvider jwtTokenProvider; | ||
|
||
@PostMapping(value = "/create") | ||
@Operation(summary = "헬퍼글 생성", description = "request 정보를 기반으로 헬퍼글을 생성합니다.") | ||
@ApiResponse(responseCode = "200", description = "request 정보를 기반으로 생성된 헬퍼글을 반환됩니다.") | ||
public ResponseEntity<ApiResult<HelpResponse>> createHelp( | ||
@Parameter(description = "헬퍼 모집글의 구성 요소 입니다. 제목, 작성자, 본문, 국가 정보가 들어가야 합니다.", required = true) | ||
@RequestBody HelpPostRequest request) { | ||
String userId = UUID.randomUUID().toString();//jwtTokenProvider.extractUUID(token); | ||
HelpResponse helpResponse = helpService.createHelp(userId, request); | ||
|
||
return ResponseEntity | ||
.ok(new ApiResult<>("Successfully create help", helpResponse)); | ||
} | ||
|
||
|
||
} |