Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functionality to get all users #27

Merged
merged 4 commits into from
Oct 16, 2018
Merged

Conversation

samdiano
Copy link
Contributor

What does this PR do?

This PR creates functionality for a user to see the list and profiles of existing authors

Description of Task to be completed?

  • Create a route to get all users
  • Write tests for endpoint

How should this be manually tested?

GET /api/v1/users
GET /api/v1/users/:username

Any background context you want to provide?

N/A

What are the relevant pivotal tracker stories?

#160451510

…profiles of existing authors

Files modify/create:
- modify userController file
- modify user routes
- modify user.test.js

Start #160451510
@kampkelly kampkelly temporarily deployed to phlox-ah-staging-pr-27 October 12, 2018 09:54 Inactive
@coveralls
Copy link

coveralls commented Oct 12, 2018

Pull Request Test Coverage Report for Build 268

  • 2 of 13 (15.38%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.4%) to 33.159%

Changes Missing Coverage Covered Lines Changed/Added Lines %
server/controllers/likeController.js 0 3 0.0%
server/controllers/userController.js 0 8 0.0%
Totals Coverage Status
Change from base Build 266: -0.4%
Covered Lines: 248
Relevant Lines: 633

💛 - Coveralls

@@ -19,7 +19,7 @@ export default class LikeController {
const dislike = req.params.likeType === 'dislike';
// message to be sent to user depending on function performed
const message = like || dislike ? `you ${req.params.likeType}d the article`
: 'you disliked the article';
: 'you unliked the article';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I edited the like controller to fix a bug of not disliking an article after liking that particular article.

@kampkelly kampkelly temporarily deployed to phlox-ah-staging-pr-27 October 12, 2018 10:03 Inactive
@@ -1,6 +1,6 @@
[![Build Status](https://travis-ci.org/andela/phlox-ah.svg?branch=master)](https://travis-ci.org/andela/phlox-ah)
[![Validated by Hound](https://img.shields.io/badge/Validated_By-Hound_CI-06576D.svg)](https://houndci.com)
[![Coverage Status](https://coveralls.io/repos/github/andela/phlox-ah/badge.svg?branch=chore%2F160451494%2Fintegrate-coveralls)](https://coveralls.io/github/andela/phlox-ah?branch=chore%2F160451494%2Fintegrate-coveralls)
[![Coverage Status](https://coveralls.io/repos/github/andela/phlox-ah/badge.svg?branch=chore%2F160451494%2Fintegrate-coveralls)](https://coveralls.io/github/andela/phlox-ah?branch=staging)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here. I changed the targetted branch that the coveralls badge uses to staging

@@ -81,7 +81,7 @@ export default (sequelize, DataTypes) => {
foreignKey: 'userId',
as: 'likes'
});
User.hasOne(models.Profile, {
User.hasMany(models.Profile, {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this relationship to hasMany because I couldn't get sourceKey to work using hasOne. I searched and saw that hasOne does not support sourceKey

Copy link
Contributor

@oladimillion oladimillion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@onwuvic onwuvic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@s-akinrele s-akinrele merged commit abf05a5 into staging Oct 16, 2018
@s-akinrele s-akinrele deleted the feature/160451510/list-users branch October 16, 2018 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants