Skip to content

Commit

Permalink
fix: errors from merge
Browse files Browse the repository at this point in the history
  • Loading branch information
deeonwuli committed Aug 20, 2024
1 parent 2ae9cb9 commit 612e12a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/data/repositories/AlertD2Repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
D2TrackerTrackedEntity,
TrackedEntitiesGetResponse,
} from "@eyeseetea/d2-api/api/trackerTrackedEntities";
import { Maybe } from "../../utils/ts-utils";

export class AlertD2Repository implements AlertRepository {
constructor(private api: D2Api) {}
Expand Down Expand Up @@ -52,7 +53,7 @@ export class AlertD2Repository implements AlertRepository {

private async getTrackedEntitiesByTEACodeAsync(filter: {
id: Id;
value: string;
value: Maybe<string>;
}): Promise<D2TrackerTrackedEntity[]> {
const d2TrackerTrackedEntities: D2TrackerTrackedEntity[] = [];

Expand Down Expand Up @@ -92,7 +93,7 @@ export class AlertD2Repository implements AlertRepository {

private getTrackedEntitiesByTEACode(filter: {
id: Id;
value: string;
value: Maybe<string>;
}): FutureData<D2TrackerTrackedEntity[]> {
return Future.fromPromise(this.getTrackedEntitiesByTEACodeAsync(filter));
}
Expand Down
3 changes: 2 additions & 1 deletion src/domain/repositories/AlertRepository.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { FutureData } from "../../data/api-futures";
import { Maybe } from "../../utils/ts-utils";
import { IncidentStatusType } from "../entities/disease-outbreak-event/DiseaseOutbreakEvent";
import { Id } from "../entities/Ref";

Expand All @@ -8,6 +9,6 @@ export interface AlertRepository {

export type AlertOptions = {
eventId: Id;
filter: { id: Id; value: string };
filter: { id: Id; value: Maybe<string> };
incidentStatus: IncidentStatusType;
};
8 changes: 4 additions & 4 deletions src/domain/usecases/MapDiseaseOutbreakToAlertsUseCase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {

type DiseaseOutbreakEventData = Pick<
DiseaseOutbreakEventBaseAttrs,
"dataSourceCode" | "hazardType" | "incidentStatus" | "suspectedDiseaseCode"
"dataSource" | "hazardType" | "incidentStatus" | "suspectedDiseaseCode"
>;

const incidentDataSourceCode = "IBS";
Expand All @@ -24,15 +24,15 @@ export class MapDiseaseOutbreakToAlertsUseCase {
diseaseOutbreakEventId: Id,
diseaseOutbreakEventData: DiseaseOutbreakEventData
): FutureData<void> {
const { dataSourceCode, hazardType, incidentStatus, suspectedDiseaseCode } =
const { dataSource, hazardType, incidentStatus, suspectedDiseaseCode } =
diseaseOutbreakEventData;
const hazardTypeCode = hazardTypeCodeMap[hazardType];
const hazardTypeCode = hazardType ? hazardTypeCodeMap[hazardType] : undefined;

if (!diseaseOutbreakEventId)
return Future.error(new Error("Disease Outbreak Event Id is required"));

const filter =
dataSourceCode === incidentDataSourceCode
dataSource === incidentDataSourceCode
? { id: RTSL_ZEBRA_ALERTS_DISEASE_TEA_ID, value: suspectedDiseaseCode }
: { id: RTSL_ZEBRA_ALERTS_EVENT_TYPE_TEA_ID, value: hazardTypeCode };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe("MapDiseaseOutbreakToAlertsUseCase", () => {

compositionRoot.diseaseOutbreakEvent.mapDiseaseOutbreakEventToAlerts
.execute("", {
dataSourceCode: "EBS",
dataSource: "EBS",
hazardType: "Biological:Human",
suspectedDiseaseCode: "",
incidentStatus: "Watch",
Expand All @@ -22,7 +22,7 @@ describe("MapDiseaseOutbreakToAlertsUseCase", () => {

compositionRoot.diseaseOutbreakEvent.mapDiseaseOutbreakEventToAlerts
.execute("123", {
dataSourceCode: "EBS",
dataSource: "EBS",
hazardType: "Biological:Human",
suspectedDiseaseCode: "",
incidentStatus: "Watch",
Expand Down

0 comments on commit 612e12a

Please sign in to comment.