create CitizenCreatorI.toOutput()

This commit is contained in:
2021-03-20 01:20:36 +01:00
parent 4c1ab796e4
commit fdd69a687b
14 changed files with 49 additions and 241 deletions

View File

@@ -1,5 +1,6 @@
package fr.dcproject.component.constitution.routes
import fr.dcproject.common.response.toOutput
import fr.dcproject.common.security.assert
import fr.dcproject.common.utils.receiveOrBadRequest
import fr.dcproject.component.article.database.ArticleRef
@@ -83,22 +84,7 @@ object CreateConstitution {
val articles: List<Any> = t.articles.map { a ->
val id = a.id
val title = a.title
val createdBy = a.createdBy.let { cr ->
object {
val id: UUID = cr.id
val name: Any = cr.name.let { n ->
object {
val firstName: String = n.firstName
val lastName: String = n.lastName
}
}
val user: Any = cr.user.let { u ->
object {
val username: String = u.username
}
}
}
}
val createdBy = a.createdBy.toOutput()
val workgroup: Any? = a.workgroup?.let { w ->
object {
val id = w.id
@@ -112,22 +98,7 @@ object CreateConstitution {
val draft: Boolean = c.draft
val versionId: UUID = c.versionId
val createdAt: DateTime = c.createdAt
val createdBy: Any = c.createdBy.let { c ->
object {
val id: UUID = c.id
val name: Any = c.name.let { n ->
object {
val firstName: String = n.firstName
val lastName: String = n.lastName
}
}
val user: Any = c.user.let { u ->
object {
val username: String = u.username
}
}
}
}
val createdBy: Any = c.createdBy.toOutput()
}
)
}

View File

@@ -1,6 +1,7 @@
package fr.dcproject.component.constitution.routes
import fr.dcproject.common.dto.toOutput
import fr.dcproject.common.response.toOutput
import fr.dcproject.common.security.assert
import fr.dcproject.component.auth.citizenOrNull
import fr.dcproject.component.constitution.ConstitutionAccessControl
@@ -41,22 +42,7 @@ object FindConstitutions {
val title: String = c.title
val versionId: UUID = c.versionId
val createdAt: DateTime = c.createdAt
val createdBy: Any = c.createdBy.let { c ->
object {
val id: UUID = c.id
val name: Any = c.name.let { n ->
object {
val firstName: String = n.firstName
val lastName: String = n.lastName
}
}
val user: Any = c.user.let { u ->
object {
val username: String = u.username
}
}
}
}
val createdBy: Any = c.createdBy.toOutput()
}
}
)

View File

@@ -1,5 +1,6 @@
package fr.dcproject.component.constitution.routes
import fr.dcproject.common.response.toOutput
import fr.dcproject.common.security.assert
import fr.dcproject.component.auth.citizenOrNull
import fr.dcproject.component.constitution.ConstitutionAccessControl
@@ -41,22 +42,7 @@ object GetConstitution {
val articles: List<Any> = t.articles.map { a ->
val id = a.id
val title = a.title
val createdBy = a.createdBy.let { cr ->
object {
val id: UUID = cr.id
val name: Any = cr.name.let { n ->
object {
val firstName: String = n.firstName
val lastName: String = n.lastName
}
}
val user: Any = cr.user.let { u ->
object {
val username: String = u.username
}
}
}
}
val createdBy = a.createdBy.toOutput()
val workgroup: Any? = a.workgroup?.let { w ->
object {
val id = w.id
@@ -70,22 +56,7 @@ object GetConstitution {
val draft: Boolean = c.draft
val versionId: UUID = c.versionId
val createdAt: DateTime = c.createdAt
val createdBy: Any = c.createdBy.let { c ->
object {
val id: UUID = c.id
val name: Any = c.name.let { n ->
object {
val firstName: String = n.firstName
val lastName: String = n.lastName
}
}
val user: Any = c.user.let { u ->
object {
val username: String = u.username
}
}
}
}
val createdBy: Any = c.createdBy.toOutput()
}
}
)