Skip to content

Commit b2d3f36

Browse files
committed
update notification api to get rid of jdbc schema provider
1 parent 6b195da commit b2d3f36

File tree

4 files changed

+32
-10
lines changed

4 files changed

+32
-10
lines changed

api/src/main/scala/app/softnetwork/notification/api/AllNotificationsApi.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ import app.softnetwork.notification.persistence.typed.{
1313
NotificationBehavior
1414
}
1515
import app.softnetwork.persistence.jdbc.query.{JdbcJournalProvider, JdbcOffsetProvider}
16-
import app.softnetwork.persistence.jdbc.schema.JdbcSchemaProvider
16+
import app.softnetwork.persistence.schema.SchemaProvider
1717
import app.softnetwork.scheduler.config.SchedulerSettings
1818
import com.typesafe.config.Config
1919

20-
trait AllNotificationsApi extends NotificationApplication[Notification] with JdbcSchemaProvider {
20+
trait AllNotificationsApi extends NotificationApplication[Notification] { _: SchemaProvider =>
2121

2222
override def notificationBehaviors: ActorSystem[_] => Seq[NotificationBehavior[Notification]] =
2323
_ => Seq(AllNotificationsBehavior)
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
package app.softnetwork.notification.api
22

3-
import app.softnetwork.persistence.jdbc.schema.JdbcSchemaTypes
4-
import app.softnetwork.persistence.schema.SchemaType
3+
import akka.actor
4+
import akka.actor.typed.ActorSystem
5+
import app.softnetwork.persistence.jdbc.schema.{JdbcSchema, JdbcSchemaTypes}
6+
import app.softnetwork.persistence.schema.{Schema, SchemaProvider, SchemaType}
7+
import app.softnetwork.persistence.typed._
8+
import com.typesafe.config.Config
59
import org.slf4j.{Logger, LoggerFactory}
610

7-
object AllNotificationsPostgresLauncher extends AllNotificationsApi {
11+
object AllNotificationsPostgresLauncher extends AllNotificationsApi with SchemaProvider {
812

913
lazy val log: Logger = LoggerFactory getLogger getClass.getName
1014

11-
override val schemaType: SchemaType = JdbcSchemaTypes.Postgres
15+
override def schema: ActorSystem[_] => Schema = sys =>
16+
new JdbcSchema {
17+
override def schemaType: SchemaType = JdbcSchemaTypes.Postgres
18+
override implicit def classicSystem: actor.ActorSystem = sys
19+
override def config: Config = AllNotificationsPostgresLauncher.this.config
20+
}
1221
}

api/src/main/scala/app/softnetwork/notification/api/AllNotificationsWithSchedulerApi.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import akka.actor.typed.ActorSystem
44
import akka.http.scaladsl.model.{HttpRequest, HttpResponse}
55
import app.softnetwork.persistence.launch.PersistentEntity
66
import app.softnetwork.persistence.query.EventProcessorStream
7+
import app.softnetwork.persistence.schema.SchemaProvider
78
import app.softnetwork.scheduler.api.{SchedulerApi, SchedulerServiceApiHandler}
89

910
import scala.concurrent.Future
1011

1112
trait AllNotificationsWithSchedulerApi extends AllNotificationsApi with SchedulerApi {
13+
_: SchemaProvider =>
1214

1315
override def entities: ActorSystem[_] => Seq[PersistentEntity[_, _, _, _]] = sys =>
1416
schedulerEntities(sys) ++ notificationEntities(sys)
Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
package app.softnetwork.notification.api
22

3-
import app.softnetwork.persistence.jdbc.schema.JdbcSchemaTypes
4-
import app.softnetwork.persistence.schema.SchemaType
3+
import akka.actor
4+
import akka.actor.typed.ActorSystem
5+
import app.softnetwork.persistence.jdbc.schema.{JdbcSchema, JdbcSchemaTypes}
6+
import app.softnetwork.persistence.schema.{Schema, SchemaProvider, SchemaType}
7+
import app.softnetwork.persistence.typed._
8+
import com.typesafe.config.Config
59
import org.slf4j.{Logger, LoggerFactory}
610

7-
object AllNotificationsWithSchedulerPostgresLauncher extends AllNotificationsWithSchedulerApi {
11+
object AllNotificationsWithSchedulerPostgresLauncher
12+
extends AllNotificationsWithSchedulerApi
13+
with SchemaProvider {
814

915
lazy val log: Logger = LoggerFactory getLogger getClass.getName
1016

11-
override val schemaType: SchemaType = JdbcSchemaTypes.Postgres
17+
override def schema: ActorSystem[_] => Schema = sys =>
18+
new JdbcSchema {
19+
override def schemaType: SchemaType = JdbcSchemaTypes.Postgres
20+
override implicit def classicSystem: actor.ActorSystem = sys
21+
override def config: Config = AllNotificationsWithSchedulerPostgresLauncher.this.config
22+
}
1223
}

0 commit comments

Comments
 (0)