update findOneById en cada contralador de microservicio

This commit is contained in:
Mariela 2022-07-01 03:10:45 -06:00
parent 6915dd9562
commit 247d038f42
3 changed files with 8 additions and 9 deletions

View File

@ -19,7 +19,8 @@ export class CommonAreasController {
@MessagePattern({cmd: 'findOneCommonArea'})
findOne(@Payload() id: string) {
return this.commonAreasService.findOne(id);
let _id = id['_id'];
return this.commonAreasService.findOne(_id);
}
@MessagePattern({cmd: 'updateCommonArea'})
@ -29,6 +30,7 @@ export class CommonAreasController {
@MessagePattern({cmd: 'removeCommonArea'})
remove(@Payload() id: string) {
return this.commonAreasService.remove(id);
let _id = id['_id'];
return this.commonAreasService.remove(_id);
}
}

View File

@ -19,7 +19,8 @@ export class CommunitiesController {
@MessagePattern({cmd: 'findOneCommunity'})
findOne(@Payload() id: string) {
return this.communitiesService.findOne(id);
let _id = id['_id'];
return this.communitiesService.findOne(_id);
}
@MessagePattern({cmd: 'updateCommunity'})
@ -29,6 +30,7 @@ export class CommunitiesController {
@MessagePattern({cmd: 'removeCommunity'})
remove(@Payload() id: string) {
return this.communitiesService.remove(id);
let _id = id['_id'];
return this.communitiesService.remove(_id);
}
}

View File

@ -2,7 +2,6 @@ import { Injectable } from '@nestjs/common';
import { Model } from 'mongoose';
import { Community, CommunityDocument } from 'src/schemas/community.schema';
import { InjectModel } from '@nestjs/mongoose';
import { Request } from 'express';
@Injectable()
export class CommunitiesService {
@ -32,10 +31,6 @@ export class CommunitiesService {
});
}
async remove(id: string) {
return this.communityModel.findByIdAndRemove({ _id: id }).exec();
}