add service and controller functions to update post

This commit is contained in:
Eduardo Quiros 2022-08-30 05:56:59 -06:00
parent 0ed28237aa
commit b840ebe654
No known key found for this signature in database
GPG Key ID: B77F36C3F12720B4
2 changed files with 26 additions and 6 deletions

View File

@ -529,6 +529,16 @@ export class AppController {
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')
allPosts() {
return this.appService.allPosts();

View File

@ -540,7 +540,7 @@ export class AppService {
const pattern = { cmd: 'createGuest' };
const payload = {
name: name, last_name: last_name, dni: dni, number_plate: number_plate, phone: phone,
status: status,tenant_id:tenant_id, community_id:community_id,date_entry: date_entry
status: status, tenant_id: tenant_id, community_id: community_id, date_entry: date_entry
};
return this.clientGuestApp
.send<string>(pattern, payload)
@ -638,6 +638,16 @@ export class AppService {
.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() {
const pattern = { cmd: 'findAllPosts' };
const payload = {};