Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class ScriptController {
*/
@GetMapping("/{userId}")
public ResponseEntity<List<ScriptEntity>> getScriptAll(@PathVariable Long userId){
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entity를 직접적으로 반환하는 부분에 대해서 Request, Response class 로 변경하는것에 대해서 고민해보시면 좋을것 같습니다


return scriptService.getScriptList(userId);
}

Expand All @@ -31,6 +32,7 @@ public ResponseEntity<List<ScriptEntity>> getScriptAll(@PathVariable Long userId
*/
@PostMapping("")
public ResponseEntity<ScriptEntity> addScript(@RequestBody ScriptEntity scriptEntity) {

return scriptService.addScript(scriptEntity);
}

Expand All @@ -42,6 +44,7 @@ public ResponseEntity<ScriptEntity> addScript(@RequestBody ScriptEntity scriptEn
@PutMapping("")
public ResponseEntity<ScriptEntity> updateScript(
@RequestBody ScriptEntity scriptEntity) {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entity를 Request 와 Response 로 쓰고 있는 부분에 대해서 각각의 Request, Response 파일로 변경도 해보시고, inner Class 를 사용하여 하는 방식으로 도 고민해봇기면 좋을것 같습니다 !

return scriptService.updateScript(scriptEntity);
} // 업데이트 시 내용 날아갈 수 있어 수정 필요

Expand All @@ -53,6 +56,7 @@ public ResponseEntity<ScriptEntity> updateScript(
@DeleteMapping("/{scriptId}")
public ResponseEntity<ScriptEntity> deleteScript(@PathVariable Long scriptId) {


scriptService.deleteScriptById(scriptId);
return ResponseEntity.ok().build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ public class ScriptEntity {
@JoinColumn(name = "user_id", nullable = false)
@JsonBackReference
private UserEntity user;

}