feat: add simple login logic
This commit is contained in:
@@ -14,6 +14,17 @@ export class UsersService {
|
||||
private readonly userRepository: Repository<User>,
|
||||
) {}
|
||||
|
||||
public async findOneByPhone(phone: string) {
|
||||
try {
|
||||
return await this.userRepository.findOneBy({ phone });
|
||||
} catch (err) {
|
||||
throw new RequestTimeoutException(
|
||||
'Unable to process your request at the moment. Please try again later.',
|
||||
{ cause: err, description: 'Error connecting to the database' },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public async createOne(createUserDto: CreateUserDTO) {
|
||||
const newUser = this.userRepository.create(createUserDto);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user