import { Injectable } from '@nestjs/common';
import { CreateAdminDto } from './dto/create-admin.dto';
import { Admin } from './entities/admin.entity';
import { Repository } from 'typeorm';
import { InjectRepository } from '@nestjs/typeorm';

@Injectable()
export class AdminService {
  constructor(@InjectRepository(Admin) private adminRepository: Repository<Admin>) {}
  async create(createAdminDto: CreateAdminDto) {
    await this.adminRepository.insert(createAdminDto);
  }

  async findOne(email: string): Promise<Admin> {
    return await this.adminRepository.findOneByOrFail({ email });
  }
}
