1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-06-15 08:59:18 +00:00

feat: Add status Dashboard (#187)

* feat: Add status Dashboard

Still need some polishing like using the compiler instead of the live DB

Signed-off-by: Avior <github@avior.me>

* refactor: Simplified compiler files generators

Signed-off-by: Avior <florian.bouillon@delta-wings.net>

* chore: Add step to compiler for stats and optimize

Signed-off-by: Avior <github@avior.me>

* refactor: Remove unused variable

Signed-off-by: Avior <github@avior.me>
This commit is contained in:
2021-11-23 15:12:50 +00:00
committed by GitHub
parent 8ef099273e
commit 762ce389c1
18 changed files with 431 additions and 142 deletions

View File

@ -54,7 +54,8 @@ export async function cardToCardSingle(localId: string, card: Card, lang: Suppor
firstEdition: typeof card.variants?.firstEdition === 'boolean' ? card.variants.firstEdition : false,
holo: typeof card.variants?.holo === 'boolean' ? card.variants.holo : true,
normal: typeof card.variants?.normal === 'boolean' ? card.variants.normal : true,
reverse: typeof card.variants?.reverse === 'boolean' ? card.variants.reverse : true
reverse: typeof card.variants?.reverse === 'boolean' ? card.variants.reverse : true,
wPromo: typeof card.variants?.wPromo === 'boolean' ? card.variants.wPromo : false
},
@ -120,6 +121,12 @@ export async function getCard(serie: string, setName: string, id: string): Promi
return (await import(`../../${DB_PATH}/data/${serie}/${setName}/${id}.js`)).default
}
/**
* Get cards filtered by the language they are available in
* @param lang the language of the cards
* @param set the set to filter in (optional)
* @returns An array with the 0 = localId, 1 = Card Object
*/
export async function getCards(lang: SupportedLanguages, set?: Set): Promise<Array<[string, Card]>> {
const cards = await smartGlob(`${DB_PATH}/data/${(set && set.serie.name.en) ?? '*'}/${(set && set.name.en) ?? '*'}/*.js`)
const list: Array<[string, Card]> = []