Lint
This commit is contained in:
@@ -8,7 +8,7 @@ import java.util.*
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.full.isSubclassOf
|
||||
|
||||
interface ExtraI<T : TargetI, C: CitizenI> :
|
||||
interface ExtraI<T : TargetI, C : CitizenI> :
|
||||
UuidEntityI,
|
||||
EntityCreatedAt,
|
||||
EntityCreatedBy<C> {
|
||||
|
||||
@@ -10,7 +10,7 @@ class Follow<T : TargetI>(
|
||||
) : ExtraI<T, CitizenBasicI>,
|
||||
FollowSimple<T, CitizenBasicI>(id, createdBy, target)
|
||||
|
||||
open class FollowSimple<T : TargetI, C: CitizenI>(
|
||||
open class FollowSimple<T : TargetI, C : CitizenI>(
|
||||
id: UUID = UUID.randomUUID(),
|
||||
override val createdBy: C,
|
||||
override var target: T
|
||||
|
||||
@@ -11,7 +11,7 @@ open class Opinion<T : TargetI>(
|
||||
override val createdBy: CitizenBasic,
|
||||
override val target: T,
|
||||
val choice: OpinionChoice
|
||||
) : ExtraI<T,CitizenBasicI>,
|
||||
) : ExtraI<T, CitizenBasicI>,
|
||||
TargetRef(id),
|
||||
EntityCreatedAt by EntityCreatedAtImp(),
|
||||
EntityCreatedBy<CitizenBasicI> by EntityCreatedByImp(createdBy) {
|
||||
|
||||
@@ -17,7 +17,6 @@ import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.io.errors.IOException
|
||||
import fr.dcproject.repository.FollowArticle as FollowArticleRepository
|
||||
|
||||
|
||||
class ArticleUpdate(
|
||||
target: Article
|
||||
) : EntityEvent(target, "article", "update") {
|
||||
@@ -102,4 +101,4 @@ fun EventSubscriber.Configuration.configEvent(
|
||||
rabbitChannel.basicConsume("push", false, consumerPush) // The front consume the redis via Websocket
|
||||
rabbitChannel.basicConsume("email", false, consumerEmail)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ abstract class EntityEvent(
|
||||
class EventSubscriber {
|
||||
class Configuration(private val monitor: ApplicationEvents) {
|
||||
private val subscribers = mutableListOf<DisposableHandle>()
|
||||
fun <T: Event> subscribe(definition: EventDefinition<T>, handler: EventHandler<T>): DisposableHandle {
|
||||
fun <T : Event> subscribe(definition: EventDefinition<T>, handler: EventHandler<T>): DisposableHandle {
|
||||
return monitor.subscribe(definition, handler).also {
|
||||
subscribers.add(it)
|
||||
}
|
||||
|
||||
@@ -15,12 +15,14 @@ class Publisher(
|
||||
private val factory: ConnectionFactory,
|
||||
private val logger: Logger = LoggerFactory.getLogger(Publisher::class.qualifiedName)
|
||||
) {
|
||||
fun <T: EntityEvent>publish(it: T): Job {
|
||||
fun <T : EntityEvent> publish(it: T): Job {
|
||||
return GlobalScope.launch {
|
||||
factory.newConnection().use { connection -> connection.createChannel().use { channel ->
|
||||
channel.basicPublish(config.exchangeNotificationName, "", null, it.serialize().toByteArray())
|
||||
logger.debug("Publish message ${it.target.id}")
|
||||
} }
|
||||
factory.newConnection().use { connection ->
|
||||
connection.createChannel().use { channel ->
|
||||
channel.basicPublish(config.exchangeNotificationName, "", null, it.serialize().toByteArray())
|
||||
logger.debug("Publish message ${it.target.id}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ sealed class Follow<IN : TargetRef, OUT : TargetRef>(override var requester: Req
|
||||
): Paginated<FollowEntity<OUT>> {
|
||||
return requester
|
||||
.getFunction("find_follows_by_citizen")
|
||||
.select(
|
||||
page, limit,
|
||||
"created_by_id" to citizenId
|
||||
)
|
||||
.select(
|
||||
page, limit,
|
||||
"created_by_id" to citizenId
|
||||
)
|
||||
}
|
||||
|
||||
fun follow(follow: FollowEntity<IN>) {
|
||||
@@ -74,7 +74,7 @@ sealed class Follow<IN : TargetRef, OUT : TargetRef>(override var requester: Req
|
||||
paginate.result.forEach {
|
||||
emit(it)
|
||||
}
|
||||
nextPage = paginate.currentPage+1
|
||||
nextPage = paginate.currentPage + 1
|
||||
} while (!paginate.isLastPage())
|
||||
}
|
||||
|
||||
@@ -107,7 +107,8 @@ class FollowArticle(requester: Requester) : Follow<ArticleRef, ArticleEntity>(re
|
||||
): Paginated<FollowSimple<ArticleRef, CitizenRef>> {
|
||||
return requester
|
||||
.getFunction("find_follows_article_by_target")
|
||||
.select(page, limit,
|
||||
.select(
|
||||
page, limit,
|
||||
"target_id" to target.id
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user