Refactors Articles and Voter

- Move files into components (article)
- Split articles routes
- Refactoring for remove ktor-voter (ArticleVoter)
- Remove mutability
- Move DataConversion to separate file (Converter.kt)
- Add Schemas for Articles routes
- Fix SQL Query for Workgroup roles
- rename container_name in docker-compose
This commit is contained in:
2021-01-14 11:23:27 +01:00
parent 03401f711e
commit a1c1accc87
124 changed files with 2026 additions and 1828 deletions

View File

@@ -0,0 +1,12 @@
package fr.dcproject.dto
import fr.postgresjson.entity.EntityCreatedAt
import org.joda.time.DateTime
interface CreatedAt {
val createdAt: DateTime
class Imp(parent: EntityCreatedAt) : CreatedAt {
override val createdAt: DateTime = parent.createdAt
}
}

View File

@@ -0,0 +1,11 @@
package fr.dcproject.dto
typealias Opinions = Map<String, Int>
interface Opinionable {
val opinions: Opinions
class Imp(parent: fr.dcproject.entity.Opinionable): Opinionable {
override val opinions: Opinions = parent.opinions
}
}

View File

@@ -0,0 +1,15 @@
package fr.dcproject.dto
import fr.postgresjson.entity.EntityVersioning
import java.util.*
interface Versionable {
val versionId: UUID
val versionNumber: Int
class Imp(parent: EntityVersioning<UUID, Int>) : Versionable {
override val versionNumber: Int = parent.versionNumber
override val versionId: UUID = parent.versionId
}
}

View File

@@ -0,0 +1,10 @@
package fr.dcproject.dto
import fr.dcproject.entity.ViewAggregation
class ViewAggregation(
val total: Int,
val unique: Int
) {
constructor(views: ViewAggregation) : this(views.total, views.unique)
}

View File

@@ -0,0 +1,9 @@
package fr.dcproject.dto
interface Viewable {
var views: ViewAggregation
class Imp(views: fr.dcproject.entity.ViewAggregation) : Viewable {
override var views: ViewAggregation = ViewAggregation(views.total, views.unique)
}
}

View File

@@ -0,0 +1,9 @@
package fr.dcproject.dto
interface Votable {
val votes: VoteAggregation
class Imp(parent: fr.dcproject.entity.Votable): Votable {
override val votes: VoteAggregation = VoteAggregation(parent)
}
}

View File

@@ -0,0 +1,11 @@
package fr.dcproject.dto
import fr.dcproject.entity.Votable
class VoteAggregation(parent: Votable) {
val up: Int = parent.votes.up
val neutral: Int = parent.votes.neutral
val down: Int = parent.votes.down
val total: Int = parent.votes.total
val score: Int = parent.votes.score
}