actualizar area comun completo

This commit is contained in:
Mariela 2022-08-30 23:11:34 -06:00
parent a06fbe5cf3
commit 30e559daaf
4 changed files with 40 additions and 2 deletions

View File

@ -425,6 +425,23 @@ export class AppController {
return this.appService.changeStatusCommonArea(pId, pStatus); return this.appService.changeStatusCommonArea(pId, pStatus);
} }
@Post('commonArea/updateCommonArea')
updateCommonArea(
@Body('_id') id: string,
@Body('name') name: string,
@Body('hourMin') hourMin: string,
@Body('hourMax') hourMax: string,
@Body('bookable') bookable: number,
@Body('community_id') community_id: string,
) {
return this.appService.updateCommonArea(
id,
name,
hourMin,
hourMax,
bookable,
community_id,);
}
// #==== API GUEST // #==== API GUEST
//#API userService - create user //#API userService - create user
@Post('guest/createGuest') @Post('guest/createGuest')

View File

@ -522,7 +522,27 @@ export class AppService {
.pipe(map((message: string) => ({ message }))); .pipe(map((message: string) => ({ message })));
} }
updateCommonArea(
id: string,
name: string,
hourMin: string,
hourMax: string,
bookable: number,
community_id: string,
) {
const pattern = { cmd: 'updateCommonArea' };
const payload = {
id: id,
name: name,
hourMin: hourMin,
hourMax: hourMax,
bookable: bookable,
community_id: community_id,
};
return this.clientCommonAreaApp
.send<string>(pattern, payload)
.pipe(map((message: string) => ({ message })));
}
// ====================== GUESTS =============================== // ====================== GUESTS ===============================
//POST parameter from API //POST parameter from API

View File

@ -26,6 +26,7 @@ export class CommonAreasService {
} }
update(id: string, commonArea: CommonAreaDocument) { update(id: string, commonArea: CommonAreaDocument) {
console.log(commonArea);
return this.commonAreaModel.findOneAndUpdate({ _id: id }, commonArea, { return this.commonAreaModel.findOneAndUpdate({ _id: id }, commonArea, {
new: true, new: true,
}); });

View File

@ -166,7 +166,7 @@ const AreasComunes = () => {
}, },
}) })
.then(function (response) { .then(function (response) {
if (response.status != 201) if (response.status != 201 && response.status != 200)
console.log('Ocurrió un error con el servicio: ' + response.status); console.log('Ocurrió un error con el servicio: ' + response.status);
else return response.json(); else return response.json();
}) })