Skip to content

Commit

Permalink
feat: #119-헬퍼 매칭글 생성 Controller 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueBerrySoda committed May 2, 2024
1 parent e99df3f commit edc4609
Showing 1 changed file with 27 additions and 1 deletion.
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));
}


}

0 comments on commit edc4609

Please sign in to comment.