feat : add config files
This commit is contained in:
39
.gitignore
vendored
39
.gitignore
vendored
@@ -1,3 +1,38 @@
|
||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/dist
|
||||
|
||||
# IDEs and editors
|
||||
/.idea
|
||||
.project
|
||||
.classpath
|
||||
.c9/
|
||||
*.launch
|
||||
.settings/
|
||||
*.sublime-workspace
|
||||
|
||||
# IDE - VSCode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
.history/*
|
||||
|
||||
|
||||
#System Files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
|
||||
#log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# spring boot
|
||||
HELP.md
|
||||
.gradle
|
||||
build/
|
||||
@@ -7,9 +42,7 @@ build/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
@@ -34,4 +67,4 @@ out/
|
||||
/.nb-gradle/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
.vscode/
|
||||
@@ -17,6 +17,13 @@ dependencies {
|
||||
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||
|
||||
// https://mvnrepository.com/artifact/org.postgresql/postgresql
|
||||
implementation group: 'org.postgresql', name: 'postgresql', version: '42.5.0'
|
||||
// https://mvnrepository.com/artifact/org.bgee.log4jdbc-log4j2/log4jdbc-log4j2-jdbc4
|
||||
implementation group: 'org.bgee.log4jdbc-log4j2', name: 'log4jdbc-log4j2-jdbc4', version: '1.16'
|
||||
|
||||
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
||||
|
||||
|
||||
2246
doc/Conduit.postman_collection.json
Normal file
2246
doc/Conduit.postman_collection.json
Normal file
File diff suppressed because it is too large
Load Diff
11
doc/README.md
Normal file
11
doc/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# RealWorld API Spec
|
||||
|
||||
## Running API tests locally
|
||||
|
||||
To locally run the provided Postman collection against your backend, execute:
|
||||
|
||||
```
|
||||
APIURL=http://localhost:3000/api ./run-api-tests.sh
|
||||
```
|
||||
|
||||
For more details, see [`run-api-tests.sh`](run-api-tests.sh).
|
||||
916
doc/openapi.yml
Normal file
916
doc/openapi.yml
Normal file
@@ -0,0 +1,916 @@
|
||||
openapi: 3.0.1
|
||||
info:
|
||||
title: Conduit API
|
||||
description: Conduit API
|
||||
contact:
|
||||
name: RealWorld
|
||||
url: https://realworld.io
|
||||
license:
|
||||
name: MIT License
|
||||
url: https://opensource.org/licenses/MIT
|
||||
version: 1.0.0
|
||||
servers:
|
||||
- url: /api
|
||||
paths:
|
||||
/users/login:
|
||||
post:
|
||||
tags:
|
||||
- User and Authentication
|
||||
summary: Existing user login
|
||||
description: Login for existing user
|
||||
operationId: Login
|
||||
requestBody:
|
||||
description: Credentials to use
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/LoginUserRequest'
|
||||
required: true
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UserResponse'
|
||||
401:
|
||||
description: Unauthorized
|
||||
content: {}
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
x-codegen-request-body-name: body
|
||||
/users:
|
||||
post:
|
||||
tags:
|
||||
- User and Authentication
|
||||
summary: Register a new user
|
||||
description: Register a new user
|
||||
operationId: CreateUser
|
||||
requestBody:
|
||||
description: Details of the new user to register
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/NewUserRequest'
|
||||
required: true
|
||||
responses:
|
||||
201:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UserResponse'
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
x-codegen-request-body-name: body
|
||||
/user:
|
||||
get:
|
||||
tags:
|
||||
- User and Authentication
|
||||
summary: Get current user
|
||||
description: Gets the currently logged-in user
|
||||
operationId: GetCurrentUser
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UserResponse'
|
||||
401:
|
||||
description: Unauthorized
|
||||
content: {}
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
security:
|
||||
- Token: []
|
||||
put:
|
||||
tags:
|
||||
- User and Authentication
|
||||
summary: Update current user
|
||||
description: Updated user information for current user
|
||||
operationId: UpdateCurrentUser
|
||||
requestBody:
|
||||
description: User details to update. At least **one** field is required.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UpdateUserRequest'
|
||||
required: true
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UserResponse'
|
||||
401:
|
||||
description: Unauthorized
|
||||
content: {}
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
security:
|
||||
- Token: []
|
||||
x-codegen-request-body-name: body
|
||||
/profiles/{username}:
|
||||
get:
|
||||
tags:
|
||||
- Profile
|
||||
summary: Get a profile
|
||||
description: Get a profile of a user of the system. Auth is optional
|
||||
operationId: GetProfileByUsername
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: Username of the profile to get
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ProfileResponse'
|
||||
401:
|
||||
description: Unauthorized
|
||||
content: {}
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
/profiles/{username}/follow:
|
||||
post:
|
||||
tags:
|
||||
- Profile
|
||||
summary: Follow a user
|
||||
description: Follow a user by username
|
||||
operationId: FollowUserByUsername
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: Username of the profile you want to follow
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ProfileResponse'
|
||||
401:
|
||||
description: Unauthorized
|
||||
content: {}
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
security:
|
||||
- Token: []
|
||||
delete:
|
||||
tags:
|
||||
- Profile
|
||||
summary: Unfollow a user
|
||||
description: Unfollow a user by username
|
||||
operationId: UnfollowUserByUsername
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: Username of the profile you want to unfollow
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ProfileResponse'
|
||||
401:
|
||||
description: Unauthorized
|
||||
content: {}
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
security:
|
||||
- Token: []
|
||||
/articles/feed:
|
||||
get:
|
||||
tags:
|
||||
- Articles
|
||||
summary: Get recent articles from users you follow
|
||||
description: Get most recent articles from users you follow. Use query parameters
|
||||
to limit. Auth is required
|
||||
operationId: GetArticlesFeed
|
||||
parameters:
|
||||
- name: limit
|
||||
in: query
|
||||
description: Limit number of articles returned (default is 20)
|
||||
schema:
|
||||
type: integer
|
||||
default: 20
|
||||
- name: offset
|
||||
in: query
|
||||
description: Offset/skip number of articles (default is 0)
|
||||
schema:
|
||||
type: integer
|
||||
default: 0
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/MultipleArticlesResponse'
|
||||
401:
|
||||
description: Unauthorized
|
||||
content: {}
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
security:
|
||||
- Token: []
|
||||
/articles:
|
||||
get:
|
||||
tags:
|
||||
- Articles
|
||||
summary: Get recent articles globally
|
||||
description: Get most recent articles globally. Use query parameters to filter
|
||||
results. Auth is optional
|
||||
operationId: GetArticles
|
||||
parameters:
|
||||
- name: tag
|
||||
in: query
|
||||
description: Filter by tag
|
||||
schema:
|
||||
type: string
|
||||
- name: author
|
||||
in: query
|
||||
description: Filter by author (username)
|
||||
schema:
|
||||
type: string
|
||||
- name: favorited
|
||||
in: query
|
||||
description: Filter by favorites of a user (username)
|
||||
schema:
|
||||
type: string
|
||||
- name: limit
|
||||
in: query
|
||||
description: Limit number of articles returned (default is 20)
|
||||
schema:
|
||||
type: integer
|
||||
default: 20
|
||||
- name: offset
|
||||
in: query
|
||||
description: Offset/skip number of articles (default is 0)
|
||||
schema:
|
||||
type: integer
|
||||
default: 0
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/MultipleArticlesResponse'
|
||||
401:
|
||||
description: Unauthorized
|
||||
content: {}
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
post:
|
||||
tags:
|
||||
- Articles
|
||||
summary: Create an article
|
||||
description: Create an article. Auth is required
|
||||
operationId: CreateArticle
|
||||
requestBody:
|
||||
description: Article to create
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/NewArticleRequest'
|
||||
required: true
|
||||
responses:
|
||||
201:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SingleArticleResponse'
|
||||
401:
|
||||
description: Unauthorized
|
||||
content: {}
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
security:
|
||||
- Token: []
|
||||
x-codegen-request-body-name: article
|
||||
/articles/{slug}:
|
||||
get:
|
||||
tags:
|
||||
- Articles
|
||||
summary: Get an article
|
||||
description: Get an article. Auth not required
|
||||
operationId: GetArticle
|
||||
parameters:
|
||||
- name: slug
|
||||
in: path
|
||||
description: Slug of the article to get
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SingleArticleResponse'
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
put:
|
||||
tags:
|
||||
- Articles
|
||||
summary: Update an article
|
||||
description: Update an article. Auth is required
|
||||
operationId: UpdateArticle
|
||||
parameters:
|
||||
- name: slug
|
||||
in: path
|
||||
description: Slug of the article to update
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
requestBody:
|
||||
description: Article to update
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UpdateArticleRequest'
|
||||
required: true
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SingleArticleResponse'
|
||||
401:
|
||||
description: Unauthorized
|
||||
content: {}
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
security:
|
||||
- Token: []
|
||||
x-codegen-request-body-name: article
|
||||
delete:
|
||||
tags:
|
||||
- Articles
|
||||
summary: Delete an article
|
||||
description: Delete an article. Auth is required
|
||||
operationId: DeleteArticle
|
||||
parameters:
|
||||
- name: slug
|
||||
in: path
|
||||
description: Slug of the article to delete
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content: {}
|
||||
401:
|
||||
description: Unauthorized
|
||||
content: {}
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
security:
|
||||
- Token: []
|
||||
/articles/{slug}/comments:
|
||||
get:
|
||||
tags:
|
||||
- Comments
|
||||
summary: Get comments for an article
|
||||
description: Get the comments for an article. Auth is optional
|
||||
operationId: GetArticleComments
|
||||
parameters:
|
||||
- name: slug
|
||||
in: path
|
||||
description: Slug of the article that you want to get comments for
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/MultipleCommentsResponse'
|
||||
401:
|
||||
description: Unauthorized
|
||||
content: {}
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
post:
|
||||
tags:
|
||||
- Comments
|
||||
summary: Create a comment for an article
|
||||
description: Create a comment for an article. Auth is required
|
||||
operationId: CreateArticleComment
|
||||
parameters:
|
||||
- name: slug
|
||||
in: path
|
||||
description: Slug of the article that you want to create a comment for
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
requestBody:
|
||||
description: Comment you want to create
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/NewCommentRequest'
|
||||
required: true
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SingleCommentResponse'
|
||||
401:
|
||||
description: Unauthorized
|
||||
content: {}
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
security:
|
||||
- Token: []
|
||||
x-codegen-request-body-name: comment
|
||||
/articles/{slug}/comments/{id}:
|
||||
delete:
|
||||
tags:
|
||||
- Comments
|
||||
summary: Delete a comment for an article
|
||||
description: Delete a comment for an article. Auth is required
|
||||
operationId: DeleteArticleComment
|
||||
parameters:
|
||||
- name: slug
|
||||
in: path
|
||||
description: Slug of the article that you want to delete a comment for
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- name: id
|
||||
in: path
|
||||
description: ID of the comment you want to delete
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content: {}
|
||||
401:
|
||||
description: Unauthorized
|
||||
content: {}
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
security:
|
||||
- Token: []
|
||||
/articles/{slug}/favorite:
|
||||
post:
|
||||
tags:
|
||||
- Favorites
|
||||
summary: Favorite an article
|
||||
description: Favorite an article. Auth is required
|
||||
operationId: CreateArticleFavorite
|
||||
parameters:
|
||||
- name: slug
|
||||
in: path
|
||||
description: Slug of the article that you want to favorite
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SingleArticleResponse'
|
||||
401:
|
||||
description: Unauthorized
|
||||
content: {}
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
security:
|
||||
- Token: []
|
||||
delete:
|
||||
tags:
|
||||
- Favorites
|
||||
summary: Unfavorite an article
|
||||
description: Unfavorite an article. Auth is required
|
||||
operationId: DeleteArticleFavorite
|
||||
parameters:
|
||||
- name: slug
|
||||
in: path
|
||||
description: Slug of the article that you want to unfavorite
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SingleArticleResponse'
|
||||
401:
|
||||
description: Unauthorized
|
||||
content: {}
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
security:
|
||||
- Token: []
|
||||
/tags:
|
||||
get:
|
||||
summary: Get tags
|
||||
description: Get tags. Auth not required
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/TagsResponse'
|
||||
422:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GenericErrorModel'
|
||||
components:
|
||||
schemas:
|
||||
LoginUser:
|
||||
required:
|
||||
- email
|
||||
- password
|
||||
type: object
|
||||
properties:
|
||||
email:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
format: password
|
||||
LoginUserRequest:
|
||||
required:
|
||||
- user
|
||||
type: object
|
||||
properties:
|
||||
user:
|
||||
$ref: '#/components/schemas/LoginUser'
|
||||
NewUser:
|
||||
required:
|
||||
- email
|
||||
- password
|
||||
- username
|
||||
type: object
|
||||
properties:
|
||||
username:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
format: password
|
||||
NewUserRequest:
|
||||
required:
|
||||
- user
|
||||
type: object
|
||||
properties:
|
||||
user:
|
||||
$ref: '#/components/schemas/NewUser'
|
||||
User:
|
||||
required:
|
||||
- bio
|
||||
- email
|
||||
- image
|
||||
- token
|
||||
- username
|
||||
type: object
|
||||
properties:
|
||||
email:
|
||||
type: string
|
||||
token:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
bio:
|
||||
type: string
|
||||
image:
|
||||
type: string
|
||||
UserResponse:
|
||||
required:
|
||||
- user
|
||||
type: object
|
||||
properties:
|
||||
user:
|
||||
$ref: '#/components/schemas/User'
|
||||
UpdateUser:
|
||||
type: object
|
||||
properties:
|
||||
email:
|
||||
type: string
|
||||
token:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
bio:
|
||||
type: string
|
||||
image:
|
||||
type: string
|
||||
UpdateUserRequest:
|
||||
required:
|
||||
- user
|
||||
type: object
|
||||
properties:
|
||||
user:
|
||||
$ref: '#/components/schemas/UpdateUser'
|
||||
ProfileResponse:
|
||||
required:
|
||||
- profile
|
||||
type: object
|
||||
properties:
|
||||
profile:
|
||||
$ref: '#/components/schemas/Profile'
|
||||
Profile:
|
||||
required:
|
||||
- bio
|
||||
- following
|
||||
- image
|
||||
- username
|
||||
type: object
|
||||
properties:
|
||||
username:
|
||||
type: string
|
||||
bio:
|
||||
type: string
|
||||
image:
|
||||
type: string
|
||||
following:
|
||||
type: boolean
|
||||
Article:
|
||||
required:
|
||||
- author
|
||||
- body
|
||||
- createdAt
|
||||
- description
|
||||
- favorited
|
||||
- favoritesCount
|
||||
- slug
|
||||
- tagList
|
||||
- title
|
||||
- updatedAt
|
||||
type: object
|
||||
properties:
|
||||
slug:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
body:
|
||||
type: string
|
||||
tagList:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
updatedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
favorited:
|
||||
type: boolean
|
||||
favoritesCount:
|
||||
type: integer
|
||||
author:
|
||||
$ref: '#/components/schemas/Profile'
|
||||
SingleArticleResponse:
|
||||
required:
|
||||
- article
|
||||
type: object
|
||||
properties:
|
||||
article:
|
||||
$ref: '#/components/schemas/Article'
|
||||
MultipleArticlesResponse:
|
||||
required:
|
||||
- articles
|
||||
- articlesCount
|
||||
type: object
|
||||
properties:
|
||||
articles:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Article'
|
||||
articlesCount:
|
||||
type: integer
|
||||
NewArticle:
|
||||
required:
|
||||
- body
|
||||
- description
|
||||
- title
|
||||
type: object
|
||||
properties:
|
||||
title:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
body:
|
||||
type: string
|
||||
tagList:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
NewArticleRequest:
|
||||
required:
|
||||
- article
|
||||
type: object
|
||||
properties:
|
||||
article:
|
||||
$ref: '#/components/schemas/NewArticle'
|
||||
UpdateArticle:
|
||||
type: object
|
||||
properties:
|
||||
title:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
body:
|
||||
type: string
|
||||
UpdateArticleRequest:
|
||||
required:
|
||||
- article
|
||||
type: object
|
||||
properties:
|
||||
article:
|
||||
$ref: '#/components/schemas/UpdateArticle'
|
||||
Comment:
|
||||
required:
|
||||
- author
|
||||
- body
|
||||
- createdAt
|
||||
- id
|
||||
- updatedAt
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
updatedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
body:
|
||||
type: string
|
||||
author:
|
||||
$ref: '#/components/schemas/Profile'
|
||||
SingleCommentResponse:
|
||||
required:
|
||||
- comment
|
||||
type: object
|
||||
properties:
|
||||
comment:
|
||||
$ref: '#/components/schemas/Comment'
|
||||
MultipleCommentsResponse:
|
||||
required:
|
||||
- comments
|
||||
type: object
|
||||
properties:
|
||||
comments:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Comment'
|
||||
NewComment:
|
||||
required:
|
||||
- body
|
||||
type: object
|
||||
properties:
|
||||
body:
|
||||
type: string
|
||||
NewCommentRequest:
|
||||
required:
|
||||
- comment
|
||||
type: object
|
||||
properties:
|
||||
comment:
|
||||
$ref: '#/components/schemas/NewComment'
|
||||
TagsResponse:
|
||||
required:
|
||||
- tags
|
||||
type: object
|
||||
properties:
|
||||
tags:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
GenericErrorModel:
|
||||
required:
|
||||
- errors
|
||||
type: object
|
||||
properties:
|
||||
errors:
|
||||
required:
|
||||
- body
|
||||
type: object
|
||||
properties:
|
||||
body:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
securitySchemes:
|
||||
Token:
|
||||
type: apiKey
|
||||
description: "For accessing the protected API resources, you must have received\
|
||||
\ a a valid JWT token after registering or logging in. This JWT token must\
|
||||
\ then be used for all protected resources by passing it in via the 'Authorization'\
|
||||
\ header.\n\nA JWT token is generated by the API by either registering via\
|
||||
\ /users or logging in via /users/login.\n\nThe following format must be in\
|
||||
\ the 'Authorization' header :\n\n Token xxxxxx.yyyyyyy.zzzzzz\n \n"
|
||||
name: Authorization
|
||||
in: header
|
||||
17
doc/run-api-tests.sh
Normal file
17
doc/run-api-tests.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
set -x
|
||||
|
||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
|
||||
APIURL=${APIURL:-https://api.realworld.io/api}
|
||||
USERNAME=${USERNAME:-u`date +%s`}
|
||||
EMAIL=${EMAIL:-$USERNAME@mail.com}
|
||||
PASSWORD=${PASSWORD:-password}
|
||||
|
||||
npx newman run $SCRIPTDIR/Conduit.postman_collection.json \
|
||||
--delay-request 500 \
|
||||
--global-var "APIURL=$APIURL" \
|
||||
--global-var "USERNAME=$USERNAME" \
|
||||
--global-var "EMAIL=$EMAIL" \
|
||||
--global-var "PASSWORD=$PASSWORD" \
|
||||
"$@"
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
13
src/main/java/com/io/realworld/api/users/UserController.java
Normal file
13
src/main/java/com/io/realworld/api/users/UserController.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.io.realworld.api.users;
|
||||
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class UserController {
|
||||
|
||||
@PostMapping("/user")
|
||||
public String createUser(){
|
||||
return "hello";
|
||||
}
|
||||
}
|
||||
@@ -1 +1,8 @@
|
||||
server.servlet.contextPath=/api
|
||||
|
||||
# DataSource
|
||||
spring.datasource.hikari.maximum-pool-size=4
|
||||
spring.datasource.url=jdbc:postgresql://localhost:5432/realworld
|
||||
spring.datasource.username=kms
|
||||
spring.datasource.password=root
|
||||
spring.datasource.platform=postgres
|
||||
6
web/WEB-INF/applicationContext.xml
Normal file
6
web/WEB-INF/applicationContext.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
</beans>
|
||||
6
web/WEB-INF/dispatcher-servlet.xml
Normal file
6
web/WEB-INF/dispatcher-servlet.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
</beans>
|
||||
22
web/WEB-INF/web.xml
Normal file
22
web/WEB-INF/web.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
|
||||
version="4.0">
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>/WEB-INF/applicationContext.xml</param-value>
|
||||
</context-param>
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
<servlet>
|
||||
<servlet-name>dispatcher</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>dispatcher</servlet-name>
|
||||
<url-pattern>*.form</url-pattern>
|
||||
</servlet-mapping>
|
||||
</web-app>
|
||||
16
web/index.jsp
Normal file
16
web/index.jsp
Normal file
@@ -0,0 +1,16 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: kms
|
||||
Date: 2022/09/07
|
||||
Time: 10:56 PM
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>$Title$</title>
|
||||
</head>
|
||||
<body>
|
||||
$END$
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user