import { DataSource } from 'typeorm'; import { Card } from '../persistance/entity/Card'; import { CardSet } from '../persistance/entity/CardSet'; /** * CardService performs all Card and CardSet related tasks, namely database retrieval */ declare class CardService { private dataSource; static readonly IMAGE_DIR: string; private cardRepo; private cardSetRepo; constructor(dataSource: DataSource); /** * Retrieve all the Cards from every CardSet * @returns All Cards from every CardSet */ getAllCards(): Promise; /** * Retrieve a Card by its id * @param cardId the card id * @returns The card associated to the id, or null if none exists */ getCardById(cardId: string): Promise; /** * Given a list of cardIds, get a card for each. * @param cardIds A list of card ids * @returns A list of cards that match each valid card id in the cardIds list */ getCardsByIds(cardIds: string[]): Promise; /** * Given a valid cardId, return the cards image file path. For each card there is both a full size and a small sized image available * @param cardId The id of the card whose image is to be retrieved * @param getSmallSize A flag indicating if the small version of the image should be returned * @returns The full image filepath if the cardId was valid, otherwise return null */ getCardImagePath(cardId: string, getSmallSize?: boolean): string | null; /** * Retrieve a CardSet by its set number * @param setNum The set number to be retrieved * @param excludeCards Flag indicating if the list of Cards associated with the CardSet should be included in the response * @returns The CardSet with the matching set number, or null if there was no matching CardSet */ getCardSetByNumber(setNum: number, excludeCards: boolean): Promise; /** * Retrieve a card using a set number, and the cards number (position) within that set * @param setNum The set number matching the CardSet that contains the desired card * @param cardNumInSet The card number (position) within the CardSet to be retrieved * @returns The indicated Card from within the CardSet */ getCardByNumberInCardSet(setNum: number, cardNumInSet: number): Promise; /** * Repopulate both the 'card' and 'card_set' tables by parsing the CSV files located in '/res/csv_source' */ populateCardDatabase(): Promise; /** * For a given cardId, return the set number it belongs to. * A Card's id field is a composite key which includes the set number. * @param cardId The id of the card to get the set number from * @returns The set number to which the card belongs */ private static getSetNumberFromCardId; /** * For a given valid set number, return the set's name. * Note: the name returned is the internal name and is not the display name * @param setNum The set number of the CardSet to get the name of * @returns The name of the CardSet whose set number matches setNum */ private static getCardSetName; /** * Parse a CSV file of card data into a list of Card objects * @param csvDir The path of the directory where the target CSV file is located * @param csvFilename The name of the target CSV file * @returns A list of Card objects */ private parseCardsCSV; } export declare const cardService: CardService; export {};