feat(#24): Remove user deletion
This commit is contained in:
@@ -524,22 +524,6 @@ paths:
|
|||||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServerError"
|
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServerError"
|
||||||
"503":
|
"503":
|
||||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServiceUnavailable"
|
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServiceUnavailable"
|
||||||
delete:
|
|
||||||
summary: Delete a user
|
|
||||||
operationId: deleteUser
|
|
||||||
tags:
|
|
||||||
- user
|
|
||||||
responses:
|
|
||||||
"204":
|
|
||||||
description: User successfully deleted
|
|
||||||
"400":
|
|
||||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/BadRequest"
|
|
||||||
"401":
|
|
||||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/Unauthorized"
|
|
||||||
"500":
|
|
||||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServerError"
|
|
||||||
"503":
|
|
||||||
$ref: "https://api.swaggerhub.com/domains/smartbear-public/ProblemDetails/1.0.0#/components/responses/ServiceUnavailable"
|
|
||||||
|
|
||||||
/users/{id}/email-preferences:
|
/users/{id}/email-preferences:
|
||||||
parameters:
|
parameters:
|
||||||
|
|||||||
@@ -16,11 +16,6 @@ class UserController(
|
|||||||
return ResponseEntity.ok(userMapper.toUserDto(user))
|
return ResponseEntity.ok(userMapper.toUserDto(user))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun deleteUser(id: String): ResponseEntity<Unit> {
|
|
||||||
userService.deleteUser(id)
|
|
||||||
return ResponseEntity.noContent().build()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun updateUserEmailPreferences(
|
override fun updateUserEmailPreferences(
|
||||||
id: String,
|
id: String,
|
||||||
updateEmailPreferencesDto: UpdateEmailPreferencesDto,
|
updateEmailPreferencesDto: UpdateEmailPreferencesDto,
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import org.springframework.stereotype.Service
|
|||||||
@Service
|
@Service
|
||||||
class UserService(
|
class UserService(
|
||||||
private val userRepository: UserRepository,
|
private val userRepository: UserRepository,
|
||||||
private val userMapper: UserMapper,
|
|
||||||
) {
|
) {
|
||||||
fun getCurrentUser(): User {
|
fun getCurrentUser(): User {
|
||||||
val principal = SecurityContextHolder.getContext().authentication.principal as CustomJwtTokenPrincipal
|
val principal = SecurityContextHolder.getContext().authentication.principal as CustomJwtTokenPrincipal
|
||||||
@@ -67,10 +66,6 @@ class UserService(
|
|||||||
return userRepository.save(user)
|
return userRepository.save(user)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deleteUser(userId: String) {
|
|
||||||
userRepository.deleteById(userId)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun updateEmailPreferences(
|
fun updateEmailPreferences(
|
||||||
userId: String,
|
userId: String,
|
||||||
|
|||||||
@@ -23,13 +23,8 @@ export function useUserApi() {
|
|||||||
return userApiClient.updateUserEmailPreferences({ id, updateEmailPreferencesDto })
|
return userApiClient.updateUserEmailPreferences({ id, updateEmailPreferencesDto })
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteUser(id: string): Promise<void> {
|
|
||||||
return userApiClient.deleteUser({ id })
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getUserById,
|
getUserById,
|
||||||
updateEmailPreferences,
|
updateEmailPreferences
|
||||||
deleteUser
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user