mirror of https://github.com/usbharu/Hideout.git
feat: 不要なものを削除
This commit is contained in:
parent
e67b60197f
commit
19e44c4675
|
@ -17,7 +17,7 @@ plugins {
|
|||
id("com.google.devtools.ksp") version "1.8.21-1.0.11"
|
||||
id("org.springframework.boot") version "3.1.2"
|
||||
kotlin("plugin.spring") version "1.8.21"
|
||||
id("org.openapi.generator") version "6.6.0"
|
||||
id("org.openapi.generator") version "7.0.1"
|
||||
// id("org.jetbrains.kotlin.plugin.serialization") version "1.8.10"
|
||||
}
|
||||
|
||||
|
@ -47,8 +47,8 @@ tasks.withType<KotlinCompile> {
|
|||
kotlinOptions {
|
||||
freeCompilerArgs += "-Xjsr305=strict"
|
||||
}
|
||||
dependsOn("openApiGenerateServer")
|
||||
mustRunAfter("openApiGenerateServer")
|
||||
dependsOn("openApiGenerateMastodonCompatibleApi")
|
||||
mustRunAfter("openApiGenerateMastodonCompatibleApi")
|
||||
}
|
||||
|
||||
tasks.withType<ShadowJar> {
|
||||
|
@ -63,34 +63,34 @@ tasks.clean {
|
|||
delete += listOf("$rootDir/src/main/resources/static")
|
||||
}
|
||||
|
||||
tasks.create<GenerateTask>("openApiGenerateServer", GenerateTask::class) {
|
||||
generatorName.set("kotlin-spring")
|
||||
inputSpec.set("$rootDir/src/main/resources/openapi/api.yaml")
|
||||
outputDir.set("$buildDir/generated/sources/openapi")
|
||||
apiPackage.set("dev.usbharu.hideout.controller.generated")
|
||||
modelPackage.set("dev.usbharu.hideout.domain.model.generated")
|
||||
configOptions.put("interfaceOnly", "true")
|
||||
configOptions.put("useSpringBoot3", "true")
|
||||
additionalProperties.put("useTags", "true")
|
||||
schemaMappings.putAll(
|
||||
mapOf(
|
||||
"ReactionResponse" to "dev.usbharu.hideout.domain.model.hideout.dto.ReactionResponse",
|
||||
"Account" to "dev.usbharu.hideout.domain.model.hideout.dto.Account",
|
||||
"JwtToken" to "dev.usbharu.hideout.domain.model.hideout.dto.JwtToken",
|
||||
"PostRequest" to "dev.usbharu.hideout.domain.model.hideout.form.Post",
|
||||
"PostResponse" to "dev.usbharu.hideout.domain.model.hideout.dto.PostResponse",
|
||||
"Reaction" to "dev.usbharu.hideout.domain.model.hideout.form.Reaction",
|
||||
"RefreshToken" to "dev.usbharu.hideout.domain.model.hideout.form.RefreshToken",
|
||||
"UserLogin" to "dev.usbharu.hideout.domain.model.hideout.form.UserLogin",
|
||||
"UserResponse" to "dev.usbharu.hideout.domain.model.hideout.dto.UserResponse",
|
||||
"UserCreate" to "dev.usbharu.hideout.domain.model.hideout.form.UserCreate",
|
||||
"Visibility" to "dev.usbharu.hideout.domain.model.hideout.entity.Visibility",
|
||||
)
|
||||
)
|
||||
|
||||
// importMappings.putAll(mapOf("ReactionResponse" to "ReactionResponse"))
|
||||
// typeMappings.putAll(mapOf("ReactionResponse" to "ReactionResponse"))
|
||||
}
|
||||
//tasks.create<GenerateTask>("openApiGenerateServer", GenerateTask::class) {
|
||||
// generatorName.set("kotlin-spring")
|
||||
// inputSpec.set("$rootDir/src/main/resources/openapi/api.yaml")
|
||||
// outputDir.set("$buildDir/generated/sources/openapi")
|
||||
// apiPackage.set("dev.usbharu.hideout.controller.generated")
|
||||
// modelPackage.set("dev.usbharu.hideout.domain.model.generated")
|
||||
// configOptions.put("interfaceOnly", "true")
|
||||
// configOptions.put("useSpringBoot3", "true")
|
||||
// additionalProperties.put("useTags", "true")
|
||||
// schemaMappings.putAll(
|
||||
// mapOf(
|
||||
// "ReactionResponse" to "dev.usbharu.hideout.domain.model.hideout.dto.ReactionResponse",
|
||||
// "Account" to "dev.usbharu.hideout.domain.model.hideout.dto.Account",
|
||||
// "JwtToken" to "dev.usbharu.hideout.domain.model.hideout.dto.JwtToken",
|
||||
// "PostRequest" to "dev.usbharu.hideout.domain.model.hideout.form.Post",
|
||||
// "PostResponse" to "dev.usbharu.hideout.domain.model.hideout.dto.PostResponse",
|
||||
// "Reaction" to "dev.usbharu.hideout.domain.model.hideout.form.Reaction",
|
||||
// "RefreshToken" to "dev.usbharu.hideout.domain.model.hideout.form.RefreshToken",
|
||||
// "UserLogin" to "dev.usbharu.hideout.domain.model.hideout.form.UserLogin",
|
||||
// "UserResponse" to "dev.usbharu.hideout.domain.model.hideout.dto.UserResponse",
|
||||
// "UserCreate" to "dev.usbharu.hideout.domain.model.hideout.form.UserCreate",
|
||||
// "Visibility" to "dev.usbharu.hideout.domain.model.hideout.entity.Visibility",
|
||||
// )
|
||||
// )
|
||||
//
|
||||
//// importMappings.putAll(mapOf("ReactionResponse" to "ReactionResponse"))
|
||||
//// typeMappings.putAll(mapOf("ReactionResponse" to "ReactionResponse"))
|
||||
//}
|
||||
|
||||
tasks.create<GenerateTask>("openApiGenerateMastodonCompatibleApi", GenerateTask::class) {
|
||||
generatorName.set("kotlin-spring")
|
||||
|
|
|
@ -7,11 +7,14 @@ import org.springframework.context.annotation.Bean
|
|||
import org.springframework.context.annotation.Configuration
|
||||
|
||||
@Configuration
|
||||
class DatabaseConfig {
|
||||
class SpringConfig {
|
||||
|
||||
@Autowired
|
||||
lateinit var dbConfig: DatabaseConnectConfig
|
||||
|
||||
@Autowired
|
||||
lateinit var config: ApplicationConfig
|
||||
|
||||
@Bean
|
||||
fun database(): Database {
|
||||
return Database.connect(
|
||||
|
@ -23,6 +26,11 @@ class DatabaseConfig {
|
|||
}
|
||||
}
|
||||
|
||||
@ConfigurationProperties("hideout")
|
||||
data class ApplicationConfig(
|
||||
val url: String
|
||||
)
|
||||
|
||||
@ConfigurationProperties("hideout.database")
|
||||
data class DatabaseConnectConfig(
|
||||
val url: String,
|
|
@ -1,15 +0,0 @@
|
|||
package dev.usbharu.hideout.controller
|
||||
|
||||
import dev.usbharu.hideout.controller.generated.DefaultApi
|
||||
import dev.usbharu.hideout.domain.model.hideout.dto.JwtToken
|
||||
import dev.usbharu.hideout.service.api.UserAuthApiService
|
||||
import org.springframework.http.HttpStatus
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.stereotype.Controller
|
||||
|
||||
@Controller
|
||||
class DefaultApiImpl(private val userAuthApiService: UserAuthApiService) : DefaultApi {
|
||||
override fun refreshTokenPost(): ResponseEntity<JwtToken> {
|
||||
return ResponseEntity(HttpStatus.OK)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package dev.usbharu.hideout.controller.mastodon
|
||||
|
||||
import dev.usbharu.hideout.controller.mastodon.generated.DefaultApi
|
||||
import dev.usbharu.hideout.domain.mastodon.model.generated.V1Instance
|
||||
import dev.usbharu.hideout.service.api.mastodon.InstanceApiService
|
||||
import org.springframework.http.HttpStatus
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.stereotype.Controller
|
||||
|
||||
@Controller
|
||||
class MastodonApiController(private val instanceApiService: InstanceApiService) : DefaultApi {
|
||||
override suspend fun apiV1InstanceGet(): ResponseEntity<V1Instance> {
|
||||
return ResponseEntity(instanceApiService.v1Instance(), HttpStatus.OK)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package dev.usbharu.hideout.service.api.mastodon
|
||||
|
||||
import dev.usbharu.hideout.config.ApplicationConfig
|
||||
import dev.usbharu.hideout.domain.mastodon.model.generated.*
|
||||
import org.springframework.stereotype.Service
|
||||
import java.net.URL
|
||||
|
||||
@Service
|
||||
interface InstanceApiService {
|
||||
suspend fun v1Instance(): V1Instance
|
||||
}
|
||||
|
||||
@Service
|
||||
class InstanceApiServiceImpl(private val applicationConfig: ApplicationConfig) : InstanceApiService {
|
||||
override suspend fun v1Instance(): V1Instance {
|
||||
val url = applicationConfig.url
|
||||
val url1 = URL(url)
|
||||
return V1Instance(
|
||||
uri = url1.host,
|
||||
title = "Hideout Server",
|
||||
shortDescription = "Hideout test server",
|
||||
description = "This server is operated for testing of Hideout. We are not responsible for any events that occur when associating with this server",
|
||||
email = "i@usbharu.dev",
|
||||
version = "0.0.1",
|
||||
urls = V1InstanceUrls("wss://${url1.host}"),
|
||||
stats = V1InstanceStats(1, 0, 0),
|
||||
thumbnail = null,
|
||||
languages = listOf("ja-JP"),
|
||||
registrations = false,
|
||||
approvalRequired = false,
|
||||
invitesEnabled = false,
|
||||
configuration = V1InstanceConfiguration(
|
||||
accounts = V1InstanceConfigurationAccounts(1),
|
||||
statuses = V1InstanceConfigurationStatuses(
|
||||
300,
|
||||
4,
|
||||
23
|
||||
),
|
||||
mediaAttachments = V1InstanceConfigurationMediaAttachments(
|
||||
listOf(),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
),
|
||||
polls = V1InstanceConfigurationPolls(
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
)
|
||||
),
|
||||
contactAccount = Account(
|
||||
id = "0",
|
||||
username = "",
|
||||
acct = "",
|
||||
url = "",
|
||||
displayName = "",
|
||||
note = "",
|
||||
avatar = "",
|
||||
avatarStatic = "",
|
||||
header = "",
|
||||
headerStatic = "",
|
||||
locked = false,
|
||||
fields = emptyList(),
|
||||
emojis = emptyList(),
|
||||
bot = false,
|
||||
group = false,
|
||||
discoverable = false,
|
||||
createdAt = "0",
|
||||
lastStatusAt = "0",
|
||||
statusesCount = 1,
|
||||
followersCount = 0,
|
||||
noindex = false,
|
||||
moved = false,
|
||||
suspendex = false,
|
||||
limited = false,
|
||||
followingCount = 0
|
||||
),
|
||||
rules = emptyList()
|
||||
)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package dev.usbharu.hideout.service.mastodon
|
||||
|
||||
import org.springframework.stereotype.Service
|
||||
|
||||
@Service
|
||||
interface AccountService {
|
||||
suspend fun findById()
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
hideout:
|
||||
url: "http://localhost:8080"
|
||||
database:
|
||||
url: "jdbc:h2:./test;MODE=POSTGRESQL"
|
||||
driver: "org.h2.Driver"
|
||||
|
|
|
@ -700,12 +700,37 @@ components:
|
|||
type: boolean
|
||||
configuration:
|
||||
$ref: "#/components/schemas/V1InstanceConfiguration"
|
||||
contact_account:
|
||||
$ref: "#/components/schemas/Account"
|
||||
rules:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/Rule"
|
||||
required:
|
||||
- uri
|
||||
- title
|
||||
- short_description
|
||||
- description
|
||||
- email
|
||||
- version
|
||||
- urls
|
||||
- stats
|
||||
- thumbnail
|
||||
- languages
|
||||
- registrations
|
||||
- approval_required
|
||||
- invites_enabled
|
||||
- configuration
|
||||
- contact_account
|
||||
- rules
|
||||
|
||||
V1InstanceUrls:
|
||||
type: object
|
||||
properties:
|
||||
streaming_api:
|
||||
type: string
|
||||
required:
|
||||
- streaming_api
|
||||
|
||||
V1InstanceStats:
|
||||
type: object
|
||||
|
@ -716,6 +741,10 @@ components:
|
|||
type: integer
|
||||
domain_count:
|
||||
type: integer
|
||||
required:
|
||||
- user_count
|
||||
- status_count
|
||||
- domain_count
|
||||
|
||||
V1InstanceConfiguration:
|
||||
type: object
|
||||
|
@ -728,12 +757,12 @@ components:
|
|||
$ref: "#/components/schemas/V1InstanceConfigurationMediaAttachments"
|
||||
polls:
|
||||
$ref: "#/components/schemas/V1InstanceConfigurationPolls"
|
||||
contact_account:
|
||||
$ref: "#/components/schemas/Account"
|
||||
rules:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/Rule"
|
||||
required:
|
||||
- accounts
|
||||
- statuses
|
||||
- media_attachments
|
||||
- polls
|
||||
|
||||
|
||||
V1InstanceConfigurationAccounts:
|
||||
type: object
|
||||
|
|
Loading…
Reference in New Issue