|
1 | 1 | package com.chat.yourway.controller;
|
2 | 2 |
|
3 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.ALREADY_SUBSCRIBED; |
4 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.CONTACT_UNAUTHORIZED; |
5 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.CONTACT_WASNT_SUBSCRIBED; |
6 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.INVALID_VALUE; |
7 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.OWNER_CANT_UNSUBSCRIBED; |
8 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.RECIPIENT_EMAIL_NOT_EXIST; |
9 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.SEARCH_TOPIC_VALIDATION; |
10 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.SUCCESSFULLY_ADD_TOPIC_TO_FAVOURITE; |
11 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.SUCCESSFULLY_CREATED_TOPIC; |
12 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.SUCCESSFULLY_DELETE_TOPIC; |
13 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.SUCCESSFULLY_FOUND_TOPIC; |
14 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.SUCCESSFULLY_REMOVE_TOPIC_FROM_FAVOURITE; |
15 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.SUCCESSFULLY_SUBSCRIBED; |
16 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.SUCCESSFULLY_UNSUBSCRIBED; |
17 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.SUCCESSFULLY_UPDATED_TOPIC; |
18 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.TOPIC_NOT_ACCESS; |
19 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.TOPIC_NOT_FOUND; |
20 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.USER_DID_NOT_SUBSCRIBED_TO_TOPIC; |
21 |
| -import static com.chat.yourway.config.openapi.OpenApiMessages.VALUE_NOT_UNIQUE; |
| 3 | +import static com.chat.yourway.config.openapi.OpenApiMessages.*; |
22 | 4 | import static java.nio.charset.StandardCharsets.UTF_8;
|
23 | 5 | import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
24 | 6 |
|
@@ -355,5 +337,27 @@ public List<TopicResponseDto> findAllPopularPublicTopics() {
|
355 | 337 | return topicService.findPopularPublicTopics();
|
356 | 338 | }
|
357 | 339 |
|
| 340 | + @Operation( |
| 341 | + summary = "Complain topic", |
| 342 | + responses = { |
| 343 | + @ApiResponse(responseCode = "204", description = SUCCESSFULLY_COMPLAIN_TOPIC), |
| 344 | + @ApiResponse( |
| 345 | + responseCode = "403", |
| 346 | + description = CONTACT_UNAUTHORIZED, |
| 347 | + content = @Content(schema = @Schema(implementation = ApiErrorResponseDto.class))), |
| 348 | + @ApiResponse( |
| 349 | + responseCode = "404", |
| 350 | + description = TOPIC_NOT_FOUND, |
| 351 | + content = @Content(schema = @Schema(implementation = ApiErrorResponseDto.class))), |
| 352 | + @ApiResponse( |
| 353 | + responseCode = "409", |
| 354 | + description = USER_DID_NOT_SUBSCRIBED_TO_TOPIC, |
| 355 | + content = @Content(schema = @Schema(implementation = ApiErrorResponseDto.class))) |
| 356 | + }) |
| 357 | + @PatchMapping("/{topic-id}/complain") |
| 358 | + @ResponseStatus(HttpStatus.NO_CONTENT) |
| 359 | + public void complainTopic(@AuthenticationPrincipal UserDetails userDetails, @PathVariable("topic-id") Integer topicId) { |
| 360 | + topicSubscriberService.complainTopic(topicId, userDetails); |
| 361 | + } |
358 | 362 |
|
359 | 363 | }
|
0 commit comments