Skip to content

Commit

Permalink
Merge pull request #23 from andela/feature/167164979/user-login
Browse files Browse the repository at this point in the history
#167164979 add user login feature
  • Loading branch information
joel-ace authored and WilliamsOhworuka committed Aug 2, 2019
2 parents 1248009 + 3db95d5 commit e550e81
Show file tree
Hide file tree
Showing 14 changed files with 361 additions and 132 deletions.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ DATABASE_URL_TEST=
SERVER_URL=
ADMIN_MAIL=
SENDGRID_API_KEY=
HOST_EMAIL =
50 changes: 44 additions & 6 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ externalDocs:
url: https://github.com/andela/dahlia-ah-backend

servers:
- url: /api/
- url: /api/v1
description: Local host
- url: https://ah-dahlia-staging.herokuapp.com/api/
- url: https://ah-dahlia-staging.herokuapp.com/api/v1
description: Heroku deployment

tags:
Expand All @@ -36,10 +36,10 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/UserInput'
$ref: '#/components/schemas/UserRegisterInput'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/UserInput'
$ref: '#/components/schemas/UserRegisterInput'
required: true
responses:
201:
Expand Down Expand Up @@ -70,6 +70,34 @@ paths:
description: resource already exists
500:
description: internal server error
/users/login:
post:
tags:
- Users
summary: Login an existing user with email
requestBody:
description: fields containing user login data
content:
application/json:
schema:
$ref: '#/components/schemas/UserLoginInput'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/UserLoginInput'
required: true
responses:
200:
description: user login successfully
content:
application/json:
schema:
$ref: '#/components/schemas/AuthResponse'
400:
description: bad input parameter
409:
description: resource already exists
500:
description: internal server error
/auth/forgotpassword:
post:
summary: Forgot password
Expand Down Expand Up @@ -101,6 +129,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/StandardServerResponse'

components:
schemas:
User:
Expand Down Expand Up @@ -135,7 +164,7 @@ components:
address:
type: string
example: 123 Eve's Garden Road, Eden
UserInput:
UserRegisterInput:
required:
- firstName
- lastName
Expand All @@ -158,13 +187,22 @@ components:
password:
type: string
example: Flyplanex22
UserLoginInput:
properties:
email:
type: string
example: johndoe@email.com
password:
type: string
example: Flyplanex22
AuthResponse:
properties:
token:
type: string
username:
type: string
bio:
type: string
type: string
ForgotPasswordUser:
required:
- email
Expand Down
Loading

0 comments on commit e550e81

Please sign in to comment.