mirror of https://github.com/usbharu/Hideout.git
style: fix lint
This commit is contained in:
parent
5ab62d1250
commit
ea666cf0f8
|
@ -43,9 +43,7 @@ class RegisterApplicationApplicationService(
|
|||
private val applicationRepository: ApplicationRepository,
|
||||
) {
|
||||
suspend fun register(registerApplication: RegisterApplication): RegisteredApplication {
|
||||
|
||||
return transaction.transaction {
|
||||
|
||||
val id = idGenerateService.generateId()
|
||||
val clientSecret = secureTokenGenerator.generate()
|
||||
val registeredClient = RegisteredClient
|
||||
|
@ -89,6 +87,5 @@ class RegisterApplicationApplicationService(
|
|||
redirectUris = registerApplication.redirectUris
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -44,8 +44,10 @@ class RegisterLocalPostApplicationService(
|
|||
}
|
||||
|
||||
override suspend fun internalExecute(command: RegisterLocalPost, executor: CommandExecutor): Long {
|
||||
val actorId = (userDetailRepository.findById(command.userDetailId)
|
||||
?: throw IllegalStateException("actor not found")).actorId
|
||||
val actorId = (
|
||||
userDetailRepository.findById(command.userDetailId)
|
||||
?: throw IllegalStateException("actor not found")
|
||||
).actorId
|
||||
|
||||
val actor = actorRepository.findById(actorId)!!
|
||||
|
||||
|
|
|
@ -62,7 +62,6 @@ class UserBlockApplicationService(
|
|||
|
||||
relationshipDomainService.block(relationship, inverseRelationship)
|
||||
|
||||
|
||||
relationshipRepository.save(relationship)
|
||||
relationshipRepository.save(inverseRelationship)
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ class UserFollowRequestApplicationService(
|
|||
private val actorRepository: ActorRepository,
|
||||
private val userDetailRepository: UserDetailRepository,
|
||||
) : AbstractApplicationService<FollowRequest, Unit>(
|
||||
transaction, logger
|
||||
transaction,
|
||||
logger
|
||||
) {
|
||||
|
||||
override suspend fun internalExecute(command: FollowRequest, executor: CommandExecutor) {
|
||||
|
|
|
@ -38,7 +38,8 @@ class GetRelationshipApplicationService(
|
|||
transaction: Transaction,
|
||||
) :
|
||||
AbstractApplicationService<GetRelationship, Relationship>(
|
||||
transaction, logger
|
||||
transaction,
|
||||
logger
|
||||
) {
|
||||
companion object {
|
||||
private val logger = LoggerFactory.getLogger(GetRelationshipApplicationService::class.java)
|
||||
|
@ -50,11 +51,15 @@ class GetRelationshipApplicationService(
|
|||
val actor = actorRepository.findById(userDetail.actorId)!!
|
||||
val targetId = ActorId(command.targetActorId)
|
||||
val target = actorRepository.findById(targetId)!!
|
||||
val relationship = (relationshipRepository.findByActorIdAndTargetId(actor.id, targetId)
|
||||
?: dev.usbharu.hideout.core.domain.model.relationship.Relationship.default(actor.id, targetId))
|
||||
val relationship = (
|
||||
relationshipRepository.findByActorIdAndTargetId(actor.id, targetId)
|
||||
?: dev.usbharu.hideout.core.domain.model.relationship.Relationship.default(actor.id, targetId)
|
||||
)
|
||||
|
||||
val relationship1 = (relationshipRepository.findByActorIdAndTargetId(targetId, actor.id)
|
||||
?: dev.usbharu.hideout.core.domain.model.relationship.Relationship.default(targetId, actor.id))
|
||||
val relationship1 = (
|
||||
relationshipRepository.findByActorIdAndTargetId(targetId, actor.id)
|
||||
?: dev.usbharu.hideout.core.domain.model.relationship.Relationship.default(targetId, actor.id)
|
||||
)
|
||||
|
||||
val actorInstanceRelationship =
|
||||
actorInstanceRelationshipRepository.findByActorIdAndInstanceId(actor.id, target.instance)
|
||||
|
|
|
@ -38,7 +38,6 @@ abstract class AbstractApplicationService<T : Any, R>(
|
|||
logger.warn("Command execution error", e)
|
||||
throw e
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected abstract suspend fun internalExecute(command: T, executor: CommandExecutor): R
|
||||
|
|
|
@ -87,7 +87,6 @@ class SecurityConfig {
|
|||
authorize(anyRequest, authenticated)
|
||||
}
|
||||
formLogin {
|
||||
|
||||
}
|
||||
}
|
||||
return http.build()
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package dev.usbharu.hideout.core.domain.model.actor
|
||||
|
||||
|
||||
class ActorDescription(description: String) {
|
||||
val description: String = description.take(length)
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package dev.usbharu.hideout.core.domain.model.actor
|
||||
|
||||
|
||||
class ActorScreenName(screenName: String) {
|
||||
|
||||
val screenName: String = screenName.take(length)
|
||||
|
|
|
@ -59,7 +59,6 @@ class Post(
|
|||
private set
|
||||
|
||||
fun setVisibility(visibility: Visibility, actor: Actor) {
|
||||
|
||||
require(isAllow(actor, UPDATE, this))
|
||||
require(this.visibility != Visibility.DIRECT)
|
||||
require(visibility != Visibility.DIRECT)
|
||||
|
@ -77,7 +76,6 @@ class Post(
|
|||
private set
|
||||
|
||||
fun setVisibleActors(visibleActors: Set<ActorId>, actor: Actor) {
|
||||
|
||||
require(isAllow(actor, UPDATE, this))
|
||||
require(deleted.not())
|
||||
if (visibility == Visibility.DIRECT) {
|
||||
|
@ -266,7 +264,6 @@ class Post(
|
|||
moveTo: PostId? = null,
|
||||
actor: Actor,
|
||||
): Post {
|
||||
|
||||
require(actor.deleted.not())
|
||||
require(actor.moveTo == null)
|
||||
|
||||
|
@ -310,10 +307,10 @@ class Post(
|
|||
}
|
||||
|
||||
MOVE -> resource.actorId == actor.id && actor.deleted.not()
|
||||
DELETE -> resource.actorId == actor.id ||
|
||||
DELETE ->
|
||||
resource.actorId == actor.id ||
|
||||
actor.roles.contains(Role.ADMINISTRATOR) ||
|
||||
actor.roles.contains(Role.MODERATOR)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,5 +25,4 @@ data class PostContent(val text: String, val content: String, val emojiIds: List
|
|||
val contentLength = 5000
|
||||
val textLength = 3000
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -121,7 +121,6 @@ class Relationship(
|
|||
return result
|
||||
}
|
||||
|
||||
|
||||
companion object {
|
||||
fun default(actorId: ActorId, targetActorId: ActorId): Relationship = Relationship(
|
||||
actorId = actorId,
|
||||
|
|
|
@ -61,9 +61,7 @@ class FilterDomainService : IFilterDomainService {
|
|||
|
||||
post to filterResults
|
||||
}
|
||||
|
||||
}
|
||||
.map { FilteredPost(it.first, it.second) }
|
||||
}
|
||||
|
||||
}
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package dev.usbharu.hideout.core.domain.service.post
|
||||
|
||||
|
||||
interface PostContentFormatter {
|
||||
fun format(content: String): FormattedPostContent
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ class PostQueryMapper(private val postResultRowMapper: ResultRowMapper<Post>) :
|
|||
?.let { actorId -> ActorId(actorId) }
|
||||
}.toSet()
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,10 +28,10 @@ import org.slf4j.Logger
|
|||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Repository
|
||||
|
||||
|
||||
@Repository
|
||||
class ExposedActorInstanceRelationshipRepository(override val domainEventPublisher: DomainEventPublisher) :
|
||||
ActorInstanceRelationshipRepository, AbstractRepository(),
|
||||
ActorInstanceRelationshipRepository,
|
||||
AbstractRepository(),
|
||||
DomainEventPublishableRepository<ActorInstanceRelationship> {
|
||||
override suspend fun save(actorInstanceRelationship: ActorInstanceRelationship): ActorInstanceRelationship {
|
||||
query {
|
||||
|
|
|
@ -43,13 +43,11 @@ class ExposedApplicationRepository : ApplicationRepository, AbstractRepository()
|
|||
override val logger: Logger
|
||||
get() = Companion.logger
|
||||
|
||||
|
||||
companion object {
|
||||
private val logger = LoggerFactory.getLogger(ExposedApplicationRepository::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
object Applications : Table("applications") {
|
||||
val id = long("id")
|
||||
val name = varchar("name", 500)
|
||||
|
|
|
@ -28,7 +28,8 @@ import org.slf4j.LoggerFactory
|
|||
import org.springframework.stereotype.Repository
|
||||
|
||||
@Repository
|
||||
class ExposedRelationshipRepository(override val domainEventPublisher: DomainEventPublisher) : RelationshipRepository,
|
||||
class ExposedRelationshipRepository(override val domainEventPublisher: DomainEventPublisher) :
|
||||
RelationshipRepository,
|
||||
AbstractRepository(),
|
||||
DomainEventPublishableRepository<Relationship> {
|
||||
override suspend fun save(relationship: Relationship): Relationship {
|
||||
|
@ -65,7 +66,6 @@ class ExposedRelationshipRepository(override val domainEventPublisher: DomainEve
|
|||
override val logger: Logger
|
||||
get() = Companion.logger
|
||||
|
||||
|
||||
companion object {
|
||||
private val logger = LoggerFactory.getLogger(ExposedRelationshipRepository::class.java)
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.springframework.stereotype.Component
|
|||
import org.springframework.web.context.request.RequestContextHolder
|
||||
import org.springframework.web.context.request.ServletRequestAttributes
|
||||
|
||||
|
||||
@Component
|
||||
class SpringMvcCommandExecutorFactory {
|
||||
fun getCommandExecutor(): HttpCommandExecutor {
|
||||
|
|
|
@ -20,7 +20,9 @@ import dev.usbharu.hideout.core.domain.service.userdetail.PasswordEncoder
|
|||
import org.springframework.stereotype.Component
|
||||
|
||||
@Component
|
||||
class SpringSecurityPasswordEncoder(private val passwordEncoder: org.springframework.security.crypto.password.PasswordEncoder) :
|
||||
class SpringSecurityPasswordEncoder(
|
||||
private val passwordEncoder: org.springframework.security.crypto.password.PasswordEncoder,
|
||||
) :
|
||||
PasswordEncoder {
|
||||
override suspend fun encode(input: String): String {
|
||||
return passwordEncoder.encode(input)
|
||||
|
|
|
@ -31,10 +31,10 @@ class HideoutJdbcOauth2AuthorizationService(
|
|||
@Autowired(required = false) lobHandler: LobHandler = DefaultLobHandler(),
|
||||
) : JdbcOAuth2AuthorizationService(jdbcOperations, registeredClientRepository, lobHandler) {
|
||||
|
||||
|
||||
|
||||
init {
|
||||
super.setAuthorizationRowMapper(HideoutOAuth2AuthorizationRowMapper(registeredClientRepository = registeredClientRepository))
|
||||
super.setAuthorizationRowMapper(
|
||||
HideoutOAuth2AuthorizationRowMapper(registeredClientRepository = registeredClientRepository)
|
||||
)
|
||||
}
|
||||
|
||||
class HideoutOAuth2AuthorizationRowMapper(registeredClientRepository: RegisteredClientRepository?) :
|
||||
|
|
|
@ -19,5 +19,6 @@ package dev.usbharu.hideout.core.infrastructure.springframework.oauth2
|
|||
import dev.usbharu.hideout.core.application.shared.CommandExecutor
|
||||
import dev.usbharu.hideout.core.application.shared.UserDetailGettableCommandExecutor
|
||||
|
||||
class Oauth2CommandExecutor(override val executor: String, override val userDetailId: Long) : CommandExecutor,
|
||||
class Oauth2CommandExecutor(override val executor: String, override val userDetailId: Long) :
|
||||
CommandExecutor,
|
||||
UserDetailGettableCommandExecutor
|
|
@ -29,6 +29,5 @@ class Oauth2CommandExecutorFactory {
|
|||
principal.subject,
|
||||
principal.getClaim<String>("uid").toLong()
|
||||
)
|
||||
|
||||
}
|
||||
}
|
|
@ -49,6 +49,5 @@ class UserDetailsServiceImpl(
|
|||
userDetailsId = userDetail.id.id
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -43,8 +43,6 @@ class JsonOrFormModelMethodProcessor(
|
|||
webRequest: NativeWebRequest,
|
||||
binderFactory: WebDataBinderFactory?,
|
||||
): Any? {
|
||||
|
||||
|
||||
val contentType = webRequest.getHeader("Content-Type").orEmpty()
|
||||
logger.trace("ContentType is {}", contentType)
|
||||
if (contentType.contains(isJsonRegex)) {
|
||||
|
|
|
@ -44,5 +44,4 @@ object RsaUtil {
|
|||
}
|
||||
|
||||
fun decodeRsaPrivateKey(encoded: String): RSAPrivateKey = decodeRsaPrivateKey(Base64Util.decode(encoded))
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ plugins {
|
|||
rootProject.name = "hideout"
|
||||
|
||||
includeBuild("hideout-core")
|
||||
includeBuild("hideout-worker")
|
||||
includeBuild("hideout-mastodon")
|
||||
|
||||
dependencyResolutionManagement {
|
||||
|
|
Loading…
Reference in New Issue