Compare commits

...

3 Commits

2 changed files with 18 additions and 7 deletions

19
pom.xml
View File

@ -5,17 +5,23 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.1</version> <version>2.7.1</version>
<relativePath/> <!-- lookup parent from repository --> <relativePath/> <!-- lookup parent from repository -->
</parent> </parent>
<groupId>org.sadtech.example</groupId> <groupId>org.sadtech.example</groupId>
<artifactId>swagger</artifactId> <artifactId>swagger</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<name>swagger</name> <name>swagger</name>
<description>Demo project for Swagger</description> <description>Demo project for Swagger</description>
<properties> <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> </properties>
<dependencies> <dependencies>
@ -27,12 +33,17 @@
<dependency> <dependency>
<groupId>io.swagger.core.v3</groupId> <groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId> <artifactId>swagger-annotations</artifactId>
<version>2.1.6</version> <version>2.2.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springdoc</groupId> <groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId> <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> </dependency>
</dependencies> </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.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; 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 org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
@ -36,8 +36,8 @@ public class PointController {
@Operation(summary = "Управление баллами", description = "Позволяет удалить или добавить баллы пользователю") @Operation(summary = "Управление баллами", description = "Позволяет удалить или добавить баллы пользователю")
public HttpStatus changePoints( public HttpStatus changePoints(
@PathVariable @NotBlank @Parameter(description = "Идентификатор пользователя") String key, @PathVariable @NotBlank @Parameter(description = "Идентификатор пользователя") String key,
@RequestPart("point") @Min(0) @Parameter(description = "Количество баллов", required = true) Long point, @RequestParam("point") @Min(0) @Parameter(description = "Количество баллов", required = true) Long point,
@RequestPart("type") @Parameter(description = "Тип операции", required = true) TypeOperation type @RequestParam("type") @Parameter(description = "Тип операции", required = true) TypeOperation type
) { ) {
final UserDto userDto = repository.get(key); final UserDto userDto = repository.get(key);
userDto.setPoints( userDto.setPoints(