Добавлено редактирование сервисов
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package ru.serega6531.packmate.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import ru.serega6531.packmate.model.Service;
|
||||
import ru.serega6531.packmate.repository.ServiceRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/service/manage")
|
||||
public class ServicesController {
|
||||
|
||||
private final ServiceRepository repository;
|
||||
|
||||
@Autowired
|
||||
public ServicesController(ServiceRepository repository) {
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public List<Service> getServices() {
|
||||
return repository.findAll();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{port}")
|
||||
public void deleteService(@PathVariable int port) {
|
||||
repository.deleteById(port);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public List<Service> addService(@RequestBody Service service) {
|
||||
repository.save(service);
|
||||
return getServices();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package ru.serega6531.packmate.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ru.serega6531.packmate.model.Stream;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/service/")
|
||||
public class StreamsController {
|
||||
|
||||
@GetMapping("/all")
|
||||
public List<Stream> getStreams() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@GetMapping("/{port}")
|
||||
public List<Stream> getStreams(@PathVariable int port) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user