Merge remote-tracking branch 'origin/julius-dev' into julius-dev

pull/5/head
Trivernis 5 years ago
commit 69b47d7d8d

@ -241,7 +241,10 @@ export function resolver(req: any, res: any): any {
}, },
async deletePost({postId}: { postId: number }) { async deletePost({postId}: { postId: number }) {
if (postId) { if (postId) {
const post = await models.Post.findByPk(postId, {include: [models.User]}); const post = await models.Post.findByPk(postId, {include: [{
as: "rAuthor",
model: models.User,
}]});
if (post.rAuthor.id === req.session.userId) { if (post.rAuthor.id === req.session.userId) {
return await dataaccess.deletePost(post.id); return await dataaccess.deletePost(post.id);
} else { } else {

Loading…
Cancel
Save