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 =
|
restrictions =
|
||||||
ContentRestrictions(
|
ContentRestrictions(
|
||||||
ageRestriction =
|
ageRestriction =
|
||||||
if (ageRestriction == null || ageRestriction.restriction == AllowExcludeDto.NONE)
|
ageRestriction.let {
|
||||||
null
|
if (it == null || it.restriction == AllowExcludeDto.NONE)
|
||||||
else
|
null
|
||||||
AgeRestriction(ageRestriction.age, ageRestriction.restriction.toDomain()),
|
else
|
||||||
|
AgeRestriction(it.age, it.restriction.toDomain())
|
||||||
|
},
|
||||||
labelsAllow = labelsAllow ?: emptySet(),
|
labelsAllow = labelsAllow ?: emptySet(),
|
||||||
labelsExclude = labelsExclude ?: emptySet(),
|
labelsExclude = labelsExclude ?: emptySet(),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
package org.gotson.komga.interfaces.api.rest.dto
|
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.AgeRestriction
|
||||||
import org.gotson.komga.domain.model.AllowExclude
|
import org.gotson.komga.domain.model.AllowExclude
|
||||||
import org.gotson.komga.domain.model.KomgaUser
|
import org.gotson.komga.domain.model.KomgaUser
|
||||||
import org.gotson.komga.infrastructure.security.KomgaPrincipal
|
import org.gotson.komga.infrastructure.security.KomgaPrincipal
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
data class UserDto(
|
data class UserDto(
|
||||||
val id: String,
|
val id: String,
|
||||||
val email: String,
|
val email: String,
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ class UserControllerTest(
|
||||||
jsonPath("$.sharedLibrariesId") { doesNotExist() }
|
jsonPath("$.sharedLibrariesId") { doesNotExist() }
|
||||||
jsonPath("$.labelsAllow") { isEmpty() }
|
jsonPath("$.labelsAllow") { isEmpty() }
|
||||||
jsonPath("$.labelsExclude") { isEmpty() }
|
jsonPath("$.labelsExclude") { isEmpty() }
|
||||||
jsonPath("$.ageRestriction") { isEmpty() }
|
jsonPath("$.ageRestriction") { doesNotExist() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue