Test openapi schema response of FindArticlesVersion,GetOneArticle,UpsertArticle

change snack_case to camelCase
This commit is contained in:
2021-03-12 23:32:32 +01:00
parent ed0873837b
commit 9c88adbabd
17 changed files with 432 additions and 156 deletions

View File

@@ -1,7 +1,9 @@
package fr.dcproject.component.article.routes
import fr.dcproject.common.dto.toOutput
import fr.dcproject.common.security.assert
import fr.dcproject.component.article.ArticleAccessControl
import fr.dcproject.component.article.database.ArticleForListing
import fr.dcproject.component.article.database.ArticleRef
import fr.dcproject.component.article.database.ArticleRepository
import fr.dcproject.component.auth.citizenOrNull
@@ -37,7 +39,34 @@ object FindArticleVersions {
get<ArticleVersionsRequest> {
repo.findVersions(it)
.apply { ac.assert { canView(result, citizenOrNull) } }
.let { call.respond(it) }
.run {
call.respond(
toOutput { a: ArticleForListing ->
object {
val id = a.id
val title = a.title
val createdBy = object {
val id = a.createdBy.id
val name = a.createdBy.name.let { n ->
object {
val firstName = n.firstName
val lastName = n.lastName
}
}
val email = a.createdBy.email
}
val workgroup = a.workgroup?.let { w ->
object {
val id = w.id
val name = w.name
}
}
val draft = a.draft
val lastVersion = a.lastVersion
}
}
)
}
}
}
}