Compare commits

...

3 Commits

2 changed files with 18 additions and 7 deletions

19
pom.xml
View File

@ -5,17 +5,23 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.1</version>
<version>2.7.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>org.sadtech.example</groupId>
<artifactId>swagger</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>swagger</name>
<description>Demo project for Swagger</description>
<properties>
<java.version>1.8</java.version>
<java.version>17</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
@ -27,12 +33,17 @@
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.1.6</version>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.5.2</version>
<version>1.6.9</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
</dependencies>

View File

@ -10,7 +10,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.Min;
@ -36,8 +36,8 @@ public class PointController {
@Operation(summary = "Управление баллами", description = "Позволяет удалить или добавить баллы пользователю")
public HttpStatus changePoints(
@PathVariable @NotBlank @Parameter(description = "Идентификатор пользователя") String key,
@RequestPart("point") @Min(0) @Parameter(description = "Количество баллов", required = true) Long point,
@RequestPart("type") @Parameter(description = "Тип операции", required = true) TypeOperation type
@RequestParam("point") @Min(0) @Parameter(description = "Количество баллов", required = true) Long point,
@RequestParam("type") @Parameter(description = "Тип операции", required = true) TypeOperation type
) {
final UserDto userDto = repository.get(key);
userDto.setPoints(