feature #11: describe "create/delete follow to article" in openAPI
This commit is contained in:
@@ -24,7 +24,6 @@ object ArticlesPaths {
|
|||||||
val limit: Int = if (limit > 50) 50 else if (limit < 1) 1 else limit
|
val limit: Int = if (limit > 50) 50 else if (limit < 1) 1 else limit
|
||||||
}
|
}
|
||||||
@Location("/articles/{article}") class ArticleRequest(val article: ArticleEntity)
|
@Location("/articles/{article}") class ArticleRequest(val article: ArticleEntity)
|
||||||
@Location("/articles/{article}/follow") class ArticleFollowRequest(val article: ArticleEntity)
|
|
||||||
@Location("/articles") class PostArticleRequest
|
@Location("/articles") class PostArticleRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import fr.dcproject.repository.FollowArticle as FollowArticleRepository
|
|||||||
|
|
||||||
@KtorExperimentalLocationsAPI
|
@KtorExperimentalLocationsAPI
|
||||||
object FollowArticlePaths {
|
object FollowArticlePaths {
|
||||||
@Location("/articles/{article}/follow") class ArticleFollowRequest(val article: ArticleEntity)
|
@Location("/articles/{article}/follows") class ArticleFollowRequest(val article: ArticleEntity)
|
||||||
@Location("/citizens/{citizen}/follows/articles") class CitizenFollowArticleRequest(val citizen: Citizen)
|
@Location("/citizens/{citizen}/follows/articles") class CitizenFollowArticleRequest(val citizen: Citizen)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -323,6 +323,34 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/CommentResponse'
|
$ref: '#/components/schemas/CommentResponse'
|
||||||
|
/articles/{article}/follows:
|
||||||
|
parameters:
|
||||||
|
- name: article
|
||||||
|
in: path
|
||||||
|
description: The ID of article
|
||||||
|
example: e74be8e4-6823-47c4-bd1b-789725b2fa8e
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
post:
|
||||||
|
security:
|
||||||
|
- JWTAuth: []
|
||||||
|
summary: Follow one article
|
||||||
|
tags:
|
||||||
|
- follow
|
||||||
|
responses:
|
||||||
|
201:
|
||||||
|
description: Return only http status 201 on success
|
||||||
|
delete:
|
||||||
|
security:
|
||||||
|
- JWTAuth: []
|
||||||
|
summary: Unfollow one article
|
||||||
|
tags:
|
||||||
|
- follow
|
||||||
|
responses:
|
||||||
|
204:
|
||||||
|
description: Return only http status 204 on success
|
||||||
|
|
||||||
|
|
||||||
components:
|
components:
|
||||||
@@ -661,6 +689,12 @@ components:
|
|||||||
- $ref: '#/components/schemas/UUID'
|
- $ref: '#/components/schemas/UUID'
|
||||||
- $ref: '#/components/schemas/UUID'
|
- $ref: '#/components/schemas/UUID'
|
||||||
|
|
||||||
|
FollowBase:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/Extra'
|
||||||
|
FollowResponse:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/FollowBase'
|
||||||
|
|
||||||
|
|
||||||
requestBodies:
|
requestBodies:
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ Feature: follow Article and Constitution
|
|||||||
# Article
|
# Article
|
||||||
Scenario: The route for follow article must response a 201 and return object
|
Scenario: The route for follow article must response a 201 and return object
|
||||||
Given I am authenticated as John Doe with id "64b7b379-2298-43ec-b428-ba134930cabd"
|
Given I am authenticated as John Doe with id "64b7b379-2298-43ec-b428-ba134930cabd"
|
||||||
When I send a POST request to "/articles/9226c1a3-8091-c3fa-7d0d-c2e98c9bee7b/follow"
|
When I send a POST request to "/articles/9226c1a3-8091-c3fa-7d0d-c2e98c9bee7b/follows"
|
||||||
Then the response status code should be 201
|
Then the response status code should be 201
|
||||||
|
|
||||||
Scenario: The route for get follows of articles must response a 200 and return objects
|
Scenario: The route for get follows of articles must response a 200 and return objects
|
||||||
@@ -16,7 +16,7 @@ Feature: follow Article and Constitution
|
|||||||
|
|
||||||
Scenario: The route for unfollow article must response a 204
|
Scenario: The route for unfollow article must response a 204
|
||||||
Given I am authenticated as John Doe with id "64b7b379-2298-43ec-b428-ba134930cabd"
|
Given I am authenticated as John Doe with id "64b7b379-2298-43ec-b428-ba134930cabd"
|
||||||
When I send a DELETE request to "/articles/9226c1a3-8091-c3fa-7d0d-c2e98c9bee7b/follow"
|
When I send a DELETE request to "/articles/9226c1a3-8091-c3fa-7d0d-c2e98c9bee7b/follows"
|
||||||
Then the response status code should be 204
|
Then the response status code should be 204
|
||||||
|
|
||||||
# Constitution
|
# Constitution
|
||||||
|
|||||||
Reference in New Issue
Block a user