Skip to content

Commit

Permalink
Move template engine to vlaue classes
Browse files Browse the repository at this point in the history
  • Loading branch information
awelless committed Feb 17, 2024
1 parent f955094 commit 971f810
Show file tree
Hide file tree
Showing 20 changed files with 21 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.mailit.admin.console.http.dto

import io.mailit.core.admin.api.type.MailMessageContentType
import io.mailit.template.api.TemplateEngine
import io.mailit.value.TemplateEngine
import io.quarkus.runtime.annotations.RegisterForReflection

@RegisterForReflection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import io.mailit.core.model.MailMessageStatus
import io.mailit.core.model.MailMessageTemplate
import io.mailit.core.model.MailMessageType
import io.mailit.core.model.PlainTextMailMessageType
import io.mailit.template.api.TemplateEngine
import io.mailit.value.EmailAddress.Companion.toEmailAddress
import io.mailit.value.MailId
import io.mailit.value.MailTypeId
import io.mailit.value.TemplateEngine
import java.util.concurrent.atomic.AtomicLong

private val counter = AtomicLong()
Expand Down
2 changes: 1 addition & 1 deletion core/admin-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dependencies {
api(project(":core:exception"))
api(project(":core:model"))
api(project(":template:template-api")) // Should be removed.
api(project(":value-classes"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package io.mailit.core.admin.api.type
import io.mailit.core.model.MailMessageTemplate
import io.mailit.core.model.MailMessageType
import io.mailit.core.model.Slice
import io.mailit.template.api.TemplateEngine
import io.mailit.value.MailTypeId
import io.mailit.value.TemplateEngine

interface MailMessageTypeService {

Expand Down
1 change: 0 additions & 1 deletion core/model/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
dependencies {
api(project(":value-classes"))
implementation(project(":template:template-api"))

testImplementation(project(":common-test"))
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.mailit.core.model

import io.mailit.template.api.TemplateEngine
import io.mailit.value.MailTypeId
import io.mailit.value.TemplateEngine
import java.time.Instant

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import io.mailit.core.model.HtmlMailMessageType
import io.mailit.core.model.MailMessageTemplate
import io.mailit.core.model.PlainTextMailMessageType
import io.mailit.idgenerator.test.ConstantIdGenerator
import io.mailit.template.api.TemplateEngine.FREEMARKER
import io.mailit.value.MailTypeId
import io.mailit.value.TemplateEngine.FREEMARKER
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Nested
import org.junit.jupiter.api.Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import io.mailit.core.exception.ValidationException
import io.mailit.core.model.HtmlMailMessageType
import io.mailit.core.model.MailMessageTemplate
import io.mailit.core.model.PlainTextMailMessageType
import io.mailit.template.api.TemplateEngine.FREEMARKER
import io.mailit.template.api.TemplateEngine.NONE
import io.mailit.test.createHtmlMailMessageType
import io.mailit.test.createPlainMailMessageType
import io.mailit.value.TemplateEngine.FREEMARKER
import io.mailit.value.TemplateEngine.NONE
import io.mockk.junit5.MockKExtension
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.BeforeEach
Expand Down
1 change: 0 additions & 1 deletion persistence/h2/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ dependencies {
implementation(project(":id-generator:id-generator-spi-locking"))
implementation(project(":persistence:common"))
implementation(project(":persistence:liquibase"))
implementation(project(":template:template-api")) // Should be removed.
implementation(project(":template:template-spi-persistence"))

implementation("io.quarkus:quarkus-config-yaml")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import io.mailit.persistence.h2.Columns.ApiKey as ApiKeyCol
import io.mailit.persistence.h2.Columns.MailMessage as MailMessageCol
import io.mailit.persistence.h2.Columns.MailMessageType as MailMessageTypeCol
import io.mailit.persistence.h2.MailMessageContent.HTML
import io.mailit.template.api.TemplateEngine
import io.mailit.template.spi.persistence.PersistenceTemplate
import io.mailit.value.EmailAddress.Companion.toEmailAddress
import io.mailit.value.MailId
import io.mailit.value.MailTypeId
import io.mailit.value.TemplateEngine
import java.sql.ResultSet
import java.time.Instant

Expand Down
1 change: 0 additions & 1 deletion persistence/mysql/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ dependencies {
implementation(project(":id-generator:id-generator-spi-locking"))
implementation(project(":persistence:common"))
implementation(project(":persistence:liquibase"))
implementation(project(":template:template-api")) // Should be removed.
implementation(project(":template:template-spi-persistence"))

implementation("io.quarkus:quarkus-config-yaml")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import io.mailit.persistence.mysql.Columns.ApiKey as ApiKeyCol
import io.mailit.persistence.mysql.Columns.MailMessage as MailMessageCol
import io.mailit.persistence.mysql.Columns.MailMessageType as MailMessageTypeCol
import io.mailit.persistence.mysql.MailMessageContent.HTML
import io.mailit.template.api.TemplateEngine
import io.mailit.template.spi.persistence.PersistenceTemplate
import io.mailit.value.EmailAddress.Companion.toEmailAddress
import io.mailit.value.MailId
import io.mailit.value.MailTypeId
import io.mailit.value.TemplateEngine
import io.vertx.mutiny.sqlclient.Row
import java.time.Instant
import java.time.ZoneOffset.UTC
Expand Down
1 change: 0 additions & 1 deletion persistence/postgresql/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ dependencies {
implementation(project(":id-generator:id-generator-spi-locking"))
implementation(project(":persistence:common"))
implementation(project(":persistence:liquibase"))
implementation(project(":template:template-api")) // Should be removed.
implementation(project(":template:template-spi-persistence"))

implementation("io.quarkus:quarkus-config-yaml")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import io.mailit.persistence.postgresql.Columns.ApiKey as ApiKeyCol
import io.mailit.persistence.postgresql.Columns.MailMessage as MailMessageCol
import io.mailit.persistence.postgresql.Columns.MailMessageType as MailMessageTypeCol
import io.mailit.persistence.postgresql.MailMessageContent.HTML
import io.mailit.template.api.TemplateEngine
import io.mailit.template.spi.persistence.PersistenceTemplate
import io.mailit.value.EmailAddress.Companion.toEmailAddress
import io.mailit.value.MailId
import io.mailit.value.MailTypeId
import io.mailit.value.TemplateEngine
import io.vertx.mutiny.sqlclient.Row
import java.time.Instant
import java.time.ZoneOffset.UTC
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.mailit.template.api

import io.mailit.value.MailTypeId
import io.mailit.value.TemplateEngine

interface TemplateProcessor {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.mailit.template.core

import io.mailit.template.api.TemplateEngine
import io.mailit.template.api.TemplateEngine.FREEMARKER
import io.mailit.template.api.TemplateEngine.NONE
import io.mailit.template.api.TemplateProcessor
import io.mailit.template.core.freemarker.FreemarkerTemplateProcessor
import io.mailit.template.core.none.NoneTemplateProcessor
import io.mailit.value.MailTypeId
import io.mailit.value.TemplateEngine
import io.mailit.value.TemplateEngine.FREEMARKER
import io.mailit.value.TemplateEngine.NONE

internal class MultiTemplateProcessor(
private val noneTemplateProcessor: NoneTemplateProcessor,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.mailit.template.core.none

import io.mailit.core.exception.NotFoundException
import io.mailit.template.api.TemplateEngine
import io.mailit.template.api.TemplateProcessor
import io.mailit.template.spi.persistence.TemplateRepository
import io.mailit.value.MailTypeId
import io.mailit.value.TemplateEngine

/**
* [TemplateProcessor] for [TemplateEngine.NONE].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.mailit.template.test

import io.mailit.template.api.TemplateEngine
import io.mailit.template.api.TemplateProcessor
import io.mailit.value.MailTypeId
import io.mailit.value.TemplateEngine

class StubTemplateProcessor(val html: String) : TemplateProcessor {
override suspend fun process(mailTypeId: MailTypeId, templateEngine: TemplateEngine, data: Map<String, Any?>) = Result.success(html)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
package io.mailit.template.api
package io.mailit.value

@JvmInline
value class MailTypeId(val value: Long)

enum class TemplateEngine {
/**
Expand Down
4 changes: 0 additions & 4 deletions value-classes/src/main/kotlin/io/mailit/value/MailTypeId.kt

This file was deleted.

0 comments on commit 971f810

Please sign in to comment.