Skip to content

Commit

Permalink
Revert "refactor: deletion/deny requests now return the object"
Browse files Browse the repository at this point in the history
This reverts commit be64c2c.
  • Loading branch information
Creaous committed Dec 15, 2024
1 parent be64c2c commit c18f0eb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
9 changes: 5 additions & 4 deletions src/mutations/post/Collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ builder.mutationField('updatePostCollection', (t) =>

builder.mutationField('deletePostCollection', (t) =>
t.field({
type: PostCollection,
type: 'Boolean',
args: {
id: t.arg.string({ required: true })
},
Expand All @@ -112,11 +112,12 @@ builder.mutationField('deletePostCollection', (t) =>
);
}

return db
await db
.delete(postCollection)
.where(eq(postCollection.id, args.id))
.returning()
.then((res) => res[0]);
.execute();

return true;
}
})
);
Expand Down
9 changes: 5 additions & 4 deletions src/mutations/post/Post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ builder.mutationField('updatePost', (t) =>

builder.mutationField('deletePost', (t) =>
t.field({
type: Post,
type: 'Boolean',
args: {
id: t.arg.string({ required: true })
},
Expand All @@ -89,12 +89,13 @@ builder.mutationField('deletePost', (t) =>
return throwError('Post not found.', 'POST_NOT_FOUND');
}

return db
await db
.update(post)
.set({ deleted: true })
.where(eq(post.id, args.id))
.returning()
.then((res) => res[0]);
.execute();

return true;
}
})
);
6 changes: 4 additions & 2 deletions src/mutations/user/Relationship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ builder.mutationField('acceptFollowRequest', (t) =>

builder.mutationField('denyFollowRequest', (t) =>
t.field({
type: UserRelationship,
type: 'Boolean',
args: {
id: t.arg.string({ required: true })
},
Expand All @@ -101,7 +101,7 @@ builder.mutationField('denyFollowRequest', (t) =>
);
}

return db
await db
.delete(userRelationship)
.where(
and(
Expand All @@ -112,6 +112,8 @@ builder.mutationField('denyFollowRequest', (t) =>
)
.returning()
.then((res) => res[0]);

return true;
}
})
);
Expand Down

0 comments on commit c18f0eb

Please sign in to comment.