-
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.
- Loading branch information
1 parent
2ddcb2d
commit 5ecb79a
Showing
18 changed files
with
584 additions
and
86 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
71 changes: 32 additions & 39 deletions
71
src/main/java/com/example/umc3_teamproject/controller/RecordController.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,53 +1,46 @@ | ||
package com.example.umc3_teamproject.controller; | ||
import com.example.umc3_teamproject.domain.dto.request.RecordScriptRequestDto; | ||
import com.example.umc3_teamproject.domain.dto.request.ScriptRequestDto; | ||
import com.example.umc3_teamproject.domain.dto.response.RecordScriptResponseDto; | ||
import com.example.umc3_teamproject.domain.dto.response.ScriptResponseDto; | ||
import com.example.umc3_teamproject.domain.item.RecordScript; | ||
import com.example.umc3_teamproject.domain.item.Script; | ||
import com.example.umc3_teamproject.repository.RecordRespository; | ||
import com.example.umc3_teamproject.repository.ScriptRepository; | ||
import com.example.umc3_teamproject.service.RecordScriptService; | ||
import com.example.umc3_teamproject.service.ScriptService; | ||
|
||
import com.example.umc3_teamproject.config.resTemplate.ResponseException; | ||
import com.example.umc3_teamproject.config.resTemplate.ResponseTemplate; | ||
import com.example.umc3_teamproject.domain.dto.request.ForumRequestDto; | ||
import com.example.umc3_teamproject.domain.dto.request.RecordRequestDto; | ||
import com.example.umc3_teamproject.domain.dto.response.ForumResponseDto; | ||
import com.example.umc3_teamproject.domain.dto.response.RecordMemoResponseDto; | ||
import com.example.umc3_teamproject.domain.dto.response.RecordResponseDto; | ||
import com.example.umc3_teamproject.service.RecordService; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.*; | ||
import reactor.netty.http.server.HttpServerRequest; | ||
|
||
import java.util.Optional; | ||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
@Slf4j | ||
@RestController // Json 형태로 객체 데이터를 반환 (@Controller + @ResponseBody) | ||
@RequestMapping("/script") | ||
@RestController | ||
@RequiredArgsConstructor | ||
@Api(tags = {"Record Api"}) | ||
@Api(tags = {"Forum Api"}) | ||
@RequestMapping("/record/{script-or-interview}/{script_id-or-interview_id}") | ||
public class RecordController { | ||
|
||
private final RecordScriptService recordscriptService; | ||
private final RecordRespository recordscriptRepository; | ||
|
||
private final RecordScriptResponseDto recordscriptResponseDto; | ||
|
||
|
||
@PostMapping("/addRecord") | ||
public ResponseEntity<?> recordScript(@RequestBody RecordScriptRequestDto.Register record_script ){ | ||
private final RecordService recordService; | ||
|
||
return recordscriptService.recordScript(record_script); | ||
@ApiOperation(value = "record 저장", notes = "결과를 저장한다.") | ||
@PostMapping("/new") | ||
public ResponseTemplate<RecordResponseDto.Body> createRecord( | ||
@PathVariable("script-or-interview") String script_or_interview, | ||
@PathVariable("script_id-or-interview_id") long id, | ||
@Validated @RequestBody RecordRequestDto.createRecordRequest request) throws IOException, ResponseException { | ||
return recordService.createRecord(script_or_interview,id,request); | ||
} | ||
|
||
|
||
|
||
@GetMapping("/record/{id}") | ||
public ResponseEntity<?> readRecordScriptById(@PathVariable("id") Long id) { | ||
|
||
|
||
Optional<RecordScript> optionalProduct=recordscriptRepository.findById(id); | ||
if (optionalProduct.isPresent()) { | ||
RecordScript record_script1 = optionalProduct.get(); | ||
return recordscriptResponseDto.success(record_script1); | ||
} | ||
return null; | ||
@ApiOperation(value = "결과 페이지 생성", notes = "결과를 보여준다.") | ||
@GetMapping("") | ||
public ResponseTemplate<RecordMemoResponseDto.Body> getRecord( | ||
@PathVariable("script-or-interview") String script_or_interview, | ||
@PathVariable("script_id-or-interview_id") long id) throws IOException, ResponseException { | ||
return recordService.getRecord(script_or_interview, id); | ||
} | ||
|
||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/com/example/umc3_teamproject/controller/RecordScriptController.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,48 @@ | ||
package com.example.umc3_teamproject.controller; | ||
import com.example.umc3_teamproject.domain.dto.request.RecordScriptRequestDto; | ||
import com.example.umc3_teamproject.domain.dto.response.RecordScriptResponseDto; | ||
import com.example.umc3_teamproject.domain.item.RecordScript; | ||
import com.example.umc3_teamproject.repository.RecordRespository; | ||
import com.example.umc3_teamproject.service.RecordScriptService; | ||
import io.swagger.annotations.Api; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.Optional; | ||
|
||
@Slf4j | ||
@RestController // Json 형태로 객체 데이터를 반환 (@Controller + @ResponseBody) | ||
@RequestMapping("/script") | ||
@RequiredArgsConstructor | ||
@Api(tags = {"Record Api"}) | ||
public class RecordScriptController { | ||
|
||
private final RecordScriptService recordscriptService; | ||
private final RecordRespository recordscriptRepository; | ||
|
||
private final RecordScriptResponseDto recordscriptResponseDto; | ||
|
||
|
||
@PostMapping("/addRecord") | ||
public ResponseEntity<?> recordScript(@RequestBody RecordScriptRequestDto.Register record_script ){ | ||
|
||
return recordscriptService.recordScript(record_script); | ||
} | ||
|
||
|
||
|
||
@GetMapping("/record/{id}") | ||
public ResponseEntity<?> readRecordScriptById(@PathVariable("id") Long id) { | ||
|
||
|
||
Optional<RecordScript> optionalProduct=recordscriptRepository.findById(id); | ||
if (optionalProduct.isPresent()) { | ||
RecordScript record_script1 = optionalProduct.get(); | ||
return recordscriptResponseDto.success(record_script1); | ||
} | ||
return null; | ||
} | ||
|
||
} |
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
26 changes: 26 additions & 0 deletions
26
src/main/java/com/example/umc3_teamproject/domain/dto/request/RecordRequestDto.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,26 @@ | ||
package com.example.umc3_teamproject.domain.dto.request; | ||
|
||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class RecordRequestDto { | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public static class createRecordRequest { | ||
private double score1; | ||
private double score2; | ||
private double score3; | ||
private double score4; | ||
private double score5; | ||
private int elapsed_minute; | ||
private int elapsed_second; | ||
} | ||
} |
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
22 changes: 22 additions & 0 deletions
22
src/main/java/com/example/umc3_teamproject/domain/dto/response/RecordMemoResponseDto.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,22 @@ | ||
package com.example.umc3_teamproject.domain.dto.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
public class RecordMemoResponseDto { | ||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public static class Body { | ||
// sciprt와 intervie 구분 | ||
private int result_count; | ||
private double mean; | ||
private int total_elapsed_minute; | ||
private int toal_elapsed_second; | ||
private List<RecordResponseDto.Body> records; | ||
private List<MemoResponseDto.createBody> memoList; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/com/example/umc3_teamproject/domain/dto/response/RecordResponseDto.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,25 @@ | ||
package com.example.umc3_teamproject.domain.dto.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
public class RecordResponseDto { | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public static class Body { | ||
|
||
// sciprt와 intervie 구분 | ||
private int result_count; | ||
private double mean; | ||
private double score1; | ||
private double score2; | ||
private double score3; | ||
private double score4; | ||
private double score5; | ||
} | ||
} |
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.