Filtro del listado
Cambio en el servicio del get de los usuarios
This commit is contained in:
parent
24bb8cef32
commit
9abdd27b41
|
@ -52,6 +52,11 @@ export class AppController {
|
||||||
return this.appService.inicioSesion(pEmail,pPassword);
|
return this.appService.inicioSesion(pEmail,pPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get('user/findAdminSistema')
|
||||||
|
allUsersAdminSistema() {
|
||||||
|
return this.appService.allUsersAdminSistema();
|
||||||
|
}
|
||||||
|
|
||||||
@Get('user/find/:dni')
|
@Get('user/find/:dni')
|
||||||
findUser(
|
findUser(
|
||||||
@Param('dni') paramUserDNI: string
|
@Param('dni') paramUserDNI: string
|
||||||
|
|
|
@ -60,6 +60,16 @@ export class AppService {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
allUsersAdminSistema() {
|
||||||
|
const pattern = { cmd: 'findAdminSistema' };
|
||||||
|
const payload = {};
|
||||||
|
return this.clientUserApp
|
||||||
|
.send<string>(pattern, payload)
|
||||||
|
.pipe(
|
||||||
|
map((message: string) => ({ message })),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//GET parameter from API
|
//GET parameter from API
|
||||||
findUser(paramUserDNI: string) {
|
findUser(paramUserDNI: string) {
|
||||||
const pattern = { cmd: 'findUserDNI' };
|
const pattern = { cmd: 'findUserDNI' };
|
||||||
|
|
|
@ -46,4 +46,10 @@ export class UsersController {
|
||||||
let ppassword= body['password'];
|
let ppassword= body['password'];
|
||||||
return this.userService.findLogin(pemail,ppassword);
|
return this.userService.findLogin(pemail,ppassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//buscar solo admins del sistema
|
||||||
|
@MessagePattern({ cmd: 'findAdminSistema' })
|
||||||
|
allUsersAdminSistema() {
|
||||||
|
return this.userService.allUsersAdminSistema();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ export class UsersService {
|
||||||
.setOptions({ sanitizeFilter: true })
|
.setOptions({ sanitizeFilter: true })
|
||||||
.exec();
|
.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
async findOne(id: string): Promise<User> {
|
async findOne(id: string): Promise<User> {
|
||||||
return this.userModel.findOne({ _id: id }).exec();
|
return this.userModel.findOne({ _id: id }).exec();
|
||||||
}
|
}
|
||||||
|
@ -65,4 +64,9 @@ export class UsersService {
|
||||||
|
|
||||||
return userReturn;
|
return userReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//find admin del sistema
|
||||||
|
async allUsersAdminSistema(): Promise<User[]> {
|
||||||
|
return this.userModel.find({ user_type: 1 }).exec();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { Column } from 'primereact/column';
|
||||||
const FormAdminSistema = () => {
|
const FormAdminSistema = () => {
|
||||||
|
|
||||||
const [pokemones,setPokemones]=useState([]);
|
const [pokemones,setPokemones]=useState([]);
|
||||||
const [urlFetch,setUrlFetch]=useState('http://localhost:4000/user/allUsers');
|
const [urlFetch,setUrlFetch]=useState('http://localhost:4000/user/findAdminSistema/');
|
||||||
async function fetchP(){
|
async function fetchP(){
|
||||||
let nombres=await fetch(urlFetch, {method:'GET'});
|
let nombres=await fetch(urlFetch, {method:'GET'});
|
||||||
let pokemonesRes= await nombres.json();
|
let pokemonesRes= await nombres.json();
|
||||||
|
|
Loading…
Reference in New Issue