feat: Add script to refresh README from OpenAPI document

refactor: Improve error handling in PowerDNSAPIClient and streamline response processing

fix: Update RecordController to directly return records without unnecessary mapping

refactor: Update DomainRepository and RecordRepository to remove nullable types for IDs

fix: Change User domains fetch strategy to lazy loading for performance improvement

fix: Enhance user authentication handling in UserFilter to ensure authenticated user presence

refactor: Improve DomainService to enforce ownership checks before domain deletion

refactor: Update RecordService to streamline record retrieval and ensure proper domain association

test: Add OpenAPI generation test to validate API documentation endpoint

test: Implement PowerDNSAPIClient tests to verify HTTP method usage and error handling

test: Create DomainService tests to validate domain ownership and deletion logic

test: Add application-test.properties for in-memory database configuration during tests
This commit is contained in:
dalbodeule committed 2026-10-29 23:11:21 +09:00
1 parent 5936622f64
commit 47461c505f
24 files changed
+920 -1329

No files matched your search

+60 -30
View File
@@ -1,26 +1,34 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
plugins {
id("java")
id("org.springframework.boot") version "3.3.0"
id("io.spring.dependency-management") version "1.1.5"
id("org.hibernate.orm") version "6.5.2.Final"
id("org.graalvm.buildtools.native") version "0.10.2"
kotlin("jvm") version "1.9.24"
kotlin("plugin.spring") version "1.9.24"
kotlin("plugin.jpa") version "1.9.24"
id("org.springframework.boot") version "4.1.2"
id("io.spring.dependency-management") version "1.1.7"
id("org.hibernate.orm") version "7.1.4.Final"
id("org.graalvm.buildtools.native") version "1.1.17"
kotlin("jvm") version "2.4.21"
kotlin("plugin.spring") version "2.4.21"
kotlin("plugin.jpa") version "2.4.21"
}
val datetimeFormatter: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMddHHmm")
val jvmVersion = 25
group = "space.mori"
version = "0.0.1"
version = "1.0.0"
java {
sourceCompatibility = JavaVersion.VERSION_21
toolchain.languageVersion.set(JavaLanguageVersion.of(jvmVersion))
}
kotlin {
compilerOptions {
freeCompilerArgs.add("-Xjsr305=strict")
jvmTarget.set(JvmTarget.fromTarget(jvmVersion.toString()))
}
}
repositories {
@@ -31,40 +39,64 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.springframework.boot:spring-boot-starter-webmvc")
implementation("tools.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:3.2.0")
// https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-bindings
implementation("org.springframework.cloud:spring-cloud-bindings:2.0.3")
implementation("org.springframework.cloud:spring-cloud-bindings:2.0.4")
implementation("com.google.code.gson:gson:2.11.0")
implementation("io.github.cdimascio:dotenv-kotlin:6.4.1")
implementation("com.google.code.gson:gson:2.15.0")
implementation("io.github.cdimascio:dotenv-kotlin:6.5.1")
// https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
implementation("com.squareup.okhttp3:okhttp:4.12.0")
implementation("com.squareup.okhttp3:okhttp:5.5.1")
runtimeOnly("org.mariadb.jdbc:mariadb-java-client")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.security:spring-security-test")
testImplementation("com.squareup.okhttp3:mockwebserver3:5.5.1")
testRuntimeOnly("com.h2database:h2")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
jvmTarget = "21"
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.named<Test>("test") {
useJUnitPlatform { excludeTags("openapi-generation") }
}
tasks.register<Test>("generateOpenApi") {
group = "documentation"
description = "Generate the root openapi.json from the running Spring application"
dependsOn(tasks.testClasses)
testClassesDirs = sourceSets.test.get().output.classesDirs
classpath = sourceSets.test.get().runtimeClasspath
useJUnitPlatform { includeTags("openapi-generation") }
val openApiFile = layout.projectDirectory.file("openapi.json")
outputs.file(openApiFile)
systemProperty("openapi.output", openApiFile.asFile.absolutePath)
}
tasks.register<Exec>("updateReadme") {
group = "documentation"
description = "Update README.md from the generated OpenAPI document"
dependsOn("generateOpenApi")
commandLine("python3", "scripts/update_readme.py")
}
tasks.register("updateDocs") {
group = "documentation"
description = "Refresh openapi.json and README.md"
dependsOn("updateReadme")
}
tasks.withType<BootBuildImage> {
val dockerId = System.getenv("DOCKER_USERNAME") ?: "git.mori.space/dalbodeule"
val dockerId = System.getenv("DOCKER_USERNAME") ?: "dalbodeule"
val dockerPw = System.getenv("DOCKER_PASSWORD") ?: ""
docker {
@@ -83,14 +115,12 @@ tasks.withType<BootBuildImage> {
"BP_NATIVE_IMAGE" to "true",
"BP_NATIVE_IMAGE_BUILD_ARGUMENTS" to "-H:+UnlockExperimentalVMOptions",
"BP_JVM_TYPE" to "JDK",
"BP_JVM_VERSION" to "21",
"BP_JVM_VERSION" to jvmVersion.toString(),
)
}
hibernate {
enhancement {
enableAssociationManagement.set(true)
}
enhancement {}
}
tasks.named<org.springframework.boot.gradle.tasks.run.BootRun>("bootRun") {
@@ -101,4 +131,4 @@ graalvmNative {
binaries.all {
buildArgs.add("--initialize-at-build-time=org.slf4j.helpers")
}
}
}