import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; import { User } from '../../domain/entities/user.entity'; @Injectable() export class UserRepository { constructor( @InjectRepository(User) private readonly repo: Repository, ) {} async findByEmail(email: string): Promise { return this.repo.findOneBy({ email }); } async findById(id: string): Promise { return this.repo.findOneBy({ id }); } async save(user: User): Promise { return this.repo.save(user); } }