@ournet/news-data
Version:
Ournet news data module
35 lines (34 loc) • 2.68 kB
TypeScript
import DynamoDB = require("aws-sdk/clients/dynamodb");
import { BaseRepository, RepositoryUpdateData, RepositoryAccessOptions } from "@ournet/domain";
import { NewsItem, NewsRepository, LatestNewsQueryParams, LatestNewsByTopicQueryParams, CountNewsQueryParams, CountNewsByTopicQueryParams, CountNewsBySourceQueryParams, LatestNewsBySourceQueryParams, Topic, TopItem, NewsSearchParams, LatestNewsByEventQueryParams, CountNewsByEventQueryParams } from "@ournet/news-domain";
import { NewsItemModel } from "./dynamo-news";
import { TopicNewsModel } from "./topic-news";
import { NewsSearcher } from "./news-searcher";
import { Locale } from "../common";
export declare class DynamoNewsRepository extends BaseRepository<NewsItem> implements NewsRepository {
protected model: NewsItemModel;
protected topicNewsModel: TopicNewsModel;
protected searcher: NewsSearcher;
constructor(client: DynamoDB.DocumentClient, esHost: string | Record<string, any>, tableSuffix: string);
viewNewsItem(id: string): Promise<number>;
innerCreate(data: NewsItem): Promise<NewsItem>;
innerUpdate(data: RepositoryUpdateData<NewsItem>): Promise<NewsItem>;
delete(id: string): Promise<boolean>;
exists(id: string): Promise<boolean>;
getById(id: string, options?: RepositoryAccessOptions<NewsItem>): Promise<NewsItem | null>;
getByIds(ids: string[], options?: RepositoryAccessOptions<NewsItem>): Promise<NewsItem[]>;
search(params: NewsSearchParams, options?: RepositoryAccessOptions<NewsItem>): Promise<NewsItem[]>;
latest(params: LatestNewsQueryParams, options?: RepositoryAccessOptions<NewsItem>): Promise<NewsItem[]>;
latestByTopic(params: LatestNewsByTopicQueryParams, options?: RepositoryAccessOptions<NewsItem>): Promise<NewsItem[]>;
latestByEvent(params: LatestNewsByEventQueryParams, options?: RepositoryAccessOptions<NewsItem>): Promise<NewsItem[]>;
latestBySource(params: LatestNewsBySourceQueryParams, options?: RepositoryAccessOptions<NewsItem>): Promise<NewsItem[]>;
count(params: CountNewsQueryParams): Promise<number>;
countByTopic(params: CountNewsByTopicQueryParams): Promise<number>;
countBySource(params: CountNewsBySourceQueryParams): Promise<number>;
countByEvent(params: CountNewsByEventQueryParams): Promise<number>;
topSourceTopics(params: LatestNewsBySourceQueryParams): Promise<TopItem[]>;
topSources(params: LatestNewsQueryParams): Promise<TopItem[]>;
protected putTopicNews(locale: Locale, newsId: string, lastFoundAt: string, topics: Topic[], expiresAt: number): Promise<void>;
deleteStorage(): Promise<void>;
createStorage(): Promise<void>;
}