Skip to content

Commit

Permalink
chore(tests): rebase on develop
Browse files Browse the repository at this point in the history
  - rebase on develop to get the changes

[Delivers #159204723]
  • Loading branch information
madeofhuman committed Aug 13, 2018
1 parent ea9ae65 commit acb3fd4
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 183 deletions.
126 changes: 62 additions & 64 deletions server/migrations/20180727115808-create-user.js
Original file line number Diff line number Diff line change
@@ -1,67 +1,65 @@
module.exports = {
up: (queryInterface, Sequelize) => {
queryInterface.createTable('Users', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER,
},
username: {
type: Sequelize.STRING,
allowNull: false,
unique: true,
},
email: {
type: Sequelize.STRING,
allowNull: false,
unique: true,
},
googleId: {
type: Sequelize.STRING,
allowNull: true,
},
facebookId: {
type: Sequelize.STRING,
allowNull: true,
},
twitterId: {
type: Sequelize.STRING,
allowNull: true,
},
firstName: {
type: Sequelize.STRING,
allowNull: false,
},
lastName: {
type: Sequelize.STRING,
allowNull: false,
},
password: {
type: Sequelize.STRING,
allowNull: true,
},
verified: {
type: Sequelize.BOOLEAN,
defaultValue: false,
},
bio: {
type: Sequelize.TEXT,
allowNull: true,
},
image: {
type: Sequelize.STRING,
allowNull: true,
},
createdAt: {
allowNull: false,
type: Sequelize.DATE,
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE,
},
});
},
up: (queryInterface, Sequelize) => queryInterface.createTable('Users', {
id: {
allowNull: false,
autoIncrement: true,
type: Sequelize.INTEGER,
},
username: {
type: Sequelize.STRING,
allowNull: false,
primaryKey: true,
unique: true,
},
firstName: {
type: Sequelize.STRING,
allowNull: false,
},
lastName: {
type: Sequelize.STRING,
allowNull: false,
},
googleId: {
type: Sequelize.STRING,
allowNull: true,
},
facebookId: {
type: Sequelize.STRING,
allowNull: true,
},
twitterId: {
type: Sequelize.STRING,
allowNull: true,
},
email: {
type: Sequelize.STRING,
allowNull: false,
unique: true,
},
password: {
type: Sequelize.STRING,
allowNull: true,
},
verified: {
type: Sequelize.BOOLEAN,
defaultValue: false,
},
bio: {
type: Sequelize.TEXT,
allowNull: true,
},
image: {
type: Sequelize.STRING,
allowNull: true,
},
createdAt: {
allowNull: false,
type: Sequelize.DATE,
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE,
},
}),
down: (queryInterface) => { queryInterface.dropTable('Users'); },
};
39 changes: 0 additions & 39 deletions server/migrations/20180806205756-create-reply.js

This file was deleted.

4 changes: 1 addition & 3 deletions server/models/article.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

export default (sequelize, DataTypes) => {
const Article = sequelize.define('Article', {
slug: {
Expand All @@ -18,7 +17,6 @@ export default (sequelize, DataTypes) => {
type: DataTypes.BLOB,
allowNull: true
},

});
Article.associate = (models) => {
Article.belongsTo(models.User, {
Expand All @@ -40,7 +38,7 @@ export default (sequelize, DataTypes) => {
});
Article.belongsTo(models.Category, {
foreignKey: 'categoryId',
as: 'categories'
as: 'categories',
});
};
return Article;
Expand Down
9 changes: 0 additions & 9 deletions server/models/comment.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@

export default (sequelize, DataTypes) => {
const Comment = sequelize.define('Comment', {
articleId: {
type: DataTypes.INTEGER,
allowNull: false
},
userId: {
type: DataTypes.INTEGER,
allowNull: false
},
body: {
type: DataTypes.TEXT,
allowNull: false
Expand Down
25 changes: 0 additions & 25 deletions server/models/reply.js

This file was deleted.

74 changes: 37 additions & 37 deletions server/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,44 @@ export default (sequelize, DataTypes) => {
args: true,
msg: 'Must be a valid email address',
},
unique: true
},
firstName: {
type: DataTypes.STRING,
allowNull: false,
},
lastName: {
type: DataTypes.STRING,
allowNull: false,
},
googleId: {
type: DataTypes.STRING,
allowNull: true,
},
facebookId: {
type: DataTypes.STRING,
allowNull: true,
},
twitterId: {
type: DataTypes.STRING,
allowNull: true,
},
password: {
type: DataTypes.STRING,
allowNull: true,
},
verified: {
type: DataTypes.BOOLEAN,
defaultValue: false,
},
bio: {
type: DataTypes.TEXT,
allowNull: true,
},
image: {
type: DataTypes.STRING,
allowNull: true,
},
unique: true,
},
googleId: {
type: DataTypes.STRING,
allowNull: true,
},
facebookId: {
type: DataTypes.STRING,
allowNull: true,
},
twitterId: {
type: DataTypes.STRING,
allowNull: true,
},
firstName: {
type: DataTypes.STRING,
allowNull: false,
},
lastName: {
type: DataTypes.STRING,
allowNull: false,
},
password: {
type: DataTypes.STRING,
allowNull: true,
},
verified: {
type: DataTypes.BOOLEAN,
defaultValue: false,
},
bio: {
type: DataTypes.TEXT,
allowNull: true,
},
image: {
type: DataTypes.STRING,
allowNull: true,
},
});

Expand Down
5 changes: 0 additions & 5 deletions server/routes/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Router } from 'express';
import ArticleController from '../controllers/ArticleController';
import userAuthenticate from '../middlewares/isLoggedIn';
import ArticleValidation from '../middlewares/validations/ArticleValidation';
import isUser from '../middlewares/isUser';
import CommentValidation from '../middlewares/validations/CommentValidation';
import CommentController from '../controllers/CommentController';

Expand All @@ -14,10 +13,6 @@ articleRouter.put('/articles/:slug', userAuthenticate, ArticleValidation.validat

articleRouter.delete('/articles/:slug', userAuthenticate, ArticleController.removeArticle);

articleRouter.post('/articles/:slug/comments', userAuthenticate, CommentValidation.validateNewComment, CommentController.createComment);

articleRouter.get('/articles/:slug/comments', userAuthenticate, CommentController.getComments);

articleRouter.post('/articles/:slug/comments', userAuthenticate, CommentValidation.validateComment, CommentController.createComment);

articleRouter.get('/articles/:slug/comments', userAuthenticate, CommentController.getComments);
Expand Down
1 change: 0 additions & 1 deletion server/seeders/20180806182424-demo-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ module.exports = {
lastName: 'Doe',
username: 'oyomi',
email: 'seayomi@gmail.com',
verified: true,
createdAt: '2018-08-01 21:54:49',
updatedAt: '2018-08-04 21:54:49',
}
Expand Down

0 comments on commit acb3fd4

Please sign in to comment.