Skip to content

Commit

Permalink
add endpoint to ZeppelinController
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed Jan 17, 2024
1 parent 998c398 commit 945a5dd
Showing 1 changed file with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package com.yen.FlinkRestService.Controller;

import com.yen.FlinkRestService.Service.ZeppelinService;
import com.yen.FlinkRestService.model.Job;
import com.yen.FlinkRestService.model.Notebook;
import com.yen.FlinkRestService.model.dto.zeppelin.AddParagraphDto;
import com.yen.FlinkRestService.model.dto.zeppelin.CreateNoteDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/zeppelin")
Expand All @@ -16,7 +19,21 @@ public class ZeppelinController {
@Autowired
private ZeppelinService zeppelinService;

@PostMapping("/create")
@GetMapping("/")
public ResponseEntity<List<Notebook>> getAllNotebooks(){

List<Notebook> notebooks = zeppelinService.getNotebooks();
return new ResponseEntity<>(notebooks, HttpStatus.OK);
}

@GetMapping("/{notebookId}")
public ResponseEntity<Notebook> getJobByJobId(@PathVariable("notebookId") Integer notebookId){

Notebook notebook = zeppelinService.getNotebookById(notebookId);
return new ResponseEntity<>(notebook, HttpStatus.OK);
}

@PostMapping("/add")
public String createNotebook(@RequestBody CreateNoteDto createNoteDto){

String res = zeppelinService.createNote(createNoteDto);
Expand Down

0 comments on commit 945a5dd

Please sign in to comment.