Skip to content

Commit

Permalink
Merge bb6f166 into d9994ac
Browse files Browse the repository at this point in the history
  • Loading branch information
sojida committed May 16, 2019
2 parents d9994ac + bb6f166 commit 19c9a6d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
5 changes: 5 additions & 0 deletions server/controllers/get-articles.controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ const getAllReportedArticles = async (req, res) => {
model: Article,
as: 'article',
},
{
model: User,
as: 'reviewer',
attributes: ['first_name', 'last_name'],
},
],
});

Expand Down
4 changes: 2 additions & 2 deletions server/joiSchema/articleSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const articleSchema = () => {
body: Joi.string().min(5),
is_draft: Joi.boolean().required(),
image_url: Joi.string()
.min(0)
.max(250),
.allow('')
.allow(null),
keywords: Joi.array().items(Joi.string(), Joi.number()),
category: Joi.string()
.min(5)
Expand Down
4 changes: 2 additions & 2 deletions server/joiSchema/publishArticleSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const publishArticleSchema = () => {
.required(),
is_draft: Joi.boolean().required(),
image_url: Joi.string()
.min(0)
.max(250),
.allow('')
.allow(null),
keywords: Joi.array().items(Joi.string(), Joi.number()),
category: Joi.string()
.min(5)
Expand Down
5 changes: 5 additions & 0 deletions server/models/reported_article.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ module.exports = (sequelize, DataTypes) => {
foreignKey: 'reported_user_id',
as: 'user',
});

Reported.belongsTo(User, {
foreignKey: 'reviewer_id',
as: 'reviewer',
});
};

return Reported;
Expand Down
5 changes: 3 additions & 2 deletions server/seeders/20190331212819-reported_articles.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ module.exports = {
reported_article_id: 'fb3def47-153c-40bd-8161-a1c787e083d7',
reporter_reason: 'Copyright Infringment',
reporter_comment: 'The article.................',
reviewer_comment: '',
status: 'pending',
reviewer_comment:
'Yeah this report is valid. The author violated the copyright policy',
status: 'reviewed',
},
]),
};

0 comments on commit 19c9a6d

Please sign in to comment.