diff --git a/back/src/main/java/com/example/capstone/domain/help/controller/HelpController.java b/back/src/main/java/com/example/capstone/domain/help/controller/HelpController.java index d690f13b2f..904d3b098f 100644 --- a/back/src/main/java/com/example/capstone/domain/help/controller/HelpController.java +++ b/back/src/main/java/com/example/capstone/domain/help/controller/HelpController.java @@ -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> 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)); + } + }