Skip to content

Commit 526952f

Browse files
committed
feat: add delete user by auth method
1 parent 176ff93 commit 526952f

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

rentplace/src/main/java/kattsyn/dev/rentplace/controllers/UserController.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,23 @@ public ResponseEntity<Void> deleteUser(
171171
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
172172
}
173173

174+
@Operation(
175+
summary = "Удалить свой профиль",
176+
description = "Метод, чтобы пользователь мог удалить свой профиль."
177+
)
178+
@DeleteMapping("/me")
179+
@ApiResponses(value = {
180+
@ApiResponse(responseCode = "204", description = "Успешно. Пустой ответ", content = @Content),
181+
@ApiResponse(responseCode = "404", description = "Пользователь не найден", content = @Content),
182+
@ApiResponse(responseCode = "422", description = "Ошибка валидации", content = @Content),
183+
@ApiResponse(responseCode = "500", description = "Непредвиденная ошибка со стороны сервера", content = @Content)
184+
})
185+
@SecurityRequirement(name = "JWT")
186+
public ResponseEntity<Void> deleteMe(
187+
Authentication authentication
188+
) {
189+
userService.deleteMe(authentication);
190+
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
191+
}
192+
174193
}

0 commit comments

Comments
 (0)