Добавлены классы для пакетов и паттернов
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package ru.serega6531.packmate.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import ru.serega6531.packmate.model.Packet;
|
||||
import ru.serega6531.packmate.service.PacketService;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/packet/")
|
||||
public class PacketController {
|
||||
|
||||
private final PacketService service;
|
||||
|
||||
@Autowired
|
||||
public PacketController(PacketService service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
@PostMapping("/all")
|
||||
public List<Packet> getPackets() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@PostMapping("/{stream}")
|
||||
public List<Packet> getStreams(@PathVariable int stream) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package ru.serega6531.packmate.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import ru.serega6531.packmate.model.Pattern;
|
||||
import ru.serega6531.packmate.service.PatternService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/pattern/")
|
||||
public class PatternController {
|
||||
|
||||
private final PatternService service;
|
||||
|
||||
@Autowired
|
||||
public PatternController(PatternService service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public List<Pattern> getPatterns() {
|
||||
return service.findAll();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public void deletePattern(@PathVariable int id) {
|
||||
service.deleteById(id);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public Pattern addPattern(@RequestBody Pattern pattern) {
|
||||
return service.save(pattern);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package ru.serega6531.packmate.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import ru.serega6531.packmate.model.CtfService;
|
||||
import ru.serega6531.packmate.service.ServicesService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/service/")
|
||||
public class ServiceController {
|
||||
|
||||
private final ServicesService service;
|
||||
|
||||
@Autowired
|
||||
public ServiceController(ServicesService service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public List<CtfService> getServices() {
|
||||
return service.findAll();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{port}")
|
||||
public void deleteService(@PathVariable int port) {
|
||||
service.deleteById(port);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public CtfService addService(@RequestBody CtfService ctfService) {
|
||||
return service.save(ctfService);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +1,34 @@
|
||||
package ru.serega6531.packmate.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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 ru.serega6531.packmate.service.StreamService;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/service/")
|
||||
public class StreamsController {
|
||||
@RequestMapping("/api/stream/")
|
||||
public class StreamController {
|
||||
|
||||
private final StreamService service;
|
||||
|
||||
@Autowired
|
||||
public StreamController(StreamService service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public List<Stream> getStreams() {
|
||||
return Collections.emptyList();
|
||||
return service.findAll();
|
||||
}
|
||||
|
||||
@GetMapping("/{port}")
|
||||
public List<Stream> getStreams(@PathVariable int port) {
|
||||
return Collections.emptyList();
|
||||
return service.findAllByServicePort(port);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user