style: fix lint

This commit is contained in:
usbharu 2023-11-19 11:50:19 +09:00
parent 8bc6abb5ee
commit c05ea300f7
7 changed files with 40 additions and 34 deletions

View File

@ -1,5 +1,6 @@
package dev.usbharu.hideout.activitypub.domain.model.objects
@Suppress("VariableNaming")
open class ObjectValue : Object {
var `object`: String? = null

View File

@ -4,12 +4,12 @@ class Nodeinfo {
var links: List<Links> = emptyList()
protected constructor()
private constructor()
}
class Links {
var rel: String? = null
var href: String? = null
protected constructor()
private constructor()
}

View File

@ -1,22 +1,23 @@
package dev.usbharu.hideout.core.domain.model.instance
@Suppress("ClassNaming")
class Nodeinfo2_0 {
var metadata: Metadata? = null
var software: Software? = null
protected constructor()
constructor()
}
class Metadata {
var nodeName: String? = null
var nodeDescription: String? = null
protected constructor()
constructor()
}
class Software {
var name: String? = null
var version: String? = null
protected constructor()
constructor()
}

View File

@ -25,7 +25,10 @@ data class User private constructor(
val instance: Long? = null
) {
override fun toString(): String =
"User(id=$id, name='$name', domain='$domain', screenName='$screenName', description='$description', password=$password, inbox='$inbox', outbox='$outbox', url='$url', publicKey='$publicKey', privateKey=$privateKey, createdAt=$createdAt, keyId='$keyId', followers=$followers, following=$following, instance=$instance)"
"User(id=$id, name='$name', domain='$domain', screenName='$screenName', description='$description'," +
" password=$password, inbox='$inbox', outbox='$outbox', url='$url', publicKey='$publicKey', " +
"privateKey=$privateKey, createdAt=$createdAt, keyId='$keyId', followers=$followers," +
" following=$following, instance=$instance)"
@Component
class UserBuilder(private val characterLimit: CharacterLimit, private val applicationConfig: ApplicationConfig) {

View File

@ -15,7 +15,7 @@ class InstanceRepositoryImpl(private val idGenerateService: IdGenerateService) :
override suspend fun generateId(): Long = idGenerateService.generateId()
override suspend fun save(instance: InstanceEntity): InstanceEntity {
if (Instance.select { Instance.id.eq(instance.id) }.firstOrNull() == null) {
if (Instance.select { Instance.id.eq(instance.id) }.empty()) {
Instance.insert {
it[id] = instance.id
it[name] = instance.name

View File

@ -50,13 +50,13 @@ class InstanceServiceImpl(
)
val instanceCreateDto = InstanceCreateDto(
nodeinfo20.metadata?.nodeName,
nodeinfo20.metadata?.nodeDescription,
resolveInstanceUrl,
resolveInstanceUrl + "/favicon.ico",
sharedInbox,
nodeinfo20.software?.name,
nodeinfo20.software?.version
name = nodeinfo20.metadata?.nodeName,
description = nodeinfo20.metadata?.nodeDescription,
url = resolveInstanceUrl,
iconUrl = resolveInstanceUrl + "/favicon.ico",
sharedInbox = sharedInbox,
software = nodeinfo20.software?.name,
version = nodeinfo20.software?.version
)
return createNewInstance(instanceCreateDto)
}
@ -69,13 +69,13 @@ class InstanceServiceImpl(
)
val instanceCreateDto = InstanceCreateDto(
nodeinfo20.metadata?.nodeName,
nodeinfo20.metadata?.nodeDescription,
resolveInstanceUrl,
resolveInstanceUrl + "/favicon.ico",
sharedInbox,
nodeinfo20.software?.name,
nodeinfo20.software?.version
name = nodeinfo20.metadata?.nodeName,
description = nodeinfo20.metadata?.nodeDescription,
url = resolveInstanceUrl,
iconUrl = resolveInstanceUrl + "/favicon.ico",
sharedInbox = sharedInbox,
software = nodeinfo20.software?.name,
version = nodeinfo20.software?.version
)
return createNewInstance(instanceCreateDto)
}
@ -91,18 +91,18 @@ class InstanceServiceImpl(
override suspend fun createNewInstance(instanceCreateDto: InstanceCreateDto): Instance {
val instance = Instance(
instanceRepository.generateId(),
instanceCreateDto.name ?: instanceCreateDto.url,
instanceCreateDto.description ?: "",
instanceCreateDto.url,
instanceCreateDto.iconUrl,
instanceCreateDto.sharedInbox,
instanceCreateDto.software ?: "unknown",
instanceCreateDto.version ?: "unknown",
false,
false,
"",
Instant.now()
id = instanceRepository.generateId(),
name = instanceCreateDto.name ?: instanceCreateDto.url,
description = instanceCreateDto.description.orEmpty(),
url = instanceCreateDto.url,
iconUrl = instanceCreateDto.iconUrl,
sharedInbox = instanceCreateDto.sharedInbox,
software = instanceCreateDto.software ?: "unknown",
version = instanceCreateDto.version ?: "unknown",
isBlocked = false,
isMuted = false,
moderationNote = "",
createdAt = Instant.now()
)
instanceRepository.save(instance)
return instance

View File

@ -24,7 +24,7 @@ open class MediaServiceImpl(
private val remoteMediaDownloadService: RemoteMediaDownloadService,
private val renameService: MediaFileRenameService
) : MediaService {
@Suppress("LongMethod")
@Suppress("LongMethod", "NestedBlockDepth")
override suspend fun uploadLocalMedia(mediaRequest: MediaRequest): EntityMedia {
val fileName = mediaRequest.file.name
logger.info(
@ -95,6 +95,7 @@ open class MediaServiceImpl(
}
// TODO: 仮の処理として保存したように動かす
@Suppress("LongMethod", "NestedBlockDepth")
override suspend fun uploadRemoteMedia(remoteMedia: RemoteMedia): Media {
logger.info("MEDIA Remote media. filename:${remoteMedia.name} url:${remoteMedia.url}")