1 /**
2 * Get all posts from all users
3 post controller.ts
4 */
5 @Get('find')
6 @ApiCreatedResponse({
7 status: 201,
8 description: 'All posts have been successfully retreived.',
9 type: [PostDTO],
10 })
11 @ApiResponse({ status: 403, description: 'Forbidden.' })
12 async find() {
13 try {
14 return this.postService.findAll();
15 } catch (error) {
16 throw new Error(error);
17 }
18 }
19
20
21 /**
22 * Find all posts
23 post service.ts
24 */
25 async findAll(): Promise<Post[]> {
26 const posts = await this.postRepository.find();
27 return posts;
28 }
29
30