Skip to content

Commit

Permalink
docs: basic docs for repository methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Tschonti committed Nov 2, 2024
1 parent 78f7555 commit 89ff6c3
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/domain/repositories/AlertRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ import { Conflict } from '../entities/alerts/Conflict';
import { Hazard } from '../entities/alerts/Hazard';

export interface AlertRepository {
/**
* Returns all the hazards (flooding, forest fire, etc.) in the world
*/
getHazardData(): Promise<Hazard[]>;

/**
* Returns all the conflicts (battles, riots, etc.) in the world
*/
getConflictData(): Promise<Conflict[]>;
}
24 changes: 24 additions & 0 deletions src/domain/repositories/CountryRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,35 @@ import { CountryMimiData } from '../entities/country/CountryMimiData';
import { RegionIpc } from '../entities/region/RegionIpc';

export default interface CountryRepository {
/**
* Returns the ID and ISO codes of all the countries, plus a summary report for each.
*/
getCountryCodes(): Promise<CountryCodesData[]>;

/**
* Returns the population, FCS and RCS data and news about a country
* @param countryId
*/
getCountryData(countryId: number): Promise<CountryData>;

/**
* Returns all the regions of a country and their FCS & RCS data
* @param countryId
*/
getRegionData(countryId: number): Promise<AdditionalCountryData>;

/**
* Returns nutrition, currency exchange, balance of trade and inflation data about a country
* @param countryCode
*/
getCountryIso3Data(countryCode: string): Promise<CountryIso3Data>;

getCountryIso3Notes(countryCode: string): Promise<CountryIso3Notes>; // probably unused
getRegionNutritionData(countryId: number): Promise<CountryMimiData>; // probably unused

/**
* Returns the IPC data for each region of the country
* @param countryId
*/
getRegionIpcData(countryId: number): Promise<RegionIpc>;
}
19 changes: 19 additions & 0 deletions src/domain/repositories/GlobalDataRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,28 @@ import { DisputedAreas } from '../entities/DisputedAreas';
import { YearInReview } from '../entities/YearInReview';

export interface GlobalDataRepository {
/**
* Returns the national IPC data of all the countries
*/
getIpcData(): Promise<CountryIpcData[]>;

/**
* Not sure what this returns :/
*/
getAdm0Data(): Promise<Adm0Data[]>;

/**
* Returns all the disputed areas around the world
*/
getDisputedAreas(): Promise<DisputedAreas>;

/**
* Returns the change log of the WFP HungerMap
*/
getChangeLog(): Promise<ChangeLogItem[]>;

/**
* Return the Year in Review reports of the WFP HungerMap
*/
getYearInReviews(): Promise<YearInReview[]>;
}

0 comments on commit 89ff6c3

Please sign in to comment.