mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
25 lines
767 B
TypeScript
25 lines
767 B
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
import { BaseRepository } from '@edr/api-common';
|
|
import { Repository, FindOptionsWhere } from 'typeorm';
|
|
import { Warranty } from './entities/warranty.entity';
|
|
|
|
@Injectable()
|
|
export class WarrantyRepository extends BaseRepository<Warranty> {
|
|
constructor(
|
|
@InjectRepository(Warranty)
|
|
private readonly warrantyRepository: Repository<Warranty>,
|
|
) {
|
|
super(warrantyRepository);
|
|
}
|
|
|
|
async findFiltered(filters: { vehicleId?: string }) {
|
|
const where: FindOptionsWhere<Warranty> = {};
|
|
if (filters.vehicleId) where.vehicleId = filters.vehicleId;
|
|
return this.warrantyRepository.find({
|
|
where,
|
|
order: { expiryDate: 'ASC' },
|
|
});
|
|
}
|
|
}
|