mirror of
https://github.com/MrSedan/neuro-reply-website.git
synced 2026-01-14 20:49:42 +03:00
Get deleted posts
This commit is contained in:
@@ -63,4 +63,10 @@ export class PostController {
|
|||||||
async deletePostByOrder(@Param('order') order: number) {
|
async deletePostByOrder(@Param('order') order: number) {
|
||||||
return await this.postService.deletePostByOrder(order);
|
return await this.postService.deletePostByOrder(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation({ description: 'Get deleted posts' })
|
||||||
|
@Get('get-deleted')
|
||||||
|
async getDeletedPosts() {
|
||||||
|
return await this.postService.getDeletedPosts();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,4 +190,13 @@ export class PostService {
|
|||||||
throw new HttpException('Bad data', HttpStatus.BAD_REQUEST);
|
throw new HttpException('Bad data', HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getDeletedPosts() {
|
||||||
|
try {
|
||||||
|
return await this.postRepository.find({ where: { deleted: true, posted: false }, order: { timestamp: 'ASC' } });
|
||||||
|
} catch (error) {
|
||||||
|
this.logger.debug(`[post.getDeleted] error: ${JSON.stringify(error)}`);
|
||||||
|
throw new HttpException('Bad data', HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user