update findOneById en cada contralador de microservicio
This commit is contained in:
		
							parent
							
								
									6915dd9562
								
							
						
					
					
						commit
						247d038f42
					
				|  | @ -19,7 +19,8 @@ export class CommonAreasController { | ||||||
| 
 | 
 | ||||||
|   @MessagePattern({cmd: 'findOneCommonArea'}) |   @MessagePattern({cmd: 'findOneCommonArea'}) | ||||||
|   findOne(@Payload() id: string) { |   findOne(@Payload() id: string) { | ||||||
|     return this.commonAreasService.findOne(id); |     let _id = id['_id']; | ||||||
|  |     return this.commonAreasService.findOne(_id); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   @MessagePattern({cmd: 'updateCommonArea'}) |   @MessagePattern({cmd: 'updateCommonArea'}) | ||||||
|  | @ -29,6 +30,7 @@ export class CommonAreasController { | ||||||
| 
 | 
 | ||||||
|   @MessagePattern({cmd: 'removeCommonArea'}) |   @MessagePattern({cmd: 'removeCommonArea'}) | ||||||
|   remove(@Payload() id: string) { |   remove(@Payload() id: string) { | ||||||
|     return this.commonAreasService.remove(id); |     let _id = id['_id']; | ||||||
|  |     return this.commonAreasService.remove(_id); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -19,7 +19,8 @@ export class CommunitiesController { | ||||||
| 
 | 
 | ||||||
|   @MessagePattern({cmd: 'findOneCommunity'}) |   @MessagePattern({cmd: 'findOneCommunity'}) | ||||||
|   findOne(@Payload() id: string) { |   findOne(@Payload() id: string) { | ||||||
|     return this.communitiesService.findOne(id); |     let _id = id['_id']; | ||||||
|  |     return this.communitiesService.findOne(_id); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   @MessagePattern({cmd: 'updateCommunity'}) |   @MessagePattern({cmd: 'updateCommunity'}) | ||||||
|  | @ -29,6 +30,7 @@ export class CommunitiesController { | ||||||
| 
 | 
 | ||||||
|   @MessagePattern({cmd: 'removeCommunity'}) |   @MessagePattern({cmd: 'removeCommunity'}) | ||||||
|   remove(@Payload() id: string) { |   remove(@Payload() id: string) { | ||||||
|     return this.communitiesService.remove(id); |     let _id = id['_id']; | ||||||
|  |     return this.communitiesService.remove(_id); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -2,7 +2,6 @@ import { Injectable } from '@nestjs/common'; | ||||||
| import { Model } from 'mongoose'; | import { Model } from 'mongoose'; | ||||||
| import { Community, CommunityDocument } from 'src/schemas/community.schema';  | import { Community, CommunityDocument } from 'src/schemas/community.schema';  | ||||||
| import { InjectModel } from '@nestjs/mongoose'; | import { InjectModel } from '@nestjs/mongoose'; | ||||||
| import { Request } from 'express';  |  | ||||||
| 
 | 
 | ||||||
| @Injectable() | @Injectable() | ||||||
| export class CommunitiesService { | export class CommunitiesService { | ||||||
|  | @ -32,10 +31,6 @@ export class CommunitiesService { | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|    |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|   async remove(id: string) { |   async remove(id: string) { | ||||||
|     return this.communityModel.findByIdAndRemove({ _id: id }).exec(); |     return this.communityModel.findByIdAndRemove({ _id: id }).exec(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue