feat: add user createOne and refactor code
This commit is contained in:
@@ -2,7 +2,6 @@ import { Injectable, RequestTimeoutException } from '@nestjs/common';
|
||||
import { Repository } from 'typeorm';
|
||||
import { User } from '../user.entity';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { CreateUserDTO } from '../dto/create-user.dto';
|
||||
|
||||
@Injectable()
|
||||
export class UsersService {
|
||||
@@ -25,8 +24,8 @@ export class UsersService {
|
||||
}
|
||||
}
|
||||
|
||||
public async createOne(createUserDto: CreateUserDTO) {
|
||||
const newUser = this.userRepository.create(createUserDto);
|
||||
public async createOne(phone: string) {
|
||||
const newUser = this.userRepository.create({ phone });
|
||||
|
||||
try {
|
||||
await this.userRepository.save(newUser);
|
||||
|
||||
Reference in New Issue
Block a user