mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 12:58:13 +00:00
30 lines
836 B
TypeScript
30 lines
836 B
TypeScript
import { BaseRepository } from '@edr/api-common';
|
|
import { Injectable } from '@nestjs/common';
|
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
import { Repository } from 'typeorm';
|
|
|
|
import { GpsDevice } from './entities/gps-device.entity';
|
|
import { GpsPosition } from './entities/gps-position.entity';
|
|
|
|
@Injectable()
|
|
export class GpsDeviceRepository extends BaseRepository<GpsDevice> {
|
|
constructor(
|
|
@InjectRepository(GpsDevice) repository: Repository<GpsDevice>,
|
|
) {
|
|
super(repository);
|
|
}
|
|
|
|
findByImei(imei: string): Promise<GpsDevice | null> {
|
|
return this.repository.findOne({ where: { imei } });
|
|
}
|
|
}
|
|
|
|
@Injectable()
|
|
export class GpsPositionRepository extends BaseRepository<GpsPosition> {
|
|
constructor(
|
|
@InjectRepository(GpsPosition) repository: Repository<GpsPosition>,
|
|
) {
|
|
super(repository);
|
|
}
|
|
}
|