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 package dev.usbharu.hideout.activitypub.domain.model.objects
@Suppress("VariableNaming")
open class ObjectValue : Object { open class ObjectValue : Object {
var `object`: String? = null var `object`: String? = null

View File

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

View File

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

View File

@ -25,7 +25,10 @@ data class User private constructor(
val instance: Long? = null val instance: Long? = null
) { ) {
override fun toString(): String = 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 @Component
class UserBuilder(private val characterLimit: CharacterLimit, private val applicationConfig: ApplicationConfig) { 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 generateId(): Long = idGenerateService.generateId()
override suspend fun save(instance: InstanceEntity): InstanceEntity { 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 { Instance.insert {
it[id] = instance.id it[id] = instance.id
it[name] = instance.name it[name] = instance.name

View File

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

View File

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