mirror of
https://github.com/gotson/komga.git
synced 2026-05-08 12:35:30 +02:00
fix(api): omit UserDto.ageRestriction instead of returning null
Closes: 2296
This commit is contained in:
parent
bb60a797e8
commit
e3a8cc6b01
3 changed files with 9 additions and 5 deletions
|
|
@ -112,10 +112,12 @@ class UserController(
|
|||
restrictions =
|
||||
ContentRestrictions(
|
||||
ageRestriction =
|
||||
if (ageRestriction == null || ageRestriction.restriction == AllowExcludeDto.NONE)
|
||||
null
|
||||
else
|
||||
AgeRestriction(ageRestriction.age, ageRestriction.restriction.toDomain()),
|
||||
ageRestriction.let {
|
||||
if (it == null || it.restriction == AllowExcludeDto.NONE)
|
||||
null
|
||||
else
|
||||
AgeRestriction(it.age, it.restriction.toDomain())
|
||||
},
|
||||
labelsAllow = labelsAllow ?: emptySet(),
|
||||
labelsExclude = labelsExclude ?: emptySet(),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package org.gotson.komga.interfaces.api.rest.dto
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude
|
||||
import org.gotson.komga.domain.model.AgeRestriction
|
||||
import org.gotson.komga.domain.model.AllowExclude
|
||||
import org.gotson.komga.domain.model.KomgaUser
|
||||
import org.gotson.komga.infrastructure.security.KomgaPrincipal
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
data class UserDto(
|
||||
val id: String,
|
||||
val email: String,
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ class UserControllerTest(
|
|||
jsonPath("$.sharedLibrariesId") { doesNotExist() }
|
||||
jsonPath("$.labelsAllow") { isEmpty() }
|
||||
jsonPath("$.labelsExclude") { isEmpty() }
|
||||
jsonPath("$.ageRestriction") { isEmpty() }
|
||||
jsonPath("$.ageRestriction") { doesNotExist() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue