From 318a40b961b0ef1ed83fa0de2baf967b5c89cbed Mon Sep 17 00:00:00 2001 From: Sergey Elpashev Date: Tue, 28 Nov 2023 22:54:39 +0300 Subject: [PATCH] Fix for posts not found --- backend/src/modules/post/post.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/modules/post/post.service.ts b/backend/src/modules/post/post.service.ts index 9220f0b..08ba6f1 100644 --- a/backend/src/modules/post/post.service.ts +++ b/backend/src/modules/post/post.service.ts @@ -99,7 +99,7 @@ export class PostService { async post() { try { const posts = await this.postRepository.find({ order: { timestamp: 'ASC' }, where: { posted: false }, relations: { images: true } }); - if (!posts) throw new HttpException('Nothing to post', HttpStatus.NOT_FOUND); + if (!posts.length) throw new HttpException('Nothing to post', HttpStatus.NOT_FOUND); const post = posts[0]; post.posted = true; this.logger.log(`[post.post] Post ${post.uuid} is posted`);