import { UserData , UserRepository } from '@/use-cases/ports' ; export class InMemoryUserRepository implements UserRepository { private readonly _data : UserData [ ] ; private idcounter : number = 0 ; public get data ( ) { return this . _data ; } constructor ( data ) { this . _data = data ; } public async findAll ( ) { return this . _data ; } public async findByEmail ( email ) { const found = this . data . find ( ( user , index ) => user . email === email ) ; return found || null ; } public async add ( userData ) { userData . id = this . idcounter . toString ( ) ; this . idcounter ++ ; this . _data . push ( userData ) ; return userData ; } }