Skip to content
Snippets Groups Projects
Commit 4f342c19 authored by Martin Bartoš's avatar Martin Bartoš
Browse files

Add Person Controller

parent 7e4ad684
No related branches found
No related tags found
2 merge requests!44Merge 'devel' branch,!36First REST integration
......@@ -34,6 +34,7 @@
<module>api</module>
<module>services</module>
<module>persistence</module>
<module>rest</module>
</modules>
<dependencies>
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>movie-recommender</artifactId>
<groupId>cz.fi.muni.pa165.theta</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>rest</artifactId>
<dependencies>
<dependency>
<groupId>cz.fi.muni.pa165.theta</groupId>
<artifactId>api</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cz.fi.muni.pa165.theta</groupId>
<artifactId>services</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
</project>
\ No newline at end of file
package cz.fi.muni.pa165.theta.rest.api;
import cz.fi.muni.pa165.movierecommender.api.dto.PersonDto;
import cz.fi.muni.pa165.movierecommender.api.dto.create.PersonCreateDto;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController("/persons")
public interface PersonController {
@GetMapping
@ResponseBody
List<PersonDto> findAll();
@GetMapping("/{id}")
@ResponseBody
PersonDto findById(@PathVariable Long id);
@GetMapping("/search")
@ResponseBody
PersonDto findByName(@RequestParam String name);
@GetMapping("/count")
@ResponseBody
Long getCount();
@PostMapping
@ResponseBody
PersonDto create(@RequestBody PersonCreateDto createDto);
@DeleteMapping("{id}")
@ResponseBody
void delete(@PathVariable Long id);
@PatchMapping("/{id}")
@ResponseBody
PersonDto update(@PathVariable Long id, @RequestBody PersonDto person);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment