mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-19 08:50:29 +00:00
Add clearAllData as a declared method
This commit is contained in:
@@ -8,4 +8,6 @@ export interface ExternalSourceETARepository extends ETAGetterRepository {
|
|||||||
addOrUpdateEtaFromExternalSource(eta: IEta): Promise<void>;
|
addOrUpdateEtaFromExternalSource(eta: IEta): Promise<void>;
|
||||||
|
|
||||||
removeEtaIfExists(shuttleId: string, stopId: string): Promise<IEta | null>;
|
removeEtaIfExists(shuttleId: string, stopId: string): Promise<IEta | null>;
|
||||||
|
|
||||||
|
clearAllData(): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,29 @@
|
|||||||
|
import { createClient, RedisClientType } from "redis";
|
||||||
import { IEta } from "../../../entities/ShuttleRepositoryEntities";
|
import { IEta } from "../../../entities/ShuttleRepositoryEntities";
|
||||||
import { ETARepositoryEventName, ETARepositoryEventListener } from "./ETAGetterRepository";
|
import { ETARepositoryEventName, ETARepositoryEventListener } from "./ETAGetterRepository";
|
||||||
import { ExternalSourceETARepository } from "./ExternalSourceETARepository";
|
import { ExternalSourceETARepository } from "./ExternalSourceETARepository";
|
||||||
|
import { REDIS_RECONNECT_INTERVAL } from "../../../environment";
|
||||||
|
|
||||||
export class RedisExternalSourceETARepository implements ExternalSourceETARepository {
|
export class RedisExternalSourceETARepository implements ExternalSourceETARepository {
|
||||||
|
constructor(
|
||||||
|
private redisClient: RedisClientType = createClient({
|
||||||
|
url: process.env.REDIS_URL,
|
||||||
|
socket: {
|
||||||
|
tls: process.env.NODE_ENV === 'production',
|
||||||
|
rejectUnauthorized: false,
|
||||||
|
reconnectStrategy: REDIS_RECONNECT_INTERVAL,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public async connect() {
|
||||||
|
await this.redisClient.connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async disconnect() {
|
||||||
|
await this.redisClient.disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
addOrUpdateEtaFromExternalSource(eta: IEta): Promise<void> {
|
addOrUpdateEtaFromExternalSource(eta: IEta): Promise<void> {
|
||||||
throw new Error("Method not implemented.");
|
throw new Error("Method not implemented.");
|
||||||
}
|
}
|
||||||
@@ -63,4 +84,7 @@ export class RedisExternalSourceETARepository implements ExternalSourceETAReposi
|
|||||||
eventNames(): (string | symbol)[] {
|
eventNames(): (string | symbol)[] {
|
||||||
throw new Error("Method not implemented.");
|
throw new Error("Method not implemented.");
|
||||||
}
|
}
|
||||||
|
clearAllData(): Promise<void> {
|
||||||
|
throw new Error("Method not implemented.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user