import { Injectable } from '@nestjs/common'; import { PassportStrategy } from '@nestjs/passport'; import { Strategy } from 'passport-local'; import { Customer } from '../../customers/entities/customer.entity'; import { AuthService } from '../auth.service'; @Injectable() export class LocalStrategy extends PassportStrategy(Strategy, 'local') { constructor(private readonly authService: AuthService) { super({ usernameField: 'email', }); } async validate(email: string, password: string): Promise { return await this.authService.getAuthenticatedCustomer(email, password); } }