Lint project

This commit is contained in:
2019-10-10 22:50:24 +02:00
parent 194620e15b
commit f76f6f83bb
36 changed files with 81 additions and 118 deletions

View File

@@ -12,7 +12,7 @@ class Article(
var draft: Boolean = false,
var lastVersion: Boolean = false,
createdBy: Citizen?
):
) :
UuidEntity(id),
EntityVersioning<UUID, Int> by UuidEntityVersioning(),
EntityCreatedAt by EntityCreatedAtImp(),

View File

@@ -1,9 +1,9 @@
package fr.dcproject.entity
import fr.postgresjson.entity.*
import fr.postgresjson.entity.*
import java.util.*
open class Comment <T: UuidEntity> (
open class Comment <T : UuidEntity> (
id: UUID = UUID.randomUUID(),
createdBy: Citizen,
target: T,
@@ -12,7 +12,7 @@ open class Comment <T: UuidEntity> (
var parent: Comment<T>? = null,
var parentsIds: List<UUID>? = null,
val childrenCount: Int? = null
): Extra<T>(id, createdBy, target),
) : Extra<T>(id, createdBy, target),
EntityUpdatedAt by EntityUpdatedAtImp(),
EntityDeletedAt by EntityDeletedAtImp(),
Votable by VotableImp()

View File

@@ -11,13 +11,13 @@ class Constitution(
var draft: Boolean = false,
var lastVersion: Boolean = false,
createdBy: Citizen?
): UuidEntity(id),
) : UuidEntity(id),
EntityVersioning<UUID, Int> by UuidEntityVersioning(),
EntityCreatedAt by EntityCreatedAtImp(),
EntityCreatedBy<Citizen> by EntityCreatedByImp(createdBy),
EntityDeletedAt by EntityDeletedAtImp() {
init{
init {
titles.forEachIndexed { index, title ->
title.createdBy = this.createdBy
title.rank = index
@@ -30,7 +30,7 @@ class Constitution(
var rank: Int? = null,
var articles: List<Article> = listOf(),
createdBy: Citizen? = null
): UuidEntity(id),
) : UuidEntity(id),
EntityCreatedAt by EntityCreatedAtImp(),
EntityCreatedBy<Citizen> by EntityCreatedByImp(createdBy)
}

View File

@@ -3,20 +3,20 @@ package fr.dcproject.entity
import fr.postgresjson.entity.*
import java.util.*
interface ExtraI <T: EntityI>:
interface ExtraI <T : EntityI> :
EntityI,
EntityCreatedAt,
EntityCreatedBy<Citizen>{
EntityCreatedBy<Citizen> {
var target: T
var targetReference: String
}
abstract class Extra<T: UuidEntity>(
abstract class Extra<T : UuidEntity>(
id: UUID? = UUID.randomUUID(),
createdBy: Citizen,
override var target: T,
override var targetReference: String = target::class.simpleName!!.toLowerCase()
):
) :
ExtraI<T>,
UuidEntity(id),
EntityCreatedAt by EntityCreatedAtImp(),

View File

@@ -2,8 +2,8 @@ package fr.dcproject.entity
import fr.postgresjson.entity.UuidEntity
import java.util.*
class Follow <T: UuidEntity> (
class Follow <T : UuidEntity> (
id: UUID = UUID.randomUUID(),
createdBy: Citizen,
target: T
): Extra<T>(id, createdBy, target)
) : Extra<T>(id, createdBy, target)

View File

@@ -14,7 +14,6 @@ class User(
) : UuidEntity(id),
EntityCreatedAt by EntityCreatedAtImp(),
EntityUpdatedAt by EntityUpdatedAtImp(),
Principal
{
Principal {
enum class Roles { ROLE_USER, ROLE_ADMIN }
}

View File

@@ -4,6 +4,6 @@ interface Votable {
var votes: VoteAggregation
}
class VotableImp: Votable {
override var votes: VoteAggregation = VoteAggregation(0,0,0)
class VotableImp : Votable {
override var votes: VoteAggregation = VoteAggregation(0, 0, 0)
}

View File

@@ -5,13 +5,13 @@ import fr.postgresjson.entity.EntityUpdatedAtImp
import fr.postgresjson.entity.UuidEntity
import java.util.*
open class Vote <T: UuidEntity> (
open class Vote <T : UuidEntity> (
id: UUID = UUID.randomUUID(),
createdBy: Citizen,
target: T,
var note: Int,
var anonymous: Boolean = true
): Extra<T>(id, createdBy, target),
) : Extra<T>(id, createdBy, target),
EntityUpdatedAt by EntityUpdatedAtImp() {
init {
if (note > 1 && note < -1) {

View File

@@ -4,9 +4,9 @@ import fr.postgresjson.entity.EntityI
import fr.postgresjson.entity.EntityUpdatedAt
import fr.postgresjson.entity.EntityUpdatedAtImp
open class VoteAggregation (
open class VoteAggregation(
val up: Int,
val neutral: Int,
val down: Int
): EntityI,
EntityUpdatedAt by EntityUpdatedAtImp()
) : EntityI,
EntityUpdatedAt by EntityUpdatedAtImp()

View File

@@ -13,7 +13,7 @@ class Article(
val tags: List<String> = emptyList(),
val draft: Boolean = false,
val versionId: UUID?
):
) :
Request {
fun merge(article: ArticleEntity) {

View File

@@ -1,5 +1,5 @@
package fr.dcproject.entity.request
class Comment (
class Comment(
val content: String
): Request
) : Request