Skip to content

Commit

Permalink
Merge 2329454 into f8e44c7
Browse files Browse the repository at this point in the history
  • Loading branch information
Didun Morodolu committed Feb 13, 2019
2 parents f8e44c7 + 2329454 commit 02fb853
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/controllers/ArtsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ArtsController {
const { id: artistId } = req.verifyUser;

const {
title, description, categoryId, media
title, description, categoryId, media, price
} = req.body;

mediaFiles = media;
Expand Down Expand Up @@ -58,7 +58,8 @@ class ArtsController {
description,
categoryId,
featuredImg: mediaFilesArray[0].url,
status: defaultStatus
status: defaultStatus,
price
});

const {
Expand Down Expand Up @@ -107,6 +108,7 @@ class ArtsController {
artDescription,
artFeaturedImg,
artCategoryId,
price,
visited,
followersNotified
}
Expand Down Expand Up @@ -160,7 +162,7 @@ class ArtsController {
}

const {
title, description, categoryId, media
title, description, categoryId, media, price
} = req.body;

featuredImgUpdate = artToUpdate.dataValues.featuredImg;
Expand Down Expand Up @@ -193,6 +195,7 @@ class ArtsController {
description,
categoryId,
featuredImg: featuredImgUpdate,
price
});

const response = new Response(
Expand Down
1 change: 1 addition & 0 deletions src/middlewares/ArticleValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class ArticleValidator {
req.check('categoryId', 'Category is required & numeric').isNumeric();
req.check('description', 'Description should be longer').trim().notEmpty()
.isLength({ min: 15 });
req.check('price', 'Price is required & numeric').isNumeric();

const errors = req.validationErrors();
const validationErrors = [];
Expand Down
6 changes: 6 additions & 0 deletions test/mocks/testData.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ const artDetails = {
title: 'Syntax Podcasts',
description: 'The Syntax Podcasts isn\'t suitable for all ages',
categoryId: 1,
price: 1500.00,
media: `[{"url":
"https://farm3.staticflickr.com/2817/33968464326_a6f9cbc754_k",
"extension":"jpg"},
Expand All @@ -161,6 +162,7 @@ const artDetails = {
slug: 'cirrhosis-of-the-sky',
description: 'The Syntax Podcasts isn\'t suitable for all ages',
categoryId: 1,
price: 1500.00,
media: '[{"url":'
+ '"https://images.pexels.com/photos/1047540/pexels-photo-1047540.jpeg",'
+ '"extension":"jpg"},'
Expand All @@ -172,6 +174,7 @@ const artDetails = {
title: '',
description: 'The Syntax Podcasts isn\'t suitable for all ages',
categoryId: 1,
price: 1500.00,
media: '[{"url":'
+ '"https://farm3.staticflickr.com/2817/33968464326_a6f9cbc754_k",'
+ '"extension":"jpg"},'
Expand All @@ -183,12 +186,14 @@ const artDetails = {
title: 'Cirrhosis of the Sky',
description: 'The Syntax Podcasts isn\'t suitable for all ages',
categoryId: 1,
price: 1500.00,
},
invalidUpdatedArticle: {
title: 'Cirrhosis of the Sky',
slug: 'cirrhosis-of-the-sky',
description: 'The ',
categoryId: 100,
price: 1500.00,
media: '[{"url":'
+ '"https://farm3.staticflickr.com/2817/33968464326_a6f9cbc754_k",'
+ '"extension":"jpg"},'
Expand All @@ -202,6 +207,7 @@ const artDetails = {
description: 'To prepare your one sentence, I suggest making a list of all'
+ ' the things you are and do (it may feel silly, ',
categoryId: 1000,
price: 1500.00,
media: '[{"url":'
+ '"https://farm3.staticflickr.com/2817/33968464326_a6f9cbc754_k",'
+ '"extension":"jpg"},'
Expand Down

0 comments on commit 02fb853

Please sign in to comment.