-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#164198504] Fix husky violation and push
- Loading branch information
Showing
27 changed files
with
743 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,5 +65,6 @@ | |
"parserOptions": { | ||
"ecmaVersion": 2017, | ||
"sourceType": "module" | ||
} | ||
}, | ||
"parser": "babel-eslint" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export default { | ||
up(queryInterface, Sequelize) { | ||
return queryInterface.createTable('Tags', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
name: { | ||
type: Sequelize.STRING | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE, | ||
defaultValue: new Date().getTime(), | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE, | ||
defaultValue: new Date().getTime(), | ||
} | ||
}); | ||
}, | ||
down: queryInterface => queryInterface.dropTable('Tags') | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
server/database/migrations/20190304180753-create-article-comment.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
export default { | ||
up(queryInterface, Sequelize) { | ||
return queryInterface.createTable('ArticleComments', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER, | ||
}, | ||
articleId: { | ||
type: Sequelize.INTEGER, | ||
allowNull: false, | ||
}, | ||
userId: { | ||
type: Sequelize.INTEGER, | ||
allowNull: false, | ||
}, | ||
comment: { | ||
type: Sequelize.STRING, | ||
allowNull: false, | ||
}, | ||
totalLikes: { | ||
type: Sequelize.INTEGER, | ||
defaultValue: 0, | ||
allowNull: false, | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE, | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE, | ||
} | ||
}); | ||
}, | ||
down: queryInterface => queryInterface.dropTable('ArticleComments') | ||
}; |
33 changes: 33 additions & 0 deletions
33
server/database/migrations/20190304180856-create-article-comment-like.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
export default { | ||
up(queryInterface, Sequelize) { | ||
return queryInterface.createTable('ArticleCommentLikes', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER, | ||
}, | ||
articleId: { | ||
type: Sequelize.INTEGER, | ||
allowNull: false, | ||
}, | ||
commentId: { | ||
type: Sequelize.INTEGER, | ||
allowNull: false, | ||
}, | ||
userId: { | ||
type: Sequelize.INTEGER, | ||
allowNull: false, | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE, | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE, | ||
} | ||
}); | ||
}, | ||
down: queryInterface => queryInterface.dropTable('ArticleCommentLikes') | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export default (sequelize, DataTypes) => { | ||
const ArticleComment = sequelize.define('ArticleComment', { | ||
articleId: DataTypes.INTEGER, | ||
userId: DataTypes.INTEGER, | ||
comment: DataTypes.STRING, | ||
totalLikes: DataTypes.INTEGER | ||
}, {}); | ||
ArticleComment.associate = (models) => { | ||
ArticleComment.belongsTo(models.User, { | ||
foreignKey: 'userId', | ||
}); | ||
ArticleComment.belongsTo(models.Article, { | ||
foreignKey: 'articleId', | ||
}); | ||
}; | ||
return ArticleComment; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export default (sequelize, DataTypes) => { | ||
const ArticleCommentLike = sequelize.define('ArticleCommentLike', { | ||
articleId: DataTypes.INTEGER, | ||
commentId: DataTypes.INTEGER, | ||
userId: DataTypes.INTEGER | ||
}, {}); | ||
ArticleCommentLike.associate = (models) => { | ||
ArticleCommentLike.belongsTo(models.User, { | ||
foreignKey: 'userId', | ||
}); | ||
ArticleCommentLike.belongsTo(models.ArticleComment, { | ||
foreignKey: 'commentId', | ||
}); | ||
}; | ||
return ArticleCommentLike; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export default (sequelize, DataTypes) => { | ||
const Tag = sequelize.define('Tag', { | ||
name: DataTypes.STRING | ||
}, {}); | ||
Tag.associate = (models) => { | ||
// associations can be defined here | ||
Tag.hasMany(models.Article, { | ||
foreingKey: 'tagId', | ||
as: 'articles' | ||
}); | ||
}; | ||
return Tag; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export default { | ||
up(queryInterface) { | ||
return queryInterface.bulkInsert('Tags', [{ | ||
name: 'Food' | ||
}, { | ||
name: 'Technology' | ||
}, { | ||
name: 'Art' | ||
}, { | ||
name: 'Finance' | ||
}, { | ||
name: 'Health' | ||
}], {}); | ||
}, | ||
|
||
down(queryInterface) { | ||
return queryInterface.bulkDelete('Tags', null, {}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.