Compare commits
1 Commits
406b1ebffd
...
fe7307ab6c
Author | SHA1 | Date | |
---|---|---|---|
fe7307ab6c |
8
pom.xml
8
pom.xml
@ -2,11 +2,10 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent -->
|
|
||||||
<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>3.3.5</version>
|
<version>3.0.2</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@ -18,7 +17,7 @@
|
|||||||
<description>Demo project for Swagger</description>
|
<description>Demo project for Swagger</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>21</java.version>
|
<java.version>17</java.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -27,11 +26,10 @@
|
|||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-starter-webmvc-ui -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springdoc</groupId>
|
<groupId>org.springdoc</groupId>
|
||||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||||
<version>2.6.0</version>
|
<version>2.0.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- jwt dependencies -->
|
<!-- jwt dependencies -->
|
||||||
|
@ -2,7 +2,6 @@ package org.sadtech.example.swagger.controller;
|
|||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
@ -37,12 +36,11 @@ public class PointController {
|
|||||||
|
|
||||||
@PostMapping("{key}")
|
@PostMapping("{key}")
|
||||||
@SecurityRequirement(name = "JWT")
|
@SecurityRequirement(name = "JWT")
|
||||||
@ApiResponse(responseCode = "400", description = "Неверный запрос — количество баллов должно быть неотрицательным")
|
|
||||||
@Operation(summary = "Управление баллами", description = "Позволяет удалить или добавить баллы пользователю")
|
@Operation(summary = "Управление баллами", description = "Позволяет удалить или добавить баллы пользователю")
|
||||||
public HttpStatus changePoints(
|
public HttpStatus changePoints(
|
||||||
@PathVariable @NotBlank @Parameter(description = "Идентификатор пользователя", example = "key1") String key,
|
@PathVariable @NotBlank @Parameter(description = "Идентификатор пользователя", example = "key1") String key,
|
||||||
@RequestParam("point") @Min(0) @Parameter(description = "Количество баллов", required = true, example = "100") Long point,
|
@RequestParam("point") @Min(0) @Parameter(description = "Количество баллов", required = true, example = "10") Long point,
|
||||||
@RequestParam("type") @Parameter(description = "Тип операции", required = true, example = "PLUS") TypeOperation type,
|
@RequestParam("type") @Parameter(description = "Тип операции", required = true) TypeOperation type,
|
||||||
HttpServletRequest request
|
HttpServletRequest request
|
||||||
) {
|
) {
|
||||||
final UserDto userDto = repository.get(key);
|
final UserDto userDto = repository.get(key);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package org.sadtech.example.swagger.controller;
|
package org.sadtech.example.swagger.controller;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.ExternalDocumentation;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.sadtech.example.swagger.dto.UserDto;
|
import org.sadtech.example.swagger.dto.UserDto;
|
||||||
@ -23,14 +22,7 @@ import static org.springframework.util.MimeTypeUtils.APPLICATION_JSON_VALUE;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/user")
|
@RequestMapping("/api/user")
|
||||||
@Tag(
|
@Tag(name = "Пользователи", description = "Взаимодействие с пользователями")
|
||||||
name = "User Controller",
|
|
||||||
description = "Контроллер для управления пользователями",
|
|
||||||
externalDocs = @ExternalDocumentation(
|
|
||||||
description = "Ссылка на общую документацию",
|
|
||||||
url = "https://example.com/docs/user-controller"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
public class UserController {
|
public class UserController {
|
||||||
|
|
||||||
private final Map<String, UserDto> repository;
|
private final Map<String, UserDto> repository;
|
||||||
|
Loading…
Reference in New Issue
Block a user