-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
32e583d
commit c8c095c
Showing
17 changed files
with
341 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,9 @@ import { MailService } from './mail.service'; | |
user: config.get('MAIL_USER'), | ||
pass: config.get('MAIL_PASSWORD'), | ||
}, | ||
tls: { | ||
rejectUnauthorized: false | ||
} | ||
}, | ||
defaults: { | ||
from: `no-reply <[email protected]>`, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { | ||
registerDecorator, | ||
ValidationArguments, | ||
ValidationOptions, | ||
ValidatorConstraint, | ||
ValidatorConstraintInterface, | ||
} from 'class-validator'; | ||
|
||
export function Match(property: string, validationOptions?: ValidationOptions) { | ||
return (object: any, propertyName: string) => { | ||
registerDecorator({ | ||
target: object.constructor, | ||
propertyName, | ||
options: validationOptions, | ||
constraints: [property], | ||
validator: MatchConstraint, | ||
}); | ||
}; | ||
} | ||
|
||
@ValidatorConstraint({ name: 'Match' }) | ||
export class MatchConstraint implements ValidatorConstraintInterface { | ||
validate(value: any, args: ValidationArguments) { | ||
const [relatedPropertyName] = args.constraints; | ||
const relatedValue = (args.object as any)[relatedPropertyName]; | ||
return value === relatedValue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { UsersEntity } from '../../../database/entities/users.entity'; | ||
import { UserRepository } from '../repository/user.repository'; | ||
|
||
@Injectable() | ||
export class FindOneUserService { | ||
constructor(public userRepository: UserRepository) {} | ||
|
||
async execute(user: UsersEntity) { | ||
delete user.password; | ||
delete user.type; | ||
delete user.ip; | ||
delete user.recoverPasswordToken; | ||
async execute(id: string) { | ||
|
||
return user; | ||
const userExists = await this.userRepository.findOneById(id) | ||
|
||
delete userExists.password; | ||
delete userExists.type; | ||
delete userExists.ip; | ||
delete userExists.recoverPasswordToken; | ||
|
||
return userExists; | ||
} | ||
} |
Oops, something went wrong.