Merge branch 'julius-dev' of Software_Engineering_I/greenvironment-server into master

pull/5/head
Trivernis 5 years ago committed by Gitea
commit e4e2344371

@ -241,7 +241,10 @@ export function resolver(req: any, res: any): any {
},
async deletePost({postId}: { postId: number }) {
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) {
return await dataaccess.deletePost(post.id);
} else {

Loading…
Cancel
Save