mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-08-25 21:59:40 +00:00
19 lines
636 B
TypeScript
19 lines
636 B
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
import { FindOptionsWhere, Repository } from 'typeorm';
|
|
import { UpdateCustomerRequestDto } from '../dtos/request';
|
|
import { Customer } from '../entities';
|
|
|
|
@Injectable()
|
|
export class CustomerRepository {
|
|
constructor(@InjectRepository(Customer) private readonly customerRepository: Repository<Customer>) {}
|
|
|
|
updateCustomer(id: string, data: UpdateCustomerRequestDto) {
|
|
return this.customerRepository.update(id, data);
|
|
}
|
|
|
|
findOne(where: FindOptionsWhere<Customer>) {
|
|
return this.customerRepository.findOne({ where });
|
|
}
|
|
}
|