Skip to content

Commit

Permalink
feat: req12 -lint
Browse files Browse the repository at this point in the history
  • Loading branch information
dopimentel committed Feb 21, 2024
1 parent fc6fbd5 commit d85796a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/services/postService.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ const create = async ({ title, content, categoryIds, userId }) => {
if (categoryNotFound) return categoryNotFound;
const result = await sequelize.transaction(async (t) => {
const { dataValues } = await BlogPost.create({ title, content, userId }, { transaction: t });
const postCategoriesList = categoryIds.map((categoryId) => ({ postId: dataValues.id, categoryId }));
const postsCategories = await PostCategory.bulkCreate(postCategoriesList, { transaction: t });
return await BlogPost.findOne({ where: { id: dataValues.id }, transaction: t });
const postCategoriesList = categoryIds
.map((categoryId) => ({ postId: dataValues.id, categoryId }));
await PostCategory.bulkCreate(postCategoriesList, { transaction: t });
return BlogPost.findOne({ where: { id: dataValues.id }, transaction: t });
});
return result;
};


module.exports = {
create,
};

0 comments on commit d85796a

Please sign in to comment.