-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(get single article):get single article
get single article [finishes #167222364]
- Loading branch information
Showing
15 changed files
with
226 additions
and
129 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 |
---|---|---|
|
@@ -43,3 +43,6 @@ lib | |
|
||
.nyc_output/ | ||
lcov.info | ||
|
||
# Ignore index.html | ||
src/test.html |
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 |
---|---|---|
@@ -1,39 +1,39 @@ | ||
'use strict'; | ||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.createTable('Reports', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
body: { | ||
type: Sequelize.TEXT, | ||
required: true, | ||
allowNull: false | ||
}, | ||
reportType: { | ||
type: Sequelize.ENUM(['article', 'comment']), | ||
required: true, | ||
allowNull: false | ||
}, | ||
reportTypeId: { | ||
type: Sequelize.INTEGER, | ||
required: true, | ||
allowNull: false | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
} | ||
}); | ||
}, | ||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.dropTable('Reports'); | ||
} | ||
}; | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.createTable('Reports', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
body: { | ||
type: Sequelize.TEXT, | ||
required: true, | ||
allowNull: false | ||
}, | ||
reportType: { | ||
type: Sequelize.ENUM(['article', 'comment']), | ||
required: true, | ||
allowNull: false | ||
}, | ||
reportTypeId: { | ||
type: Sequelize.INTEGER, | ||
required: true, | ||
allowNull: false | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
} | ||
}); | ||
}, | ||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.dropTable('Reports'); | ||
} | ||
}; |
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 |
---|---|---|
|
@@ -38,4 +38,4 @@ module.exports = { | |
} | ||
}), | ||
down: queryInterface => queryInterface.dropTable('CommentLikes'), | ||
}; | ||
}; |
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 |
---|---|---|
@@ -1,41 +1,41 @@ | ||
module.exports = { | ||
up: (queryInterface, Sequelize) => queryInterface.createTable('Bookmarks', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
userId: { | ||
type: Sequelize.INTEGER, | ||
required: true, | ||
onUpdate: 'CASCADE', | ||
onDelete: 'CASCADE', | ||
references: { | ||
model: 'Users', | ||
key: 'id', | ||
as: 'userId' | ||
} | ||
}, | ||
articleId: { | ||
type: Sequelize.INTEGER, | ||
required: true, | ||
onUpdate: 'CASCADE', | ||
onDelete: 'CASCADE', | ||
references: { | ||
model: 'Articles', | ||
key: 'id', | ||
as: 'articleId' | ||
} | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
up: (queryInterface, Sequelize) => queryInterface.createTable('Bookmarks', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
userId: { | ||
type: Sequelize.INTEGER, | ||
required: true, | ||
onUpdate: 'CASCADE', | ||
onDelete: 'CASCADE', | ||
references: { | ||
model: 'Users', | ||
key: 'id', | ||
as: 'userId' | ||
} | ||
}), | ||
down: queryInterface => queryInterface.dropTable('Bookmarks'), | ||
}; | ||
}, | ||
articleId: { | ||
type: Sequelize.INTEGER, | ||
required: true, | ||
onUpdate: 'CASCADE', | ||
onDelete: 'CASCADE', | ||
references: { | ||
model: 'Articles', | ||
key: 'id', | ||
as: 'articleId' | ||
} | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
} | ||
}), | ||
down: queryInterface => queryInterface.dropTable('Bookmarks'), | ||
}; |
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 |
---|---|---|
@@ -1,25 +1,25 @@ | ||
module.exports = (sequelize, DataTypes) => { | ||
const Bookmark = sequelize.define('Bookmark', { | ||
userId: { | ||
type: DataTypes.INTEGER, | ||
required: true, | ||
}, | ||
articleId: { | ||
type: DataTypes.INTEGER, | ||
required: true, | ||
} | ||
}, {}); | ||
Bookmark.associate = (models) => { | ||
Bookmark.belongsTo(models.Article, { | ||
foreignKey: 'articleId', | ||
onDelete: 'CASCADE', | ||
onUpdate: 'CASCADE' | ||
}); | ||
Bookmark.belongsTo(models.User, { | ||
foreignKey: 'userId', | ||
onDelete: 'CASCADE', | ||
onUpdate: 'CASCADE' | ||
}); | ||
}; | ||
return Bookmark; | ||
const Bookmark = sequelize.define('Bookmark', { | ||
userId: { | ||
type: DataTypes.INTEGER, | ||
required: true, | ||
}, | ||
articleId: { | ||
type: DataTypes.INTEGER, | ||
required: true, | ||
} | ||
}, {}); | ||
Bookmark.associate = (models) => { | ||
Bookmark.belongsTo(models.Article, { | ||
foreignKey: 'articleId', | ||
onDelete: 'CASCADE', | ||
onUpdate: 'CASCADE' | ||
}); | ||
Bookmark.belongsTo(models.User, { | ||
foreignKey: 'userId', | ||
onDelete: 'CASCADE', | ||
onUpdate: 'CASCADE' | ||
}); | ||
}; | ||
return Bookmark; | ||
}; |
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
module.exports = (sequelize, DataTypes) => { | ||
const Report = sequelize.define('Report', { | ||
body: DataTypes.TEXT, | ||
reportType: DataTypes.ENUM(['article', 'comment']), | ||
reportTypeId: DataTypes.INTEGER | ||
}, {}); | ||
Report.associate = function(models) { | ||
}; | ||
return Report; | ||
const Report = sequelize.define('Report', { | ||
body: DataTypes.TEXT, | ||
reportType: DataTypes.ENUM(['article', 'comment']), | ||
reportTypeId: DataTypes.INTEGER | ||
}, {}); | ||
Report.associate = function(models) { | ||
}; | ||
return Report; | ||
}; |
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.