diff --git a/src/data/posts.service.ts b/src/data/posts.service.ts index 5dad235..6da4f4b 100644 --- a/src/data/posts.service.ts +++ b/src/data/posts.service.ts @@ -45,7 +45,6 @@ export class PostsService { } else if (olderThan) { idQuery = LessThan(olderThan); } - const [posts, count] = await this.aggregatedPosts.findAndCount({ skip: offset, @@ -56,7 +55,8 @@ export class PostsService { where: { parentId: IsNull(), id: idQuery, - ...(creator ? {creator} : {}) + deleted: false, + ...(creator ? { creator } : {}), }, }); return { posts, count }; @@ -139,7 +139,7 @@ export class PostsService { where: { id }, }); const replies = await this.aggregatedPosts.find({ - where: { parentId: id }, + where: { parentId: id, deleted: false }, order: { id: 'desc' }, }); diff --git a/src/rest/posts.controller.ts b/src/rest/posts.controller.ts index 4ee255d..b874973 100644 --- a/src/rest/posts.controller.ts +++ b/src/rest/posts.controller.ts @@ -130,7 +130,7 @@ export class PostsController { name: 'creator', required: false, description: - 'The ID of a creator. Only posts of this should be returned. If omitted, all posts are returned.', + 'The ID of a creator. Only posts of the given creator should be returned. If omitted, all posts are returned.', examples: { 'all posts': { value: undefined, @@ -152,7 +152,7 @@ export class PostsController { type: 'array', items: { uniqueItems: true, - oneOf: [postSchema, replySchema, deletedSchema], + ...postSchema, }, }, count: { @@ -258,7 +258,8 @@ export class PostsController { type: 'array', uniqueItems: true, items: { - oneOf: [replySchema, deletedSchema], + uniqueItems: true, + ...replySchema, }, }, })