agregar y actualizar funciones en api-gateway

This commit is contained in:
Mariela 2022-08-02 21:52:30 -06:00
parent e2f0b401c5
commit 89469a687c
2 changed files with 40 additions and 24 deletions

View File

@ -128,6 +128,14 @@ export class AppController {
return this.appService.deleteAdminSystem(id); return this.appService.deleteAdminSystem(id);
} }
@Post('user/changeStatus')
changeStatusUser(
@Body('id') pId: string,
@Body('status') pStatus: string,
) {
return this.appService.changeStatusUser(pId, pStatus);
}
// #==== API Communities // #==== API Communities
@Post('community/createCommunity') @Post('community/createCommunity')
createCommunity( createCommunity(
@ -174,11 +182,11 @@ export class AppController {
return this.appService.findCommunityAdmin(community_id); return this.appService.findCommunityAdmin(community_id);
} }
@Post('community/changeStatus') @Post('community/changeStatus')
changeStatus( changeStatusCommunity(
@Body('id') pId: string, @Body('id') pId: string,
@Body('status') pStatus: string, @Body('status') pStatus: string,
) { ) {
return this.appService.changeStatus(pId, pStatus); return this.appService.changeStatusCommunity(pId, pStatus);
} }
// #==== API Common Areas // #==== API Common Areas
@Post('commonArea/createCommonArea') @Post('commonArea/createCommonArea')

View File

@ -18,7 +18,7 @@ export class AppService {
@Inject('SERVICIO_REPORTES') private readonly clientReportApp: ClientProxy, @Inject('SERVICIO_REPORTES') private readonly clientReportApp: ClientProxy,
@Inject('SERVICIO_NOTIFICACIONES') @Inject('SERVICIO_NOTIFICACIONES')
private readonly clientNotificationtApp: ClientProxy, private readonly clientNotificationtApp: ClientProxy,
) {} ) { }
// ====================== USERS =============================== // ====================== USERS ===============================
@ -79,7 +79,7 @@ export class AppService {
.pipe(map((message: string) => ({ message }))); .pipe(map((message: string) => ({ message })));
} }
createAdminCommunity(dni: string, name: string, last_name: string, email: string, phone: number createAdminCommunity(dni: string, name: string, last_name: string, email: string, phone: number
, user_type: string, status: string, date_entry: Date, community_id: string) { , user_type: string, status: string, date_entry: Date, community_id: string) {
const pattern = { cmd: 'createAdminCommunity' }; const pattern = { cmd: 'createAdminCommunity' };
@ -128,7 +128,7 @@ export class AppService {
map((message: string) => ({ message })), map((message: string) => ({ message })),
); );
} }
//GET parameter from API //GET parameter from API
findUser(paramUserDNI: string) { findUser(paramUserDNI: string) {
@ -179,17 +179,10 @@ export class AppService {
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe(map((message: string) => ({ message }))); .pipe(map((message: string) => ({ message })));
} }
changeStatus(pId: string, pStatus: string) {
const pattern = { cmd: 'changeStatus' };
const payload = { id: pId, status: pStatus };
return this.clientCommunityApp
.send<string>(pattern, payload)
.pipe(map((message: string) => ({ message })));
}
//GET parameter from API //GET parameter from API
findUserById(id: string) { findUserById(id: string) {
const pattern = { cmd: 'findById' }; const pattern = { cmd: 'findById' };
const payload = { id: id }; const payload = { id: id };
return this.clientUserApp return this.clientUserApp
@ -197,8 +190,23 @@ export class AppService {
.pipe(map((message: string) => ({ message }))); .pipe(map((message: string) => ({ message })));
} }
changeStatusUser(pId: string, pStatus: string) {
const pattern = { cmd: 'changeStatus' };
const payload = { id: pId, status: pStatus };
return this.clientUserApp
.send<string>(pattern, payload)
.pipe(map((message: string) => ({ message })));
}
// ====================== COMMUNITIES =============================== // ====================== COMMUNITIES ===============================
changeStatusCommunity(pId: string, pStatus: string) {
const pattern = { cmd: 'changeStatus' };
const payload = { id: pId, status: pStatus };
return this.clientCommunityApp
.send<string>(pattern, payload)
.pipe(map((message: string) => ({ message })));
}
//POST parameter from API //POST parameter from API
createCommunity(name: string, province: string, canton: string, district: string createCommunity(name: string, province: string, canton: string, district: string
@ -285,8 +293,8 @@ export class AppService {
} }
//GET parameter from API //GET parameter from API
findByCommunity(paramCommunityId: string) { findByCommunity(paramCommunityId: string) {
const pattern = { cmd: 'findByCommunity' }; const pattern = { cmd: 'findByCommunity' };
const payload = { community_id: paramCommunityId }; const payload = { community_id: paramCommunityId };
return this.clientCommonAreaApp return this.clientCommonAreaApp
@ -295,14 +303,14 @@ export class AppService {
} }
//DELETE parameter from API //DELETE parameter from API
deleteCommonArea(paramCommonAreaId: string) { deleteCommonArea(paramCommonAreaId: string) {
const pattern = { cmd: 'removeCommonArea' }; const pattern = { cmd: 'removeCommonArea' };
const payload = { id: paramCommonAreaId }; const payload = { id: paramCommonAreaId };
return this.clientCommonAreaApp return this.clientCommonAreaApp
.send<string>(pattern, payload) .send<string>(pattern, payload)
.pipe(map((message: string) => ({ message }))); .pipe(map((message: string) => ({ message })));
} }
// ====================== GUESTS =============================== // ====================== GUESTS ===============================