add service and controller functions to update post
This commit is contained in:
parent
0ed28237aa
commit
b840ebe654
|
@ -529,6 +529,16 @@ export class AppController {
|
||||||
return this.appService.createPost(post, date_entry, user_id, community_id);
|
return this.appService.createPost(post, date_entry, user_id, community_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Put('post/updatePost/:id')
|
||||||
|
updatePost(
|
||||||
|
@Param('id') id: string,
|
||||||
|
@Body('post') post: string,
|
||||||
|
@Body('user_id') user_id: string,
|
||||||
|
@Body('community_id') community_id: string,
|
||||||
|
) {
|
||||||
|
return this.appService.updatePost(id, post, user_id, community_id);
|
||||||
|
}
|
||||||
|
|
||||||
@Get('post/allPosts')
|
@Get('post/allPosts')
|
||||||
allPosts() {
|
allPosts() {
|
||||||
return this.appService.allPosts();
|
return this.appService.allPosts();
|
||||||
|
|
|
@ -638,6 +638,16 @@ export class AppService {
|
||||||
.pipe(map((message: string) => ({ message })));
|
.pipe(map((message: string) => ({ message })));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updatePost(id: string, post: string, user_id: string, community_id: string) {
|
||||||
|
const pattern = { cmd: 'updatePost' };
|
||||||
|
const payload = {
|
||||||
|
post: post, id: id, user_id: user_id, community_id: community_id
|
||||||
|
};
|
||||||
|
return this.clientPostApp
|
||||||
|
.send<string>(pattern, payload)
|
||||||
|
.pipe(map((message: string) => ({ message })));
|
||||||
|
}
|
||||||
|
|
||||||
allPosts() {
|
allPosts() {
|
||||||
const pattern = { cmd: 'findAllPosts' };
|
const pattern = { cmd: 'findAllPosts' };
|
||||||
const payload = {};
|
const payload = {};
|
||||||
|
|
Loading…
Reference in New Issue