add first comic endpoints to kontor-quarkus

This commit is contained in:
2026-01-18 01:39:52 +01:00
parent a031c5cc99
commit a788381eaa
6 changed files with 82 additions and 10 deletions
+5 -2
View File
@@ -14,8 +14,8 @@ val quarkusPlatformArtifactId: String by project
val quarkusPlatformVersion: String by project
dependencies {
implementation("io.quarkus:quarkus-container-image-docker")
implementation(enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}"))
implementation("io.quarkus:quarkus-container-image-docker")
implementation("io.quarkus:quarkus-rest-jackson")
implementation("io.quarkus:quarkus-kotlin")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
@@ -23,12 +23,15 @@ dependencies {
implementation("io.quarkus:quarkus-rest")
implementation("io.quarkus:quarkus-smallrye-openapi")
implementation("io.quarkus:quarkus-smallrye-health")
implementation("io.quarkus:quarkus-hibernate-orm-panache-kotlin")
implementation("io.quarkus:quarkus-jdbc-h2")
implementation("io.quarkus:quarkus-jdbc-postgresql")
testImplementation("io.quarkus:quarkus-junit5")
testImplementation("io.rest-assured:rest-assured")
}
group = "de.thpeetz"
version = "1.0.0-SNAPSHOT"
version = "0.2.0-SNAPSHOT"
java {
sourceCompatibility = JavaVersion.VERSION_21
@@ -1,8 +0,0 @@
package de.thpeetz
import org.eclipse.microprofile.openapi.annotations.OpenAPIDefinition
import org.eclipse.microprofile.openapi.annotations.info.Info
import jakarta.ws.rs.core.Application
@OpenAPIDefinition(info = Info(title = "Kontor", version = "0.2.0"))
class KontorApplication: Application()
@@ -0,0 +1,14 @@
package de.thpeetz.kontor
import jakarta.ws.rs.core.Application
import org.eclipse.microprofile.openapi.annotations.OpenAPIDefinition
import org.eclipse.microprofile.openapi.annotations.info.Info
import org.eclipse.microprofile.openapi.annotations.tags.Tag
@OpenAPIDefinition(
info = Info(
title = "Kontor",
version = "0.2.0"
)
)
class KontorApplication: Application()
@@ -0,0 +1,25 @@
package de.thpeetz.kontor.comics.domain
import io.quarkus.hibernate.orm.panache.kotlin.PanacheEntityBase
import jakarta.persistence.Entity
import jakarta.persistence.Id
import jakarta.persistence.Table
import org.eclipse.microprofile.openapi.annotations.media.Schema
import java.time.LocalDate
import java.time.LocalDateTime
import kotlin.properties.Delegates
@Entity
@Table(name = "comic")
class Comic: PanacheEntityBase {
@Id
lateinit var id: String
lateinit var createdDate: LocalDateTime
lateinit var lastModifiedDate: LocalDateTime
lateinit var version: Integer
lateinit var title: String
lateinit var webLink: String
var completed: Boolean = false
var currentOrder: Boolean = false
lateinit var publisherId: String
}
@@ -0,0 +1,22 @@
package de.thpeetz.kontor.comics.resource
import de.thpeetz.kontor.comics.domain.Comic
import jakarta.ws.rs.GET
import jakarta.ws.rs.Path
import jakarta.ws.rs.PathParam
import jakarta.ws.rs.Produces
import jakarta.ws.rs.core.MediaType
import org.eclipse.microprofile.openapi.annotations.tags.Tag
@Path("/api/comics/comics")
@Produces(MediaType.APPLICATION_JSON)
@Tag(name = "comics", description = "Comics")
class ComicsResource {
@GET
fun findAll(): List<Comic> = emptyList<Comic>()
@GET
@Path("/{id}")
fun findById(@PathParam("id") id: String): Comic? = null
}
@@ -1 +1,17 @@
quarkus.swagger-ui.always-include=true
quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=kontor
quarkus.datasource.password=kontor
quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/kontor
# dev
%dev.quarkus.datasource.db-kind=h2
%dev.quarkus.datasource.username=sa
%dev.quarkus.datasource.password=password
%dev.quarkus.datasource.jdbc.url=jdbc:h2:mem:testdb
%dev.quarkus.hibernate-orm.database.generation=update
# test
%test.quarkus.datasource.db-kind=h2
%test.quarkus.datasource.username=sa
%test.quarkus.datasource.password=password
%test.quarkus.datasource.jdbc.url=jdbc:h2:mem:testdb
%test.quarkus.hibernate-orm.database.generation=update