update schema usuarios - microservicio usuario

This commit is contained in:
Mariela 2022-06-30 19:43:19 -06:00
parent 3bc61cbd4f
commit 0cff6dc2f2
3 changed files with 10 additions and 24 deletions

View File

@ -33,9 +33,12 @@ export class User {
@Prop() @Prop()
status: string; status: string;
@Prop() @Prop()
date_entry: Date; date_entry: Date;
@Prop()
community_id?: string;
} }

View File

@ -1,23 +0,0 @@
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';
export type UserCommunityDocument = UserCommunity & Document;
@Schema({ collection: 'users_communities' })
export class UserCommunity {
@Prop()
user_id: string;
@Prop()
community_id: string;
}
export const UserCommunitySchema = SchemaFactory.createForClass(UserCommunity);

View File

@ -12,6 +12,11 @@ export class UsersController {
return this.userService.create(user); return this.userService.create(user);
} }
@MessagePattern({ cmd: 'createAdminSystem' })
createUserAdmin(@Payload() user: UserDocument) {
return this.userService.create(user);
}
@MessagePattern({ cmd: 'findAllUsers' }) @MessagePattern({ cmd: 'findAllUsers' })
findAll() { findAll() {
return this.userService.findAll(); return this.userService.findAll();
@ -21,6 +26,7 @@ export class UsersController {
findOne(@Payload() dni: string) { findOne(@Payload() dni: string) {
return this.userService.findOneByDNI(dni); return this.userService.findOneByDNI(dni);
} }
@MessagePattern({ cmd: 'updateUser' }) @MessagePattern({ cmd: 'updateUser' })
update(@Payload() user: UserDocument) { update(@Payload() user: UserDocument) {
return this.userService.update(user.id, user); return this.userService.update(user.id, user);