Merge pull request #614 from usbharu/application-service

リファクタリング
This commit is contained in:
usbharu 2024-09-15 23:15:50 +09:00 committed by GitHub
commit b38d34d1ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
239 changed files with 2795 additions and 1174 deletions

View File

@ -85,15 +85,17 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
title: Code Coverage title: Code Coverage
update-comment: true update-comment: true
min-coverage-overall: 80 min-coverage-overall: 50
min-coverage-changed-files: 80 min-coverage-changed-files: 80
coverage-counter-type: LINE
- name: JUnit Test Report - name: JUnit Test Report
uses: mikepenz/action-junit-report@v4 uses: mikepenz/action-junit-report@v4
with: with:
report_paths: '**/TEST-*.xml' report_paths: '**/TEST-*.xml'
- name: Verify Coverage
run: ./hideout-core/gradlew :hideout-core:koverVerify
lint: lint:
name: Lint name: Lint
needs: [ setup ] needs: [ setup ]

View File

@ -1,8 +1,25 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.github.jk1.license.filter.DependencyFilter import com.github.jk1.license.filter.DependencyFilter
import com.github.jk1.license.filter.LicenseBundleNormalizer import com.github.jk1.license.filter.LicenseBundleNormalizer
import com.github.jk1.license.importer.DependencyDataImporter import com.github.jk1.license.importer.DependencyDataImporter
import com.github.jk1.license.importer.XmlReportImporter import com.github.jk1.license.importer.XmlReportImporter
import com.github.jk1.license.render.* import com.github.jk1.license.render.*
import kotlinx.kover.gradle.plugin.dsl.CoverageUnit
import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins { plugins {
@ -21,19 +38,6 @@ apply {
group = "dev.usbharu" group = "dev.usbharu"
version = "0.0.1" version = "0.0.1"
tasks.withType<Test> {
useJUnitPlatform()
doFirst {
jvmArgs = arrayOf(
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED",
"--add-opens", "java.naming/javax.naming=ALL-UNNAMED",
"--add-opens", "java.base/java.util.concurrent.locks=ALL-UNNAMED"
).toMutableList()
}
}
kotlin { kotlin {
jvmToolchain(21) jvmToolchain(21)
compilerOptions { compilerOptions {
@ -69,8 +73,7 @@ repositories {
} }
val os = org.gradle.nativeplatform.platform.internal val os = org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentOperatingSystem()
.DefaultNativePlatform.getCurrentOperatingSystem()
dependencies { dependencies {
developmentOnly(libs.h2db) developmentOnly(libs.h2db)
@ -157,35 +160,40 @@ configurations {
} }
} }
tasks {
//tasks{ withType<io.gitlab.arturbosch.detekt.Detekt> {
// bootRun { exclude("**/generated/**")
// sourceResources(sourceSets.main.get()) setSource("src/main/kotlin")
// } exclude("build/")
//} configureEach {
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
tasks.withType<io.gitlab.arturbosch.detekt.Detekt> { }
exclude("**/generated/**") }
doFirst { withType<io.gitlab.arturbosch.detekt.DetektCreateBaselineTask>() {
configureEach {
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
}
}
withType<Test> {
useJUnitPlatform()
doFirst {
jvmArgs = arrayOf(
"--add-opens",
"java.base/java.lang=ALL-UNNAMED",
"--add-opens",
"java.base/java.util=ALL-UNNAMED",
"--add-opens",
"java.naming/javax.naming=ALL-UNNAMED",
"--add-opens",
"java.base/java.util.concurrent.locks=ALL-UNNAMED"
).toMutableList()
}
} }
setSource("src/main/kotlin")
exclude("build/")
} }
tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
}
tasks.withType<io.gitlab.arturbosch.detekt.DetektCreateBaselineTask>().configureEach {
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
}
project.gradle.taskGraph.whenReady { project.gradle.taskGraph.whenReady {
println(this.allTasks)
this.allTasks.map { println(it.name) }
if (this.hasTask(":koverGenerateArtifact")) { if (this.hasTask(":koverGenerateArtifact")) {
println("has task")
val task = this.allTasks.find { it.name == "test" } val task = this.allTasks.find { it.name == "test" }
val verificationTask = task as VerificationTask val verificationTask = task as VerificationTask
verificationTask.ignoreFailures = true verificationTask.ignoreFailures = true
@ -195,23 +203,22 @@ project.gradle.taskGraph.whenReady {
kover { kover {
currentProject { currentProject {
sources { sources {
excludedSourceSets.addAll(
"aot", "e2eTest", "intTest"
)
} }
} }
reports { reports {
verify {
rule {
bound{
minValue = 50
coverageUnits = CoverageUnit.INSTRUCTION
}
}
}
filters { filters {
excludes { excludes {
packages(
"dev.usbharu.hideout.activitypub.domain.exception",
"dev.usbharu.hideout.core.domain.exception",
"dev.usbharu.hideout.core.domain.exception.media",
"dev.usbharu.hideout.core.domain.exception.resource",
"dev.usbharu.hideout.core.domain.exception.resource.local"
)
annotatedBy("org.springframework.context.annotation.Configuration") annotatedBy("org.springframework.context.annotation.Configuration")
annotatedBy("org.springframework.boot.context.properties.ConfigurationProperties") annotatedBy("org.springframework.boot.context.properties.ConfigurationProperties")
packages( packages(
@ -236,10 +243,7 @@ licenseReport {
importers = arrayOf<DependencyDataImporter>(XmlReportImporter("hideout", File("$projectDir/license-list.xml"))) importers = arrayOf<DependencyDataImporter>(XmlReportImporter("hideout", File("$projectDir/license-list.xml")))
renderers = arrayOf<ReportRenderer>( renderers = arrayOf<ReportRenderer>(
InventoryHtmlReportRenderer(), InventoryHtmlReportRenderer(), CsvReportRenderer(), JsonReportRenderer(), XmlReportRenderer()
CsvReportRenderer(),
JsonReportRenderer(),
XmlReportRenderer()
) )
filters = arrayOf<DependencyFilter>(LicenseBundleNormalizer("$projectDir/license-normalizer-bundle.json", true)) filters = arrayOf<DependencyFilter>(LicenseBundleNormalizer("$projectDir/license-normalizer-bundle.json", true))
allowedLicensesFile = File("$projectDir/allowed-licenses.json") allowedLicensesFile = File("$projectDir/allowed-licenses.json")

View File

@ -1,3 +1,19 @@
#
# Copyright (C) 2024 usbharu
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip

View File

@ -1,13 +1,13 @@
#!/bin/sh #!/bin/sh
# #
# Copyright © 2015-2021 the original authors. # Copyright (C) 2024 usbharu
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# https://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #

View File

@ -1,94 +1,110 @@
@rem #
@rem Copyright 2015 the original author or authors. # Copyright (C) 2024 usbharu
@rem #
@rem Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at # You may obtain a copy of the License at
@rem #
@rem https://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
@rem #
@rem Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
@rem limitations under the License. # limitations under the License.
@rem #
@rem SPDX-License-Identifier: Apache-2.0
@rem @rem
@rem Copyright 2015 the original author or authors.
@if "%DEBUG%"=="" @echo off @rem
@rem ########################################################################## @rem Licensed under the Apache License, Version 2.0 (the "License");
@rem @rem you may not use this file except in compliance with the License.
@rem Gradle startup script for Windows @rem You may obtain a copy of the License at
@rem @rem
@rem ########################################################################## @rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Set local scope for the variables with windows NT shell @rem Unless required by applicable law or agreed to in writing, software
if "%OS%"=="Windows_NT" setlocal @rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
set DIRNAME=%~dp0 @rem See the License for the specific language governing permissions and
if "%DIRNAME%"=="" set DIRNAME=. @rem limitations under the License.
@rem This is normally unused @rem
set APP_BASE_NAME=%~n0 @rem SPDX-License-Identifier: Apache-2.0
set APP_HOME=%DIRNAME% @rem
@rem Resolve any "." and ".." in APP_HOME to make it shorter. @if "%DEBUG%"=="" @echo off
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi @rem ##########################################################################
@rem
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Gradle startup script for Windows
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem
@rem ##########################################################################
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome @rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 set DIRNAME=%~dp0
if %ERRORLEVEL% equ 0 goto execute if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
echo. 1>&2 set APP_BASE_NAME=%~n0
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 set APP_HOME=%DIRNAME%
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 @rem Resolve any "." and ".." in APP_HOME to make it shorter.
echo location of your Java installation. 1>&2 for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
goto fail @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=% @rem Find java.exe
set JAVA_EXE=%JAVA_HOME%/bin/java.exe if defined JAVA_HOME goto findJavaFromJavaHome
if exist "%JAVA_EXE%" goto execute set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
echo. 1>&2 if %ERRORLEVEL% equ 0 goto execute
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2 echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo location of your Java installation. 1>&2 echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
goto fail echo location of your Java installation. 1>&2
:execute goto fail
@rem Setup the command line
:findJavaFromJavaHome
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
@rem Execute Gradle if exist "%JAVA_EXE%" goto execute
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
echo. 1>&2
:end echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
@rem End local scope for the variables with windows NT shell echo. 1>&2
if %ERRORLEVEL% equ 0 goto mainEnd echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of goto fail
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL% :execute
if %EXIT_CODE% equ 0 set EXIT_CODE=1 @rem Setup the command line
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE% set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:mainEnd
if "%OS%"=="Windows_NT" endlocal @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:omega
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins { plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
} }

View File

@ -1,38 +0,0 @@
package dev.usbharu.hideout.core.application.actor
import dev.usbharu.hideout.core.domain.model.actor.Actor
import java.net.URI
data class ActorDetail(
val id: Long,
val name: String,
val screenName: String,
val host: String,
val remoteUrl: String?,
val locked: Boolean,
val description: String,
val postsCount: Int,
val iconUrl: URI?,
val bannerURL: URI?,
val followingCount: Int?,
val followersCount: Int?,
) {
companion object {
fun of(actor: Actor, iconUrl: URI?, bannerURL: URI?): ActorDetail {
return ActorDetail(
id = actor.id.id,
name = actor.name.name,
screenName = actor.screenName.screenName,
host = actor.url.host,
remoteUrl = actor.url.toString(),
locked = actor.locked,
description = actor.description.description,
postsCount = actor.postsCount.postsCount,
iconUrl = iconUrl,
bannerURL = bannerURL,
followingCount = actor.followingCount?.relationshipCount,
followersCount = actor.followersCount?.relationshipCount,
)
}
}
}

View File

@ -1,5 +0,0 @@
package dev.usbharu.hideout.core.application.actor
import dev.usbharu.hideout.core.domain.model.actor.ActorId
data class DeleteLocalActor(val actorId: ActorId)

View File

@ -1,8 +0,0 @@
package dev.usbharu.hideout.core.application.actor
import dev.usbharu.hideout.core.domain.model.support.acct.Acct
data class GetActorDetail(
val actorName: Acct? = null,
val id: Long? = null
)

View File

@ -1,11 +1,29 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.actor package dev.usbharu.hideout.core.application.actor
import dev.usbharu.hideout.core.application.model.ActorDetail
import dev.usbharu.hideout.core.application.shared.AbstractApplicationService import dev.usbharu.hideout.core.application.shared.AbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.application.shared.Transaction
import dev.usbharu.hideout.core.config.ApplicationConfig import dev.usbharu.hideout.core.config.ApplicationConfig
import dev.usbharu.hideout.core.domain.model.actor.ActorId import dev.usbharu.hideout.core.domain.model.actor.ActorId
import dev.usbharu.hideout.core.domain.model.actor.ActorRepository import dev.usbharu.hideout.core.domain.model.actor.ActorRepository
import dev.usbharu.hideout.core.domain.model.media.MediaRepository import dev.usbharu.hideout.core.domain.model.media.MediaRepository
import dev.usbharu.hideout.core.domain.model.support.acct.Acct
import dev.usbharu.hideout.core.domain.model.support.principal.Principal import dev.usbharu.hideout.core.domain.model.support.principal.Principal
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import org.springframework.stereotype.Component import org.springframework.stereotype.Component
@ -37,8 +55,8 @@ class GetActorDetailApplicationService(
throw IllegalArgumentException("id and actorName are null.") throw IllegalArgumentException("id and actorName are null.")
} }
val iconUrl = actor.icon?.let { mediaRepository.findById(it)?.url } val iconUrl = actor.icon?.let { mediaRepository.findById(it) }
val bannerUrl = actor.banner?.let { mediaRepository.findById(it)?.url } val bannerUrl = actor.banner?.let { mediaRepository.findById(it) }
return ActorDetail.of(actor, iconUrl, bannerUrl) return ActorDetail.of(actor, iconUrl, bannerUrl)
} }
@ -47,3 +65,8 @@ class GetActorDetailApplicationService(
private val logger = LoggerFactory.getLogger(GetActorDetailApplicationService::class.java) private val logger = LoggerFactory.getLogger(GetActorDetailApplicationService::class.java)
} }
} }
data class GetActorDetail(
val actorName: Acct? = null,
val id: Long? = null
)

View File

@ -1,19 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.actor
data class GetUserDetail(val id: Long)

View File

@ -17,6 +17,7 @@
package dev.usbharu.hideout.core.application.actor package dev.usbharu.hideout.core.application.actor
import dev.usbharu.hideout.core.application.exception.InternalServerException import dev.usbharu.hideout.core.application.exception.InternalServerException
import dev.usbharu.hideout.core.application.model.UserDetail
import dev.usbharu.hideout.core.application.shared.AbstractApplicationService import dev.usbharu.hideout.core.application.shared.AbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.application.shared.Transaction
import dev.usbharu.hideout.core.domain.model.actor.ActorRepository import dev.usbharu.hideout.core.domain.model.actor.ActorRepository
@ -50,3 +51,5 @@ class GetUserDetailApplicationService(
val logger = LoggerFactory.getLogger(GetUserDetailApplicationService::class.java) val logger = LoggerFactory.getLogger(GetUserDetailApplicationService::class.java)
} }
} }
data class GetUserDetail(val id: Long)

View File

@ -1,3 +0,0 @@
package dev.usbharu.hideout.core.application.actor
data class MigrationLocalActor(val from: Long, val to: Long)

View File

@ -74,3 +74,5 @@ class MigrationLocalActorApplicationService(
private val logger = LoggerFactory.getLogger(MigrationLocalActorApplicationService::class.java) private val logger = LoggerFactory.getLogger(MigrationLocalActorApplicationService::class.java)
} }
} }
data class MigrationLocalActor(val from: Long, val to: Long)

View File

@ -1,22 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.actor
data class RegisterLocalActor(
val name: String,
val password: String,
)

View File

@ -76,3 +76,8 @@ class RegisterLocalActorApplicationService(
private val logger = LoggerFactory.getLogger(RegisterLocalActorApplicationService::class.java) private val logger = LoggerFactory.getLogger(RegisterLocalActorApplicationService::class.java)
} }
} }
data class RegisterLocalActor(
val name: String,
val password: String,
)

View File

@ -1,8 +0,0 @@
package dev.usbharu.hideout.core.application.actor
import org.springframework.stereotype.Service
@Service
interface SetAlsoKnownAsLocalActorApplicationService {
suspend fun setAlsoKnownAs(actorId: Long, alsoKnownAs: List<Long>)
}

View File

@ -20,6 +20,7 @@ import dev.usbharu.hideout.core.application.exception.InternalServerException
import dev.usbharu.hideout.core.application.exception.PermissionDeniedException import dev.usbharu.hideout.core.application.exception.PermissionDeniedException
import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.application.shared.Transaction
import dev.usbharu.hideout.core.domain.model.actor.ActorId
import dev.usbharu.hideout.core.domain.model.actor.ActorRepository import dev.usbharu.hideout.core.domain.model.actor.ActorRepository
import dev.usbharu.hideout.core.domain.model.support.principal.LocalUser import dev.usbharu.hideout.core.domain.model.support.principal.LocalUser
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
@ -44,3 +45,5 @@ class StartDeleteLocalActorApplicationService(
private val logger = LoggerFactory.getLogger(StartDeleteLocalActorApplicationService::class.java) private val logger = LoggerFactory.getLogger(StartDeleteLocalActorApplicationService::class.java)
} }
} }
data class DeleteLocalActor(val actorId: ActorId)

View File

@ -1,3 +0,0 @@
package dev.usbharu.hideout.core.application.actor
data class SuspendLocalActor(val actorId: Long)

View File

@ -42,3 +42,5 @@ class SuspendLocalActorApplicationService(
private val logger = LoggerFactory.getLogger(SuspendLocalActorApplicationService::class.java) private val logger = LoggerFactory.getLogger(SuspendLocalActorApplicationService::class.java)
} }
} }
data class SuspendLocalActor(val actorId: Long)

View File

@ -1,3 +0,0 @@
package dev.usbharu.hideout.core.application.actor
data class UnsuspendLocalActor(val actorId: Long)

View File

@ -42,3 +42,5 @@ class UnsuspendLocalActorApplicationService(
private val logger = LoggerFactory.getLogger(UnsuspendLocalActorApplicationService::class.java) private val logger = LoggerFactory.getLogger(UnsuspendLocalActorApplicationService::class.java)
} }
} }
data class UnsuspendLocalActor(val actorId: Long)

View File

@ -1,26 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.application
import java.net.URI
data class RegisterApplication(
val name: String,
val redirectUris: Set<URI>,
val useRefreshToken: Boolean,
val scopes: Set<String>,
)

View File

@ -34,6 +34,7 @@ import org.springframework.security.oauth2.server.authorization.client.Registere
import org.springframework.security.oauth2.server.authorization.settings.ClientSettings import org.springframework.security.oauth2.server.authorization.settings.ClientSettings
import org.springframework.security.oauth2.server.authorization.settings.TokenSettings import org.springframework.security.oauth2.server.authorization.settings.TokenSettings
import org.springframework.stereotype.Service import org.springframework.stereotype.Service
import java.net.URI
import java.time.Duration import java.time.Duration
@Service @Service
@ -44,9 +45,15 @@ class RegisterApplicationApplicationService(
private val registeredClientRepository: RegisteredClientRepository, private val registeredClientRepository: RegisteredClientRepository,
transaction: Transaction, transaction: Transaction,
private val applicationRepository: ApplicationRepository, private val applicationRepository: ApplicationRepository,
) : AbstractApplicationService<RegisterApplication, RegisteredApplication>(transaction, logger) { ) : AbstractApplicationService<RegisterApplication, dev.usbharu.hideout.core.application.model.Application>(
transaction,
logger
) {
override suspend fun internalExecute(command: RegisterApplication, principal: Principal): RegisteredApplication { override suspend fun internalExecute(
command: RegisterApplication,
principal: Principal
): dev.usbharu.hideout.core.application.model.Application {
val id = idGenerateService.generateId() val id = idGenerateService.generateId()
val clientSecret = secureTokenGenerator.generate() val clientSecret = secureTokenGenerator.generate()
val registeredClient = RegisteredClient val registeredClient = RegisteredClient
@ -82,7 +89,7 @@ class RegisterApplicationApplicationService(
val application = Application(ApplicationId(id), ApplicationName(command.name)) val application = Application(ApplicationId(id), ApplicationName(command.name))
applicationRepository.save(application) applicationRepository.save(application)
return RegisteredApplication( return dev.usbharu.hideout.core.application.model.Application(
id = id, id = id,
name = command.name, name = command.name,
clientSecret = clientSecret, clientSecret = clientSecret,
@ -95,3 +102,10 @@ class RegisterApplicationApplicationService(
private val logger = LoggerFactory.getLogger(RegisterApplicationApplicationService::class.java) private val logger = LoggerFactory.getLogger(RegisterApplicationApplicationService::class.java)
} }
} }
data class RegisterApplication(
val name: String,
val redirectUris: Set<URI>,
val useRefreshToken: Boolean,
val scopes: Set<String>,
)

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.domainevent.subscribers package dev.usbharu.hideout.core.application.domainevent.subscribers
import dev.usbharu.hideout.core.domain.shared.domainevent.DomainEvent import dev.usbharu.hideout.core.domain.shared.domainevent.DomainEvent

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.domainevent.subscribers package dev.usbharu.hideout.core.application.domainevent.subscribers
data class RegisterHomeTimeline( data class RegisterHomeTimeline(

View File

@ -1,5 +1,22 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.domainevent.subscribers package dev.usbharu.hideout.core.application.domainevent.subscribers
import dev.usbharu.hideout.core.application.timeline.UserRegisterHomeTimelineApplicationService
import dev.usbharu.hideout.core.domain.event.userdetail.UserDetailEvent import dev.usbharu.hideout.core.domain.event.userdetail.UserDetailEvent
import dev.usbharu.hideout.core.domain.event.userdetail.UserDetailEventBody import dev.usbharu.hideout.core.domain.event.userdetail.UserDetailEventBody
import dev.usbharu.hideout.core.domain.model.support.principal.Anonymous import dev.usbharu.hideout.core.domain.model.support.principal.Anonymous

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.domainevent.subscribers package dev.usbharu.hideout.core.application.domainevent.subscribers
import dev.usbharu.hideout.core.application.timeline.SetTimelineToTimelineStoreApplicationService import dev.usbharu.hideout.core.application.timeline.SetTimelineToTimelineStoreApplicationService

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.domainevent.subscribers package dev.usbharu.hideout.core.application.domainevent.subscribers
interface Subscriber { interface Subscriber {

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.domainevent.subscribers package dev.usbharu.hideout.core.application.domainevent.subscribers
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.domainevent.subscribers package dev.usbharu.hideout.core.application.domainevent.subscribers
import dev.usbharu.hideout.core.application.timeline.AddPost import dev.usbharu.hideout.core.application.timeline.AddPost

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.domainevent.subscribers package dev.usbharu.hideout.core.application.domainevent.subscribers
import dev.usbharu.hideout.core.application.exception.InternalServerException import dev.usbharu.hideout.core.application.exception.InternalServerException

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.domainevent.subscribers package dev.usbharu.hideout.core.application.domainevent.subscribers
import dev.usbharu.hideout.core.application.timeline.RemoveTimelineRelationship import dev.usbharu.hideout.core.application.timeline.RemoveTimelineRelationship

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.exception package dev.usbharu.hideout.core.application.exception
class InternalServerException : RuntimeException { class InternalServerException : RuntimeException {

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.exception package dev.usbharu.hideout.core.application.exception
class PermissionDeniedException : RuntimeException { class PermissionDeniedException : RuntimeException {

View File

@ -1,19 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.filter
data class DeleteFilter(val filterId: Long)

View File

@ -1,19 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.filter
data class GetFilter(val filterId: Long)

View File

@ -1,27 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.filter
import dev.usbharu.hideout.core.domain.model.filter.FilterAction
import dev.usbharu.hideout.core.domain.model.filter.FilterContext
data class RegisterFilter(
val filterName: String,
val filterContext: Set<FilterContext>,
val filterAction: FilterAction,
val filterKeywords: Set<RegisterFilterKeyword>,
)

View File

@ -1,24 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.filter
import dev.usbharu.hideout.core.domain.model.filter.FilterMode
data class RegisterFilterKeyword(
val keyword: String,
val filterMode: FilterMode,
)

View File

@ -44,3 +44,5 @@ class UserDeleteFilterApplicationService(private val filterRepository: FilterRep
private val logger = LoggerFactory.getLogger(UserDeleteFilterApplicationService::class.java) private val logger = LoggerFactory.getLogger(UserDeleteFilterApplicationService::class.java)
} }
} }
data class DeleteFilter(val filterId: Long)

View File

@ -17,6 +17,7 @@
package dev.usbharu.hideout.core.application.filter package dev.usbharu.hideout.core.application.filter
import dev.usbharu.hideout.core.application.exception.PermissionDeniedException import dev.usbharu.hideout.core.application.exception.PermissionDeniedException
import dev.usbharu.hideout.core.application.model.Filter
import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.application.shared.Transaction
import dev.usbharu.hideout.core.domain.model.filter.FilterId import dev.usbharu.hideout.core.domain.model.filter.FilterId
@ -44,3 +45,5 @@ class UserGetFilterApplicationService(private val filterRepository: FilterReposi
private val logger = LoggerFactory.getLogger(UserGetFilterApplicationService::class.java) private val logger = LoggerFactory.getLogger(UserGetFilterApplicationService::class.java)
} }
} }
data class GetFilter(val filterId: Long)

View File

@ -16,10 +16,10 @@
package dev.usbharu.hideout.core.application.filter package dev.usbharu.hideout.core.application.filter
import dev.usbharu.hideout.core.application.model.Filter
import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.application.shared.Transaction
import dev.usbharu.hideout.core.domain.model.filter.* import dev.usbharu.hideout.core.domain.model.filter.*
import dev.usbharu.hideout.core.domain.model.filter.FilterKeyword
import dev.usbharu.hideout.core.domain.model.support.principal.LocalUser import dev.usbharu.hideout.core.domain.model.support.principal.LocalUser
import dev.usbharu.hideout.core.domain.shared.id.IdGenerateService import dev.usbharu.hideout.core.domain.shared.id.IdGenerateService
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
@ -61,3 +61,15 @@ class UserRegisterFilterApplicationService(
private val logger = LoggerFactory.getLogger(UserRegisterFilterApplicationService::class.java) private val logger = LoggerFactory.getLogger(UserRegisterFilterApplicationService::class.java)
} }
} }
data class RegisterFilter(
val filterName: String,
val filterContext: Set<FilterContext>,
val filterAction: FilterAction,
val filterKeywords: Set<RegisterFilterKeyword>,
)
data class RegisterFilterKeyword(
val keyword: String,
val filterMode: FilterMode,
)

View File

@ -1,6 +1,23 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.instance package dev.usbharu.hideout.core.application.instance
import dev.usbharu.hideout.core.application.exception.InternalServerException import dev.usbharu.hideout.core.application.exception.InternalServerException
import dev.usbharu.hideout.core.application.model.Instance
import dev.usbharu.hideout.core.application.shared.AbstractApplicationService import dev.usbharu.hideout.core.application.shared.AbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.application.shared.Transaction
import dev.usbharu.hideout.core.config.ApplicationConfig import dev.usbharu.hideout.core.config.ApplicationConfig

View File

@ -1,17 +0,0 @@
package dev.usbharu.hideout.core.application.instance
import dev.usbharu.hideout.core.domain.model.instance.Instance
import java.net.URI
data class Instance(val id: Long, val name: String, val url: URI, val description: String) {
companion object {
fun of(instance: Instance): dev.usbharu.hideout.core.application.instance.Instance {
return Instance(
instance.id.instanceId,
instance.name.name,
instance.url,
instance.description.description
)
}
}
}

View File

@ -1,50 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.media
import dev.usbharu.hideout.core.domain.model.media.FileType
import dev.usbharu.hideout.core.domain.model.media.Media
import dev.usbharu.hideout.core.domain.model.media.MimeType
import java.net.URI
data class Media(
val id: Long,
val name: String,
val url: URI,
val thumbprintURI: URI?,
val remoteURL: URI?,
val type: FileType,
val mimeType: MimeType,
val blurHash: String?,
val description: String?
) {
companion object {
fun of(media: Media): dev.usbharu.hideout.core.application.media.Media {
return Media(
id = media.id.id,
name = media.name.name,
url = media.url,
thumbprintURI = media.thumbnailUrl,
remoteURL = media.remoteUrl,
type = media.type,
mimeType = media.mimeType,
blurHash = media.blurHash?.hash,
description = media.description?.description
)
}
}
}

View File

@ -16,6 +16,7 @@
package dev.usbharu.hideout.core.application.media package dev.usbharu.hideout.core.application.media
import dev.usbharu.hideout.core.application.model.MediaDetail
import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.application.shared.Transaction
import dev.usbharu.hideout.core.domain.model.media.* import dev.usbharu.hideout.core.domain.model.media.*
@ -26,6 +27,8 @@ import dev.usbharu.hideout.core.external.mediastore.MediaStore
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Qualifier import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.stereotype.Service import org.springframework.stereotype.Service
import java.net.URI
import java.nio.file.Path
import dev.usbharu.hideout.core.domain.model.media.Media as MediaModel import dev.usbharu.hideout.core.domain.model.media.Media as MediaModel
@Service @Service
@ -35,11 +38,11 @@ class UploadMediaApplicationService(
private val mediaRepository: MediaRepository, private val mediaRepository: MediaRepository,
private val idGenerateService: IdGenerateService, private val idGenerateService: IdGenerateService,
transaction: Transaction transaction: Transaction
) : LocalUserAbstractApplicationService<UploadMedia, Media>( ) : LocalUserAbstractApplicationService<UploadMedia, MediaDetail>(
transaction, transaction,
logger logger
) { ) {
override suspend fun internalExecute(command: UploadMedia, principal: LocalUser): Media { override suspend fun internalExecute(command: UploadMedia, principal: LocalUser): MediaDetail {
val process = mediaProcessor.process(command.path, command.name, null) val process = mediaProcessor.process(command.path, command.name, null)
val id = idGenerateService.generateId() val id = idGenerateService.generateId()
val thumbnailUri = if (process.thumbnailPath != null) { val thumbnailUri = if (process.thumbnailPath != null) {
@ -64,10 +67,17 @@ class UploadMediaApplicationService(
mediaRepository.save(media) mediaRepository.save(media)
return Media.of(media) return MediaDetail.of(media)
} }
companion object { companion object {
private val logger = LoggerFactory.getLogger(UploadMediaApplicationService::class.java) private val logger = LoggerFactory.getLogger(UploadMediaApplicationService::class.java)
} }
} }
data class UploadMedia(
val path: Path,
val name: String,
val remoteUri: URI?,
val description: String?
)

View File

@ -0,0 +1,57 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.model
import dev.usbharu.hideout.core.domain.model.actor.Actor
import dev.usbharu.hideout.core.domain.model.media.Media
import java.net.URI
data class ActorDetail(
val id: Long,
val name: String,
val screenName: String,
val host: String,
val instanceId: Long,
val remoteUrl: URI?,
val locked: Boolean,
val description: String,
val postsCount: Int,
val iconUrl: URI?,
val bannerURL: URI?,
val followingCount: Int?,
val followersCount: Int?,
) {
companion object {
fun of(actor: Actor, iconMedia: Media?, bannerMedia: Media?): ActorDetail {
return ActorDetail(
id = actor.id.id,
name = actor.name.name,
screenName = actor.screenName.screenName,
host = actor.url.host,
instanceId = actor.instance.instanceId,
remoteUrl = actor.url,
locked = actor.locked,
description = actor.description.description,
postsCount = actor.postsCount.postsCount,
iconUrl = iconMedia?.url,
bannerURL = bannerMedia?.url,
followingCount = actor.followingCount?.relationshipCount,
followersCount = actor.followersCount?.relationshipCount,
)
}
}
}

View File

@ -14,11 +14,11 @@
* limitations under the License. * limitations under the License.
*/ */
package dev.usbharu.hideout.core.application.application package dev.usbharu.hideout.core.application.model
import java.net.URI import java.net.URI
data class RegisteredApplication( data class Application(
val id: Long, val id: Long,
val name: String, val name: String,
val redirectUris: Set<URI>, val redirectUris: Set<URI>,

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package dev.usbharu.hideout.core.application.filter package dev.usbharu.hideout.core.application.model
import dev.usbharu.hideout.core.domain.model.filter.Filter import dev.usbharu.hideout.core.domain.model.filter.Filter
import dev.usbharu.hideout.core.domain.model.filter.FilterAction import dev.usbharu.hideout.core.domain.model.filter.FilterAction
@ -29,7 +29,7 @@ data class Filter(
val filterKeywords: Set<FilterKeyword>, val filterKeywords: Set<FilterKeyword>,
) { ) {
companion object { companion object {
fun of(filter: Filter): dev.usbharu.hideout.core.application.filter.Filter { fun of(filter: Filter): dev.usbharu.hideout.core.application.model.Filter {
return Filter( return Filter(
filterId = filter.id.id, filterId = filter.id.id,
userDetailId = filter.userDetailId.id, userDetailId = filter.userDetailId.id,

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package dev.usbharu.hideout.core.application.filter package dev.usbharu.hideout.core.application.model
import dev.usbharu.hideout.core.domain.model.filter.FilterMode import dev.usbharu.hideout.core.domain.model.filter.FilterMode

View File

@ -14,9 +14,20 @@
* limitations under the License. * limitations under the License.
*/ */
package dev.usbharu.hideout.core.application.media package dev.usbharu.hideout.core.application.model
import dev.usbharu.hideout.core.domain.model.instance.Instance
import java.net.URI import java.net.URI
import java.nio.file.Path
data class UploadMedia(val path: Path, val name: String, val remoteUri: URI?, val description: String?) data class Instance(val id: Long, val name: String, val url: URI, val description: String) {
companion object {
fun of(instance: Instance): dev.usbharu.hideout.core.application.model.Instance {
return Instance(
instance.id.instanceId,
instance.name.name,
instance.url,
instance.description.description
)
}
}
}

View File

@ -1,4 +1,20 @@
package dev.usbharu.hideout.core.application.post /*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.model
import dev.usbharu.hideout.core.domain.model.media.Media import dev.usbharu.hideout.core.domain.model.media.Media
import java.net.URI import java.net.URI

View File

@ -1,6 +1,21 @@
package dev.usbharu.hideout.core.application.post /*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.model
import dev.usbharu.hideout.core.application.model.Reactions
import dev.usbharu.hideout.core.domain.model.actor.Actor import dev.usbharu.hideout.core.domain.model.actor.Actor
import dev.usbharu.hideout.core.domain.model.media.Media import dev.usbharu.hideout.core.domain.model.media.Media
import dev.usbharu.hideout.core.domain.model.post.Post import dev.usbharu.hideout.core.domain.model.post.Post
@ -43,7 +58,7 @@ data class PostDetail(
): PostDetail { ): PostDetail {
return PostDetail( return PostDetail(
id = post.id.id, id = post.id.id,
actor = ActorDetail.of(actor, iconMedia), actor = ActorDetail.of(actor, iconMedia, null),
overview = post.overview?.overview, overview = post.overview?.overview,
text = post.text, text = post.text,
content = post.content.content, content = post.content.content,

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.model package dev.usbharu.hideout.core.application.model
import dev.usbharu.hideout.core.domain.model.emoji.CustomEmoji import dev.usbharu.hideout.core.domain.model.emoji.CustomEmoji

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package dev.usbharu.hideout.core.application.relationship.get package dev.usbharu.hideout.core.application.model
import dev.usbharu.hideout.core.domain.model.actorinstancerelationship.ActorInstanceRelationship import dev.usbharu.hideout.core.domain.model.actorinstancerelationship.ActorInstanceRelationship
import dev.usbharu.hideout.core.domain.model.relationship.Relationship import dev.usbharu.hideout.core.domain.model.relationship.Relationship
@ -38,7 +38,7 @@ data class Relationship(
relationship: Relationship, relationship: Relationship,
relationship2: Relationship, relationship2: Relationship,
actorInstanceRelationship: ActorInstanceRelationship, actorInstanceRelationship: ActorInstanceRelationship,
): dev.usbharu.hideout.core.application.relationship.get.Relationship { ): dev.usbharu.hideout.core.application.model.Relationship {
return Relationship( return Relationship(
actorId = relationship.actorId.id, actorId = relationship.actorId.id,
targetId = relationship.targetActorId.id, targetId = relationship.targetActorId.id,

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.model package dev.usbharu.hideout.core.application.model
import dev.usbharu.hideout.core.domain.model.timeline.TimelineVisibility import dev.usbharu.hideout.core.domain.model.timeline.TimelineVisibility

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package dev.usbharu.hideout.core.application.actor package dev.usbharu.hideout.core.application.model
import dev.usbharu.hideout.core.domain.model.actor.Actor import dev.usbharu.hideout.core.domain.model.actor.Actor
import dev.usbharu.hideout.core.domain.model.emoji.CustomEmoji import dev.usbharu.hideout.core.domain.model.emoji.CustomEmoji
@ -45,7 +45,7 @@ data class UserDetail(
actor: Actor, actor: Actor,
userDetail: UserDetail, userDetail: UserDetail,
customEmojis: List<CustomEmoji>, customEmojis: List<CustomEmoji>,
): dev.usbharu.hideout.core.application.actor.UserDetail { ): dev.usbharu.hideout.core.application.model.UserDetail {
return UserDetail( return UserDetail(
id = actor.id.id, id = actor.id.id,
userDetailId = userDetail.id.id, userDetailId = userDetail.id.id,

View File

@ -1,31 +0,0 @@
package dev.usbharu.hideout.core.application.post
import dev.usbharu.hideout.core.domain.model.actor.Actor
import dev.usbharu.hideout.core.domain.model.media.Media
import java.net.URI
data class ActorDetail(
val actorId: Long,
val instanceId: Long,
val name: String,
val domain: String,
val screenName: String,
val url: URI,
val locked: Boolean,
val icon: URI?,
) {
companion object {
fun of(actor: Actor, iconMedia: Media?): ActorDetail {
return ActorDetail(
actorId = actor.id.id,
instanceId = actor.instance.instanceId,
name = actor.name.name,
domain = actor.domain.domain,
screenName = actor.screenName.screenName,
url = actor.url,
locked = actor.locked,
icon = iconMedia?.url
)
}
}
}

View File

@ -1,3 +0,0 @@
package dev.usbharu.hideout.core.application.post
data class DeleteLocalPost(val postId: Long)

View File

@ -50,3 +50,5 @@ class DeleteLocalPostApplicationService(
private val logger = LoggerFactory.getLogger(DeleteLocalPostApplicationService::class.java) private val logger = LoggerFactory.getLogger(DeleteLocalPostApplicationService::class.java)
} }
} }
data class DeleteLocalPost(val postId: Long)

View File

@ -1,21 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.post
data class GetPost(
val postId: Long,
)

View File

@ -1,48 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.post
import dev.usbharu.hideout.core.application.exception.PermissionDeniedException
import dev.usbharu.hideout.core.application.shared.AbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction
import dev.usbharu.hideout.core.domain.model.post.PostId
import dev.usbharu.hideout.core.domain.model.post.PostRepository
import dev.usbharu.hideout.core.domain.model.support.principal.Principal
import dev.usbharu.hideout.core.domain.service.post.IPostReadAccessControl
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
@Service
class GetPostApplicationService(
private val postRepository: PostRepository,
private val iPostReadAccessControl: IPostReadAccessControl,
transaction: Transaction
) :
AbstractApplicationService<GetPost, Post>(transaction, logger) {
override suspend fun internalExecute(command: GetPost, principal: Principal): Post {
val post = postRepository.findById(PostId(command.postId)) ?: throw IllegalArgumentException("Post not found")
if (iPostReadAccessControl.isAllow(post, principal).not()) {
throw PermissionDeniedException()
}
return Post.of(post)
}
companion object {
private val logger = LoggerFactory.getLogger(GetPostApplicationService::class.java)
}
}

View File

@ -1,3 +0,0 @@
package dev.usbharu.hideout.core.application.post
data class GetPostDetail(val postId: Long)

View File

@ -1,6 +1,23 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.post package dev.usbharu.hideout.core.application.post
import dev.usbharu.hideout.core.application.exception.InternalServerException import dev.usbharu.hideout.core.application.exception.InternalServerException
import dev.usbharu.hideout.core.application.model.PostDetail
import dev.usbharu.hideout.core.application.shared.AbstractApplicationService import dev.usbharu.hideout.core.application.shared.AbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.application.shared.Transaction
import dev.usbharu.hideout.core.domain.model.actor.Actor import dev.usbharu.hideout.core.domain.model.actor.Actor
@ -97,3 +114,5 @@ class GetPostDetailApplicationService(
private val logger = LoggerFactory.getLogger(GetPostDetailApplicationService::class.java) private val logger = LoggerFactory.getLogger(GetPostDetailApplicationService::class.java)
} }
} }
data class GetPostDetail(val postId: Long)

View File

@ -1,58 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.post
import dev.usbharu.hideout.core.domain.model.post.Post
import dev.usbharu.hideout.core.domain.model.post.Visibility
import java.net.URI
import java.time.Instant
data class Post(
val id: Long,
val actorId: Long,
val overview: String?,
val text: String,
val content: String,
val createdAt: Instant,
val visibility: Visibility,
val url: URI,
val repostId: Long?,
val replyId: Long?,
val sensitive: Boolean,
val mediaIds: List<Long>,
val moveTo: Long?,
) {
companion object {
fun of(post: Post): dev.usbharu.hideout.core.application.post.Post {
return Post(
id = post.id.id,
actorId = post.actorId.id,
overview = post.overview?.overview,
text = post.text,
content = post.content.content,
createdAt = post.createdAt,
visibility = post.visibility,
url = post.url,
repostId = post.repostId?.id,
replyId = post.replyId?.id,
sensitive = post.sensitive,
mediaIds = post.mediaIds.map { it.id },
moveTo = post.moveTo?.id
)
}
}
}

View File

@ -1,29 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.post
import dev.usbharu.hideout.core.domain.model.post.Visibility
data class RegisterLocalPost(
val content: String,
val overview: String?,
val visibility: Visibility,
val repostId: Long?,
val replyId: Long?,
val sensitive: Boolean,
val mediaIds: List<Long>,
)

View File

@ -24,6 +24,7 @@ import dev.usbharu.hideout.core.domain.model.media.MediaId
import dev.usbharu.hideout.core.domain.model.post.PostId import dev.usbharu.hideout.core.domain.model.post.PostId
import dev.usbharu.hideout.core.domain.model.post.PostOverview import dev.usbharu.hideout.core.domain.model.post.PostOverview
import dev.usbharu.hideout.core.domain.model.post.PostRepository import dev.usbharu.hideout.core.domain.model.post.PostRepository
import dev.usbharu.hideout.core.domain.model.post.Visibility
import dev.usbharu.hideout.core.domain.model.support.principal.LocalUser import dev.usbharu.hideout.core.domain.model.support.principal.LocalUser
import dev.usbharu.hideout.core.infrastructure.factory.PostFactoryImpl import dev.usbharu.hideout.core.infrastructure.factory.PostFactoryImpl
import org.slf4j.Logger import org.slf4j.Logger
@ -64,3 +65,13 @@ class RegisterLocalPostApplicationService(
val logger: Logger = LoggerFactory.getLogger(RegisterLocalPostApplicationService::class.java) val logger: Logger = LoggerFactory.getLogger(RegisterLocalPostApplicationService::class.java)
} }
} }
data class RegisterLocalPost(
val content: String,
val overview: String?,
val visibility: Visibility,
val repostId: Long?,
val replyId: Long?,
val sensitive: Boolean,
val mediaIds: List<Long>,
)

View File

@ -1,25 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.post
data class UpdateLocalNote(
val postId: Long,
val overview: String?,
val content: String,
val sensitive: Boolean,
val mediaIds: List<Long>
)

View File

@ -64,3 +64,11 @@ class UpdateLocalNoteApplicationService(
private val logger = LoggerFactory.getLogger(UpdateLocalNoteApplicationService::class.java) private val logger = LoggerFactory.getLogger(UpdateLocalNoteApplicationService::class.java)
} }
} }
data class UpdateLocalNote(
val postId: Long,
val overview: String?,
val content: String,
val sensitive: Boolean,
val mediaIds: List<Long>
)

View File

@ -1,3 +0,0 @@
package dev.usbharu.hideout.core.application.reaction
data class CreateReaction(val postId: Long, val customEmojiId: Long?, val unicodeEmoji: String)

View File

@ -1,7 +0,0 @@
package dev.usbharu.hideout.core.application.reaction
data class RemoveReaction(
val postId: Long,
val customEmojiId: Long?,
val unicodeEmoji: String
)

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.reaction package dev.usbharu.hideout.core.application.reaction
import dev.usbharu.hideout.core.application.exception.PermissionDeniedException import dev.usbharu.hideout.core.application.exception.PermissionDeniedException
@ -63,3 +79,5 @@ class UserCreateReactionApplicationService(
private val logger = LoggerFactory.getLogger(UserCreateReactionApplicationService::class.java) private val logger = LoggerFactory.getLogger(UserCreateReactionApplicationService::class.java)
} }
} }
data class CreateReaction(val postId: Long, val customEmojiId: Long?, val unicodeEmoji: String)

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.reaction package dev.usbharu.hideout.core.application.reaction
import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService
@ -49,3 +65,9 @@ class UserRemoveReactionApplicationService(
private val logger = LoggerFactory.getLogger(UserRemoveReactionApplicationService::class.java) private val logger = LoggerFactory.getLogger(UserRemoveReactionApplicationService::class.java)
} }
} }
data class RemoveReaction(
val postId: Long,
val customEmojiId: Long?,
val unicodeEmoji: String
)

View File

@ -14,9 +14,10 @@
* limitations under the License. * limitations under the License.
*/ */
package dev.usbharu.hideout.core.application.relationship.get package dev.usbharu.hideout.core.application.relationship
import dev.usbharu.hideout.core.application.exception.InternalServerException import dev.usbharu.hideout.core.application.exception.InternalServerException
import dev.usbharu.hideout.core.application.model.Relationship
import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.application.shared.Transaction
import dev.usbharu.hideout.core.domain.model.actor.ActorId import dev.usbharu.hideout.core.domain.model.actor.ActorId
@ -69,3 +70,5 @@ class GetRelationshipApplicationService(
private val logger = LoggerFactory.getLogger(GetRelationshipApplicationService::class.java) private val logger = LoggerFactory.getLogger(GetRelationshipApplicationService::class.java)
} }
} }
data class GetRelationship(val targetActorId: Long)

View File

@ -14,10 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package dev.usbharu.hideout.core.application.relationship.acceptfollowrequest package dev.usbharu.hideout.core.application.relationship
import dev.usbharu.hideout.core.application.exception.InternalServerException import dev.usbharu.hideout.core.application.exception.InternalServerException
import dev.usbharu.hideout.core.application.relationship.block.UserBlockApplicationService
import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.application.shared.Transaction
import dev.usbharu.hideout.core.domain.model.actor.ActorId import dev.usbharu.hideout.core.domain.model.actor.ActorId
@ -52,3 +51,5 @@ class UserAcceptFollowRequestApplicationService(
private val logger = LoggerFactory.getLogger(UserBlockApplicationService::class.java) private val logger = LoggerFactory.getLogger(UserBlockApplicationService::class.java)
} }
} }
data class AcceptFollowRequest(val sourceActorId: Long)

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package dev.usbharu.hideout.core.application.relationship.block package dev.usbharu.hideout.core.application.relationship
import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.application.shared.Transaction
@ -61,3 +61,5 @@ class UserBlockApplicationService(
private val logger = LoggerFactory.getLogger(UserBlockApplicationService::class.java) private val logger = LoggerFactory.getLogger(UserBlockApplicationService::class.java)
} }
} }
data class Block(val targetActorId: Long)

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package dev.usbharu.hideout.core.application.relationship.followrequest package dev.usbharu.hideout.core.application.relationship
import dev.usbharu.hideout.core.application.exception.InternalServerException import dev.usbharu.hideout.core.application.exception.InternalServerException
import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService
@ -56,3 +56,5 @@ class UserFollowRequestApplicationService(
private val logger = LoggerFactory.getLogger(UserFollowRequestApplicationService::class.java) private val logger = LoggerFactory.getLogger(UserFollowRequestApplicationService::class.java)
} }
} }
data class FollowRequest(val targetActorId: Long)

View File

@ -14,10 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package dev.usbharu.hideout.core.application.relationship.mute package dev.usbharu.hideout.core.application.relationship
import dev.usbharu.hideout.core.application.exception.InternalServerException import dev.usbharu.hideout.core.application.exception.InternalServerException
import dev.usbharu.hideout.core.application.relationship.block.UserBlockApplicationService
import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.application.shared.Transaction
import dev.usbharu.hideout.core.domain.model.actor.ActorId import dev.usbharu.hideout.core.domain.model.actor.ActorId
@ -54,3 +53,5 @@ class UserMuteApplicationService(
private val logger = LoggerFactory.getLogger(UserBlockApplicationService::class.java) private val logger = LoggerFactory.getLogger(UserBlockApplicationService::class.java)
} }
} }
data class Mute(val targetActorId: Long)

View File

@ -14,10 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package dev.usbharu.hideout.core.application.relationship.rejectfollowrequest package dev.usbharu.hideout.core.application.relationship
import dev.usbharu.hideout.core.application.exception.InternalServerException import dev.usbharu.hideout.core.application.exception.InternalServerException
import dev.usbharu.hideout.core.application.relationship.block.UserBlockApplicationService
import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.application.shared.Transaction
import dev.usbharu.hideout.core.domain.model.actor.ActorId import dev.usbharu.hideout.core.domain.model.actor.ActorId
@ -52,3 +51,5 @@ class UserRejectFollowRequestApplicationService(
private val logger = LoggerFactory.getLogger(UserBlockApplicationService::class.java) private val logger = LoggerFactory.getLogger(UserBlockApplicationService::class.java)
} }
} }
data class RejectFollowRequest(val sourceActorId: Long)

View File

@ -14,10 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package dev.usbharu.hideout.core.application.relationship.removefromfollowers package dev.usbharu.hideout.core.application.relationship
import dev.usbharu.hideout.core.application.exception.InternalServerException import dev.usbharu.hideout.core.application.exception.InternalServerException
import dev.usbharu.hideout.core.application.relationship.block.UserBlockApplicationService
import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.application.shared.Transaction
import dev.usbharu.hideout.core.domain.model.actor.ActorId import dev.usbharu.hideout.core.domain.model.actor.ActorId
@ -54,3 +53,5 @@ class UserRemoveFromFollowersApplicationService(
private val logger = LoggerFactory.getLogger(UserBlockApplicationService::class.java) private val logger = LoggerFactory.getLogger(UserBlockApplicationService::class.java)
} }
} }
data class RemoveFromFollowers(val targetActorId: Long)

View File

@ -14,10 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package dev.usbharu.hideout.core.application.relationship.unblock package dev.usbharu.hideout.core.application.relationship
import dev.usbharu.hideout.core.application.exception.InternalServerException import dev.usbharu.hideout.core.application.exception.InternalServerException
import dev.usbharu.hideout.core.application.relationship.block.UserBlockApplicationService
import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.application.shared.Transaction
import dev.usbharu.hideout.core.domain.model.actor.ActorId import dev.usbharu.hideout.core.domain.model.actor.ActorId
@ -54,3 +53,5 @@ class UserUnblockApplicationService(
private val logger = LoggerFactory.getLogger(UserBlockApplicationService::class.java) private val logger = LoggerFactory.getLogger(UserBlockApplicationService::class.java)
} }
} }
data class Unblock(val targetActorId: Long)

View File

@ -14,10 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package dev.usbharu.hideout.core.application.relationship.unfollow package dev.usbharu.hideout.core.application.relationship
import dev.usbharu.hideout.core.application.exception.InternalServerException import dev.usbharu.hideout.core.application.exception.InternalServerException
import dev.usbharu.hideout.core.application.relationship.block.UserBlockApplicationService
import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.application.shared.Transaction
import dev.usbharu.hideout.core.domain.model.actor.ActorId import dev.usbharu.hideout.core.domain.model.actor.ActorId
@ -54,3 +53,5 @@ class UserUnfollowApplicationService(
private val logger = LoggerFactory.getLogger(UserBlockApplicationService::class.java) private val logger = LoggerFactory.getLogger(UserBlockApplicationService::class.java)
} }
} }
data class Unfollow(val targetActorId: Long)

View File

@ -14,10 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package dev.usbharu.hideout.core.application.relationship.unmute package dev.usbharu.hideout.core.application.relationship
import dev.usbharu.hideout.core.application.exception.InternalServerException import dev.usbharu.hideout.core.application.exception.InternalServerException
import dev.usbharu.hideout.core.application.relationship.block.UserBlockApplicationService
import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService import dev.usbharu.hideout.core.application.shared.LocalUserAbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.application.shared.Transaction
import dev.usbharu.hideout.core.domain.model.actor.ActorId import dev.usbharu.hideout.core.domain.model.actor.ActorId
@ -54,3 +53,5 @@ class UserUnmuteApplicationService(
private val logger = LoggerFactory.getLogger(UserBlockApplicationService::class.java) private val logger = LoggerFactory.getLogger(UserBlockApplicationService::class.java)
} }
} }
data class Unmute(val targetActorId: Long)

View File

@ -1,19 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.relationship.acceptfollowrequest
data class AcceptFollowRequest(val sourceActorId: Long)

View File

@ -1,19 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.relationship.block
data class Block(val targetActorId: Long)

View File

@ -1,19 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.relationship.followrequest
data class FollowRequest(val targetActorId: Long)

View File

@ -1,19 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.relationship.get
data class GetRelationship(val targetActorId: Long)

View File

@ -1,19 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.relationship.mute
data class Mute(val targetActorId: Long)

View File

@ -1,19 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.relationship.rejectfollowrequest
data class RejectFollowRequest(val sourceActorId: Long)

View File

@ -1,19 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.relationship.removefromfollowers
data class RemoveFromFollowers(val targetActorId: Long)

View File

@ -1,19 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.relationship.unblock
data class Unblock(val targetActorId: Long)

View File

@ -1,19 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.relationship.unfollow
data class Unfollow(val targetActorId: Long)

View File

@ -1,19 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.relationship.unmute
data class Unmute(val targetActorId: Long)

View File

@ -1,3 +1,19 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.shared package dev.usbharu.hideout.core.application.shared
import dev.usbharu.hideout.core.application.exception.PermissionDeniedException import dev.usbharu.hideout.core.application.exception.PermissionDeniedException

View File

@ -1,5 +0,0 @@
package dev.usbharu.hideout.core.application.timeline
import dev.usbharu.hideout.core.domain.model.post.PostId
data class AddPost(val postId: PostId)

View File

@ -1,11 +0,0 @@
package dev.usbharu.hideout.core.application.timeline
import dev.usbharu.hideout.core.domain.model.actor.ActorId
import dev.usbharu.hideout.core.domain.model.timeline.TimelineId
import dev.usbharu.hideout.core.domain.model.timelinerelationship.Visible
data class AddTimelineRelationship(
val timelineId: TimelineId,
val actorId: ActorId,
val visible: Visible
)

View File

@ -1,3 +0,0 @@
package dev.usbharu.hideout.core.application.timeline
data class GetTimelines(val userDetailId: Long)

View File

@ -1,5 +0,0 @@
package dev.usbharu.hideout.core.application.timeline
import dev.usbharu.hideout.core.domain.model.support.page.Page
data class GetUserTimeline(val id: Long, val page: Page)

View File

@ -1,12 +1,29 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.hideout.core.application.timeline package dev.usbharu.hideout.core.application.timeline
import dev.usbharu.hideout.core.application.post.PostDetail import dev.usbharu.hideout.core.application.model.PostDetail
import dev.usbharu.hideout.core.application.shared.AbstractApplicationService import dev.usbharu.hideout.core.application.shared.AbstractApplicationService
import dev.usbharu.hideout.core.application.shared.Transaction import dev.usbharu.hideout.core.application.shared.Transaction
import dev.usbharu.hideout.core.domain.model.actor.ActorId import dev.usbharu.hideout.core.domain.model.actor.ActorId
import dev.usbharu.hideout.core.domain.model.post.PostId import dev.usbharu.hideout.core.domain.model.post.PostId
import dev.usbharu.hideout.core.domain.model.post.PostRepository import dev.usbharu.hideout.core.domain.model.post.PostRepository
import dev.usbharu.hideout.core.domain.model.post.Visibility import dev.usbharu.hideout.core.domain.model.post.Visibility
import dev.usbharu.hideout.core.domain.model.support.page.Page
import dev.usbharu.hideout.core.domain.model.support.page.PaginationList import dev.usbharu.hideout.core.domain.model.support.page.PaginationList
import dev.usbharu.hideout.core.domain.model.support.principal.Principal import dev.usbharu.hideout.core.domain.model.support.principal.Principal
import dev.usbharu.hideout.core.query.usertimeline.UserTimelineQueryService import dev.usbharu.hideout.core.query.usertimeline.UserTimelineQueryService
@ -51,3 +68,5 @@ class GetUserTimelineApplicationService(
private val logger = LoggerFactory.getLogger(GetUserTimelineApplicationService::class.java) private val logger = LoggerFactory.getLogger(GetUserTimelineApplicationService::class.java)
} }
} }
data class GetUserTimeline(val id: Long, val page: Page)

View File

@ -1,11 +0,0 @@
package dev.usbharu.hideout.core.application.timeline
import dev.usbharu.hideout.core.domain.model.support.page.Page
data class ReadTimeline(
val timelineId: Long,
val mediaOnly: Boolean,
val localOnly: Boolean,
val remoteOnly: Boolean,
val page: Page
)

Some files were not shown because too many files have changed in this diff Show More