import { User } from '@/entities/user.entity';
import { CACHE_MANAGER } from '@nestjs/cache-manager';
import { Inject, Injectable } from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
import { InjectRepository } from '@nestjs/typeorm';
import { Cache } from 'cache-manager';
import { Repository } from 'typeorm';
import { AuthService } from '../auth.service';

@Injectable()
export class UserAuthService extends AuthService<User> {
  constructor(
    readonly jwtService: JwtService,
    @InjectRepository(User)
    readonly authRepo: Repository<User>,
    @Inject(CACHE_MANAGER) readonly redis: Cache,
  ) {
    super(jwtService, authRepo, redis, User, ['email', 'phone']);
  }
}
