diff --git a/src/main/kotlin/fr/dcproject/component/article/routes/FindArticles.kt b/src/main/kotlin/fr/dcproject/component/article/routes/FindArticles.kt index efd469c..cd0a1b9 100644 --- a/src/main/kotlin/fr/dcproject/component/article/routes/FindArticles.kt +++ b/src/main/kotlin/fr/dcproject/component/article/routes/FindArticles.kt @@ -16,6 +16,7 @@ import io.ktor.locations.Location import io.ktor.locations.get import io.ktor.response.respond import io.ktor.routing.Route +import java.util.UUID @KtorExperimentalLocationsAPI object FindArticles { @@ -51,15 +52,21 @@ object FindArticles { object { val id = it.id val title = it.title - val createdBy = object { - val id = it.createdBy.id - val name = it.createdBy.name.let { - object { - val firstName = it.firstName - val lastName = it.lastName + val createdBy: Any = it.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 email = it.createdBy.email } val workgroup = it.workgroup?.let { object { diff --git a/src/main/resources/openapi2.yaml b/src/main/resources/openapi2.yaml index 6a8d79c..1bfdef0 100644 --- a/src/main/resources/openapi2.yaml +++ b/src/main/resources/openapi2.yaml @@ -40,6 +40,12 @@ paths: type: array maxItems: 50 items: + required: + - id + - title + - createdBy + - workgroup + - draft properties: id: type: string @@ -47,21 +53,7 @@ paths: title: type: string createdBy: - type: object - additionalProperties: false - properties: - id: - type: string - format: uuid - name: - type: object - properties: - firstName: - type: string - lastName: - type: string - email: - type: string + $ref: '#/components/schemas/CitizenCreator' workgroup: type: object nullable: true @@ -117,9 +109,13 @@ paths: type: boolean default: false workgroup: - allOf: - - $ref: '#/components/schemas/UuidEntity' - - default: null + default: null + additionalProperties: false + required: + - id + properties: + id: + $ref: "#/components/schemas/UUID" responses: 200: description: Article created