Skip to content

Commit

Permalink
polish
Browse files Browse the repository at this point in the history
  • Loading branch information
mattupstate committed Dec 8, 2023
1 parent 8f03890 commit 04c1b16
Show file tree
Hide file tree
Showing 37 changed files with 178 additions and 226 deletions.
5 changes: 0 additions & 5 deletions .vscode/settings.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class JooqAppointmentAggregateRepository(
.where(APPOINTMENTS.ID.eq(id.value))
.awaitFirstOrNull()?.let {
PersistedAggregate(
aggregate = Json.decodeFromString(it.aggregate!!.data()),
aggregate = Json.decodeFromString(it.aggregate.data()),
metaData = PersistenceMetaData(
createdAt = it.createdAt!!,
updatedAt = it.updatedAt!!,
revision = it.revision!!,
createdAt = it.createdAt,
updatedAt = it.updatedAt,
revision = it.revision,
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class JooqClientAggregateRepository(
.where(CLIENTS.ID.eq(id.value))
.awaitFirstOrNull()?.let {
PersistedAggregate(
aggregate = Json.decodeFromString(it.aggregate!!.data()),
aggregate = Json.decodeFromString(it.aggregate.data()),
metaData = PersistenceMetaData(
createdAt = it.createdAt!!,
updatedAt = it.updatedAt!!,
revision = it.revision!!,
createdAt = it.createdAt,
updatedAt = it.updatedAt,
revision = it.revision,
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class JooqPracticeAggregateRepository(
.where(PRACTICES.ID.eq(id.value))
.awaitFirstOrNull()?.let {
PersistedAggregate(
aggregate = Json.decodeFromString(it.aggregate!!.data()),
aggregate = Json.decodeFromString(it.aggregate.data()),
metaData = PersistenceMetaData(
createdAt = it.createdAt!!,
updatedAt = it.updatedAt!!,
revision = it.revision!!,
createdAt = it.createdAt,
updatedAt = it.updatedAt,
revision = it.revision,
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class JooqPractitionerAggregateRepository(
.where(PRACTITIONERS.ID.eq(id.value))
.awaitFirstOrNull()?.let {
PersistedAggregate(
aggregate = Json.decodeFromString(it.aggregate!!.data()),
aggregate = Json.decodeFromString(it.aggregate.data()),
metaData = PersistenceMetaData(
createdAt = it.createdAt!!,
updatedAt = it.updatedAt!!,
revision = it.revision!!,
createdAt = it.createdAt,
updatedAt = it.updatedAt,
revision = it.revision,
)
)
}
Expand Down
9 changes: 7 additions & 2 deletions acme-data/acme-data-sql/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ java {
}

jooq {
version.set("3.17.4")
version.set("3.18.4")
edition.set(JooqEdition.OSS)
configurations {
create("main") {
Expand All @@ -47,7 +47,7 @@ jooq {
jdbc.apply {
driver = "org.testcontainers.jdbc.ContainerDatabaseDriver"
url =
"jdbc:tc:postgresql:11.5:///test?TC_INITFUNCTION=com.acme.liquibase.LiquibaseTestContainerInitializerKt::update"
"jdbc:tc:postgresql:15.5:///test?TC_INITFUNCTION=com.acme.liquibase.LiquibaseTestContainerInitializerKt::update"
}
generator.apply {
name = "org.jooq.codegen.KotlinGenerator"
Expand All @@ -59,6 +59,11 @@ jooq {
target.apply {
packageName = "com.acme.sql"
}
generate.apply {
isKotlinNotNullPojoAttributes = true
isKotlinNotNullRecordAttributes = true
isKotlinNotNullInterfaceAttributes = true
}
strategy.name = "org.jooq.codegen.DefaultGeneratorStrategy"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ databaseChangeLog:
file: migrations/scheduling/changelog.000001.sql
relativeToChangelogFile: true
- include:
file: migrations/web-server/changelog.000001.sql
file: migrations/web/changelog.000001.sql
relativeToChangelogFile: true

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
--liquibase formatted sql
--changeset author:mwright

create schema web;

create table web.practices
(
id text primary key,
name text not null
);

create table web.practice_contact_points
(
practice_id text references web.practices(id),
system text not null,
value text not null,
verified_at timestamp
);

create table web.practitioners
(
id text primary key,
gender text not null
);

create table web.practitioner_names
(
practitioner_id text references web.practitioners(id),
given text not null,
family text not null,
prefix text not null,
suffix text not null,
period_start timestamp,
period_end timestamp
);

create table web.practitioner_contact_points
(
practitioner_id text references web.practitioners(id),
system text not null,
value text not null,
verified_at timestamp
);

create table web.practice_memberships
(
practice_id text references web.practices(id),
practitioner_id text references web.practitioners(id),
role text not null
);

create table web.clients
(
id text primary key,
gender text not null
);

create table web.client_names
(
client_id text references web.clients(id),
given text not null,
family text not null,
prefix text not null,
suffix text not null,
period_start timestamp,
period_end timestamp
);

create table web.client_contact_points
(
client_id text references web.clients(id),
system text not null,
value text not null,
verified_at timestamp
);

create table web.appointments
(
id text primary key,
practitioner_id text references web.practitioners(id),
client_id text references web.clients(id),
practice_id text references web.practices(id),
state varchar not null,
period_start timestamp not null,
period_end timestamp
);
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.acme.web.api.test

import com.acme.liquibase.update
import com.acme.web.api.core.ktor.AuthenticationConfiguration
import com.acme.web.api.core.ktor.DataSourceConfiguration
import com.acme.web.api.core.ktor.KetoConfiguration
import com.acme.web.api.core.ktor.MainConfiguration
import com.acme.web.api.core.ktor.main
import com.acme.web.api.security.ktor.HeaderAuthConfiguration
import com.acme.web.api.AuthenticationConfiguration
import com.acme.web.api.DataSourceConfiguration
import com.acme.web.api.KetoConfiguration
import com.acme.web.api.MainConfiguration
import com.acme.web.api.main
import com.acme.web.api.security.HeaderAuthConfiguration
import com.zaxxer.hikari.HikariConfig
import com.zaxxer.hikari.HikariDataSource
import io.kotest.core.listeners.ProjectListener
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
datasource {
jdbcUrl = "jdbc:tc:postgresql:11.5:///test?TC_INITFUNCTION=com.acme.liquibase.LiquibaseTestContainerInitializerKt::update"
jdbcUrl = "jdbc:tc:postgresql:15.5:///test?TC_INITFUNCTION=com.acme.liquibase.LiquibaseTestContainerInitializerKt::update"
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.acme.web.api.core.ktor
package com.acme.web.api

import com.acme.web.api.security.ktor.HeaderAuthConfiguration
import com.acme.web.api.security.HeaderAuthConfiguration
import io.ktor.server.auth.AuthenticationConfig
import io.ktor.server.config.ApplicationConfig

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.acme.web.api.core.ktor
package com.acme.web.api

import io.ktor.server.config.ApplicationConfig

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.acme.web.api.core.ktor
package com.acme.web.api

import io.ktor.server.config.ApplicationConfig

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.acme.web.api.core.ktor
package com.acme.web.api

import io.ktor.server.config.ApplicationConfig

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.acme.web.api.core.ktor
package com.acme.web.api

import com.acme.core.CommandValidationException
import com.acme.ktor.server.logging.logger
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
@file:OptIn(ExperimentalSerializationApi::class)

package com.acme.web.api.core
package com.acme.web.api

import am.ik.timeflake.Timeflake
import com.acme.web.api.security.AcmeWebUserPrincipal
import com.acme.web.api.security.PrincipalNotFoundException
import io.ktor.server.application.ApplicationCall
import io.ktor.server.auth.authentication
import jakarta.validation.ElementKind
import jakarta.validation.Path
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.json.Json

fun ApplicationCall.authenticatedUser(): AcmeWebUserPrincipal =
authentication.principal() ?: throw PrincipalNotFoundException()

val defaultIdGenerator: () -> String = { Timeflake.generate().base62() }

val defaultJson = Json {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.acme.web.api.core.ktor
package com.acme.web.api

import com.acme.ktor.server.logging.logger
import com.acme.web.api.core.defaultJson
import com.acme.web.api.scheduling.ktor.scheduling
import io.ktor.http.ContentType
import io.ktor.server.application.Application
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.acme.web.api.core.ktor
package com.acme.web.api

import com.acme.ktor.server.validation.RequestBodyValidationException
import com.acme.web.api.core.toJsonPointer
import com.acme.web.api.json.hal.VndError
import io.ktor.http.ContentType
import io.ktor.http.HttpStatusCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@file:OptIn(KtorExperimentalLocationsAPI::class)

package com.acme.web.api.core.ktor
package com.acme.web.api

import com.acme.core.CommandValidationException
import com.acme.ktor.server.i18n.I18N
Expand Down
Loading

0 comments on commit 04c1b16

Please sign in to comment.