Commit 3384cb11 authored by Augustin Leconte's avatar Augustin Leconte
Browse files

feat: mr returns

parent 8a2a215d
Pipeline #20249 failed with stages
in 58 seconds
......@@ -21,6 +21,7 @@ import { UsersService } from '../users/users.service';
import { PendingStructureDto } from './dto/pending-structure.dto';
import { validate } from 'class-validator';
import { Structure } from '../structures/schemas/structure.schema';
import { IUser } from '../users/interfaces/user.interface';
@Controller('admin')
export class AdminController {
......@@ -173,7 +174,7 @@ export class AdminController {
@Roles('admin')
@Get('getAttachedUsers')
public async findAttachedUsers() {
return this.usersService.findAllAttached().then(async (users: any[]) => {
return this.usersService.findAllAttached().then(async (users: IUser[]) => {
return this.structuresService.getAllUserCompletedStructures(users);
});
}
......@@ -182,7 +183,7 @@ export class AdminController {
@Roles('admin')
@Get('getUnVerifiedUsers')
public async findUnVerifiedUsers() {
return this.usersService.findAllUnVerified().then(async (users: any[]) => {
return this.usersService.findAllUnVerified().then(async (users: IUser[]) => {
return this.structuresService.getAllUserCompletedStructures(users);
});
}
......
......@@ -610,7 +610,7 @@ export class StructuresService {
return structure.contactMail === 'unknown@unknown.com';
}
public async getAllUserCompletedStructures(users: any[]): Promise<any[]> {
public async getAllUserCompletedStructures(users: IUser[]): Promise<any[]> {
return Promise.all(
users.map(async (user) => {
return {
......
......@@ -77,12 +77,12 @@ export class UsersService {
return this.userModel.findOne({ email: mail }).select('-password').exec();
}
public async findAll(): Promise<User[]> {
return await this.userModel.find().exec();
public findAll(): Promise<User[]> {
return this.userModel.find().exec();
}
public async findAllUnattached(): Promise<User[]> {
return await this.userModel
public findAllUnattached(): Promise<IUser[]> {
return this.userModel
.find()
.where('emailVerified')
.equals(true)
......@@ -92,8 +92,8 @@ export class UsersService {
.exec();
}
public async findAllAttached(): Promise<User[]> {
return await this.userModel
public findAllAttached(): Promise<IUser[]> {
return this.userModel
.find({ $where: 'this.structuresLink.length>0' })
.where('emailVerified')
.equals(true)
......@@ -101,8 +101,8 @@ export class UsersService {
.exec();
}
public async findAllUnVerified(): Promise<User[]> {
return await this.userModel.find().where('emailVerified').equals(false).sort({ surname: 1 }).exec();
public findAllUnVerified(): Promise<IUser[]> {
return this.userModel.find().where('emailVerified').equals(false).sort({ surname: 1 }).exec();
}
public async findById(id: string, passwordQuery?: boolean): Promise<IUser | undefined> {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment