feat: init project and add user module

This commit is contained in:
2026-02-17 12:29:31 +03:30
commit b9779f7cb6
29 changed files with 11774 additions and 0 deletions
@@ -0,0 +1,31 @@
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 {
constructor(
/**
* Injecting User Repository
*/
@InjectRepository(User)
private readonly userRepository: Repository<User>,
) {}
public async createOne(createUserDto: CreateUserDTO) {
const newUser = this.userRepository.create(createUserDto);
try {
await this.userRepository.save(newUser);
} 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' },
);
}
return newUser;
}
}