-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
164 additions
and
42 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
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,3 +1,5 @@ | ||
fail_on_violations: true | ||
|
||
scss: | ||
enabled: false | ||
config_file: .scss-lint.yml | ||
|
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,30 +1,25 @@ | ||
'use strict'; | ||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.createTable('UserFollows', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
userId: { | ||
type: Sequelize.INTEGER | ||
}, | ||
followerId: { | ||
type: Sequelize.INTEGER | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
} | ||
}); | ||
}, | ||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.dropTable('UserFollows'); | ||
} | ||
up: (queryInterface, Sequelize) => queryInterface.createTable('UserFollows', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
userId: { | ||
type: Sequelize.INTEGER | ||
}, | ||
followerId: { | ||
type: Sequelize.INTEGER | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
}, | ||
}), | ||
down: queryInterface => queryInterface.dropTable('UserFollows'), | ||
}; |
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,37 @@ | ||
|
||
module.exports = { | ||
up: queryInterface => queryInterface.bulkInsert( | ||
'Articles', | ||
[ | ||
{ | ||
authorId: 1, | ||
title: 'jbjkka2 kbviu buibi updated', | ||
body: 'ibin update1 cc', | ||
description: 'updfated kvilbulibvi', | ||
slug: 'gfvegybjcnwudj', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
}, | ||
{ | ||
authorId: 1, | ||
title: 'jbjkka2 kbviu buibi updated', | ||
body: 'ibin update1 cc', | ||
description: 'updfated kvilbulibvi', | ||
slug: 'ygehjnec', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
}, | ||
{ | ||
authorId: 1, | ||
title: 'jbjkka2 kbviu buibi updated', | ||
body: 'ibin update1 cc', | ||
description: 'updfated kvilbulibvi', | ||
slug: 'evbenjkve', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
} | ||
], {} | ||
), | ||
|
||
down: queryInterface => queryInterface.bulkDelete('Articles', 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module.exports = { | ||
up: queryInterface => queryInterface.bulkInsert( | ||
'ArticleTags', | ||
[ | ||
{ | ||
tagId: 1, | ||
articleId: 1, | ||
createdAt: new Date(), | ||
updatedAt: new Date() | ||
}, | ||
{ | ||
tagId: 1, | ||
articleId: 2, | ||
createdAt: new Date(), | ||
updatedAt: new Date() | ||
}, | ||
{ | ||
tagId: 1, | ||
articleId: 3, | ||
createdAt: new Date(), | ||
updatedAt: new Date() | ||
} | ||
], {} | ||
), | ||
|
||
down: queryInterface => queryInterface.bulkDelete('ArticleTags', 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module.exports = { | ||
up: queryInterface => queryInterface.bulkInsert( | ||
'Tags', | ||
[ | ||
{ | ||
tag: 'walker', | ||
createdAt: new Date(), | ||
updatedAt: new Date() | ||
} | ||
], {} | ||
), | ||
|
||
down: queryInterface => 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
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,31 @@ | ||
/** | ||
* @description - Paginates the articles collections | ||
* | ||
* @param {object} articles - articles details | ||
* | ||
* @param {Number} currentPage - Current page | ||
* | ||
* @param {Number} limit - Page limit | ||
* | ||
* @returns {object} pagination - Pagination object | ||
*/ | ||
|
||
const paginateArticle = ({ | ||
count = 0, rows = [] | ||
}, currentPage, limit) => { | ||
const totalRecords = count; | ||
const totalPages = Math.ceil(totalRecords / limit); | ||
const newArticles = Object.assign( | ||
{ | ||
}, | ||
{ | ||
currentPage, | ||
currentPageSize: rows.length, | ||
totalPages, | ||
totalRecords | ||
} | ||
); | ||
return newArticles; | ||
}; | ||
|
||
export default paginateArticle; |