mirror of
https://github.com/tcgdex/cards-database.git
synced 2025-08-16 09:08:52 +00:00
Compare commits
2 Commits
v2.15.3
...
decks-supp
Author | SHA1 | Date | |
---|---|---|---|
4908aeed8a | |||
2d427e7ddf |
14
data/Base/Base Set 2/Decks/Grass Chopper.ts
Normal file
14
data/Base/Base Set 2/Decks/Grass Chopper.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { Deck } from "../../../../interfaces"
|
||||||
|
import Set from "../../Base Set 2"
|
||||||
|
|
||||||
|
const deck: Deck = {
|
||||||
|
id: "td.base4.gc",
|
||||||
|
name: {
|
||||||
|
en: "Grass Chopper"
|
||||||
|
},
|
||||||
|
set: Set,
|
||||||
|
typesFocus: ["Fighting", "Grass"],
|
||||||
|
cards: []
|
||||||
|
}
|
||||||
|
|
||||||
|
export default deck
|
14
data/Base/Base Set 2/Decks/Hot Water.ts
Normal file
14
data/Base/Base Set 2/Decks/Hot Water.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { Deck } from "../../../../interfaces"
|
||||||
|
import Set from "../../Base Set 2"
|
||||||
|
|
||||||
|
const deck: Deck = {
|
||||||
|
id: "td.base4.hw",
|
||||||
|
name: {
|
||||||
|
en: "Hot Water"
|
||||||
|
},
|
||||||
|
set: Set,
|
||||||
|
typesFocus: ["Fire", "Water"],
|
||||||
|
cards: []
|
||||||
|
}
|
||||||
|
|
||||||
|
export default deck
|
14
data/Base/Base Set 2/Decks/Lightning Bug.ts
Normal file
14
data/Base/Base Set 2/Decks/Lightning Bug.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { Deck } from "../../../../interfaces"
|
||||||
|
import Set from "../../Base Set 2"
|
||||||
|
|
||||||
|
const deck: Deck = {
|
||||||
|
id: "td.base4.lg",
|
||||||
|
name: {
|
||||||
|
en: "Lightning Bug"
|
||||||
|
},
|
||||||
|
set: Set,
|
||||||
|
typesFocus: ["Lightning", "Grass"],
|
||||||
|
cards: []
|
||||||
|
}
|
||||||
|
|
||||||
|
export default deck
|
14
data/Base/Base Set 2/Decks/Psych Out.ts
Normal file
14
data/Base/Base Set 2/Decks/Psych Out.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { Deck } from "../../../../interfaces"
|
||||||
|
import Set from "../../Base Set 2"
|
||||||
|
|
||||||
|
const deck: Deck = {
|
||||||
|
id: "td.base4.po",
|
||||||
|
name: {
|
||||||
|
en: "Psych Out"
|
||||||
|
},
|
||||||
|
set: Set,
|
||||||
|
typesFocus: ["Psychic", "Water"],
|
||||||
|
cards: []
|
||||||
|
}
|
||||||
|
|
||||||
|
export default deck
|
14
data/Base/Base Set/decks/Blackout.ts
Normal file
14
data/Base/Base Set/decks/Blackout.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { Deck } from "../../../../interfaces"
|
||||||
|
import Set from "../../Base Set"
|
||||||
|
|
||||||
|
const deck: Deck = {
|
||||||
|
id: "td.base1.bl",
|
||||||
|
name: {
|
||||||
|
en: "Blackout"
|
||||||
|
},
|
||||||
|
set: Set,
|
||||||
|
typesFocus: ["Water", "Fighting"],
|
||||||
|
cards: []
|
||||||
|
}
|
||||||
|
|
||||||
|
export default deck
|
14
data/Base/Base Set/decks/Brushfire.ts
Normal file
14
data/Base/Base Set/decks/Brushfire.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { Deck } from "../../../../interfaces"
|
||||||
|
import Set from "../../Base Set"
|
||||||
|
|
||||||
|
const deck: Deck = {
|
||||||
|
id: "td.base1.br",
|
||||||
|
name: {
|
||||||
|
en: "Brushfire"
|
||||||
|
},
|
||||||
|
set: Set,
|
||||||
|
typesFocus: ["Fire", "Grass"],
|
||||||
|
cards: []
|
||||||
|
}
|
||||||
|
|
||||||
|
export default deck
|
14
data/Base/Base Set/decks/Overgrowth.ts
Normal file
14
data/Base/Base Set/decks/Overgrowth.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { Deck } from "../../../../interfaces"
|
||||||
|
import Set from "../../Base Set"
|
||||||
|
|
||||||
|
const deck: Deck = {
|
||||||
|
id: "td.base1.ov",
|
||||||
|
name: {
|
||||||
|
en: "Overgrowth"
|
||||||
|
},
|
||||||
|
set: Set,
|
||||||
|
typesFocus: ["Water", "Grass"],
|
||||||
|
cards: []
|
||||||
|
}
|
||||||
|
|
||||||
|
export default deck
|
14
data/Base/Base Set/decks/Zap!.ts
Normal file
14
data/Base/Base Set/decks/Zap!.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { Deck } from "../../../../interfaces"
|
||||||
|
import Set from "../../Base Set"
|
||||||
|
|
||||||
|
const deck: Deck = {
|
||||||
|
id: "td.base1.za",
|
||||||
|
name: {
|
||||||
|
en: "Zap!"
|
||||||
|
},
|
||||||
|
set: Set,
|
||||||
|
typesFocus: ["Lightning", "Psychic"],
|
||||||
|
cards: []
|
||||||
|
}
|
||||||
|
|
||||||
|
export default deck
|
14
data/Base/Fossil/Decks/BodyGuard.ts
Normal file
14
data/Base/Fossil/Decks/BodyGuard.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { Deck } from "../../../../interfaces"
|
||||||
|
import Set from "../../Fossil"
|
||||||
|
|
||||||
|
const deck: Deck = {
|
||||||
|
id: "td.base1.bd",
|
||||||
|
name: {
|
||||||
|
en: "BodyGuard"
|
||||||
|
},
|
||||||
|
set: Set,
|
||||||
|
typesFocus: ["Grass", "Fighting"],
|
||||||
|
cards: []
|
||||||
|
}
|
||||||
|
|
||||||
|
export default deck
|
14
data/Base/Fossil/Decks/LockDown.ts
Normal file
14
data/Base/Fossil/Decks/LockDown.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { Deck } from "../../../../interfaces"
|
||||||
|
import Set from "../../Base Set"
|
||||||
|
|
||||||
|
const deck: Deck = {
|
||||||
|
id: "td.base1.ld",
|
||||||
|
name: {
|
||||||
|
en: "LockDown"
|
||||||
|
},
|
||||||
|
set: Set,
|
||||||
|
typesFocus: ["Fire", "Water"],
|
||||||
|
cards: []
|
||||||
|
}
|
||||||
|
|
||||||
|
export default deck
|
14
data/Base/Jungle/decks/Power Reserve.ts
Normal file
14
data/Base/Jungle/decks/Power Reserve.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { Deck } from "../../../../interfaces"
|
||||||
|
import Set from "../../Jungle"
|
||||||
|
|
||||||
|
const deck: Deck = {
|
||||||
|
id: "td.base2.pr",
|
||||||
|
name: {
|
||||||
|
en: "Power Reserve"
|
||||||
|
},
|
||||||
|
set: Set,
|
||||||
|
typesFocus: ["Psychic", "Grass"],
|
||||||
|
cards: []
|
||||||
|
}
|
||||||
|
|
||||||
|
export default deck
|
14
data/Base/Jungle/decks/Water Blast.ts
Normal file
14
data/Base/Jungle/decks/Water Blast.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { Deck } from "../../../../interfaces"
|
||||||
|
import Set from "../../Jungle"
|
||||||
|
|
||||||
|
const deck: Deck = {
|
||||||
|
id: "td.base2.wb",
|
||||||
|
name: {
|
||||||
|
en: "Water Blast"
|
||||||
|
},
|
||||||
|
set: Set,
|
||||||
|
typesFocus: ["Water", "Fighting"],
|
||||||
|
cards: []
|
||||||
|
}
|
||||||
|
|
||||||
|
export default deck
|
14
data/Base/Team Rocket/decks/Devastation.ts
Normal file
14
data/Base/Team Rocket/decks/Devastation.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { Deck } from "../../../../interfaces"
|
||||||
|
import Set from "../../Team Rocket"
|
||||||
|
|
||||||
|
const deck: Deck = {
|
||||||
|
id: "td.base4.de",
|
||||||
|
name: {
|
||||||
|
en: "Devastation"
|
||||||
|
},
|
||||||
|
set: Set,
|
||||||
|
typesFocus: ["Grass", "Water"],
|
||||||
|
cards: []
|
||||||
|
}
|
||||||
|
|
||||||
|
export default deck
|
14
data/Base/Team Rocket/decks/Grass Chopper.ts
Normal file
14
data/Base/Team Rocket/decks/Grass Chopper.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { Deck } from "../../../../interfaces"
|
||||||
|
import Set from "../../Team Rocket"
|
||||||
|
|
||||||
|
const deck: Deck = {
|
||||||
|
id: "td.base4.to",
|
||||||
|
name: {
|
||||||
|
en: "Trouble"
|
||||||
|
},
|
||||||
|
set: Set,
|
||||||
|
typesFocus: ["Psychic", "Grass"],
|
||||||
|
cards: []
|
||||||
|
}
|
||||||
|
|
||||||
|
export default deck
|
40
data/Black & White/Noble Victories/Decks/Fast Daze.ts
Normal file
40
data/Black & White/Noble Victories/Decks/Fast Daze.ts
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import { Deck } from '../../../../interfaces'
|
||||||
|
import Set from "../../Noble Victories"
|
||||||
|
|
||||||
|
const deck: Deck = {
|
||||||
|
id: 'td.bw3.fd',
|
||||||
|
name: {
|
||||||
|
en: 'Fast Daze'
|
||||||
|
},
|
||||||
|
set: Set,
|
||||||
|
typesFocus: ['Fire', 'Grass'],
|
||||||
|
cards: [
|
||||||
|
{ id: 'bw3-12', variant: 'holo' },
|
||||||
|
'bw3-12',
|
||||||
|
{ id: 'bw3-11', quantity: 4 },
|
||||||
|
'bw3-3',
|
||||||
|
{ id: 'bw3-2', quantity: 2 },
|
||||||
|
{ id: 'bw3-1', quantity: 3 },
|
||||||
|
'bw3-5',
|
||||||
|
{ id: 'bw3-4', quantity: 2 },
|
||||||
|
{ id: 'bw3-7', quantity: 2 },
|
||||||
|
{ id: 'bw3-6', quantity: 2 },
|
||||||
|
{ id: 'bw3-9', quantity: 3 },
|
||||||
|
'bw3-21',
|
||||||
|
{ id: 'bw3-21', quantity: 2 },
|
||||||
|
{ id: 'bw3-17', quantity: 2 },
|
||||||
|
{ id: 'bw3-16', quantity: 2 },
|
||||||
|
{ id: 'bw3-7', quantity: 2 },
|
||||||
|
{ id: 'bw1-93', quantity: 2 },
|
||||||
|
{ id: 'bw1-100', quantity: 2 },
|
||||||
|
{ id: 'bw2-91', quantity: 2 },
|
||||||
|
{ id: 'bw2-91', quantity: 2 },
|
||||||
|
'bw3-92',
|
||||||
|
{ id: 'bw1-99', quantity: 2 },
|
||||||
|
{ id: 'bw3-95', quantity: 2 },
|
||||||
|
{ id: 'bw1-105', quantity: 12 },
|
||||||
|
{ id: 'bw1-106', quantity: 6 }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
export default deck
|
21
interfaces.d.ts
vendored
21
interfaces.d.ts
vendored
@@ -314,3 +314,24 @@ export interface Filter {
|
|||||||
cards: Array<string>
|
cards: Array<string>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface Deck {
|
||||||
|
id: `td.${string}.${string}`
|
||||||
|
set: Set
|
||||||
|
name: Languages
|
||||||
|
typesFocus: Array<Types>
|
||||||
|
cards: Array<{
|
||||||
|
/**
|
||||||
|
* Card Global ID
|
||||||
|
*/
|
||||||
|
id: string
|
||||||
|
/**
|
||||||
|
* Card quantity in the deck
|
||||||
|
*/
|
||||||
|
quantity?: number
|
||||||
|
/**
|
||||||
|
* Card variant
|
||||||
|
*/
|
||||||
|
variant?: keyof Omit<variants, 'normal' | 'firstEdition'>
|
||||||
|
} | string>
|
||||||
|
}
|
||||||
|
@@ -51,13 +51,6 @@ server.use((req, res, next) => {
|
|||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle options requests
|
|
||||||
*/
|
|
||||||
server.options('/*', (_, res) => {
|
|
||||||
res.status(200).send()
|
|
||||||
})
|
|
||||||
|
|
||||||
server.get('/', (_, res) => {
|
server.get('/', (_, res) => {
|
||||||
res.redirect('https://www.tcgdex.dev/?ref=api.tccgdex.net')
|
res.redirect('https://www.tcgdex.dev/?ref=api.tccgdex.net')
|
||||||
})
|
})
|
||||||
|
@@ -63,13 +63,12 @@ export function betterSorter(a: string, b: string) {
|
|||||||
*/
|
*/
|
||||||
export function validateItem(validator: any | Array<any>, value: any): boolean {
|
export function validateItem(validator: any | Array<any>, value: any): boolean {
|
||||||
if (typeof value === 'object') {
|
if (typeof value === 'object') {
|
||||||
// invert signal so that an early exit mean that a match was found!
|
return objectLoop(value, (v) => {
|
||||||
return !objectLoop(value, (v) => {
|
|
||||||
// early exit to not infinitively loop through objects
|
// early exit to not infinitively loop through objects
|
||||||
if (typeof v === 'object') return true
|
if (typeof v === 'object') return true
|
||||||
|
|
||||||
// check for each childs until one match
|
// check for each childs
|
||||||
return !validateItem(validator, v)
|
return validateItem(validator, v)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,14 +104,10 @@ export function validateItem(validator: any | Array<any>, value: any): boolean {
|
|||||||
* @returns the sorted data
|
* @returns the sorted data
|
||||||
*/
|
*/
|
||||||
export function handleSort(data: Array<any>, query: Query<any>) {
|
export function handleSort(data: Array<any>, query: Query<any>) {
|
||||||
// handle when data has no entries
|
const sort: Query<any>['sort'] = query.sort ?? {field: 'id', order: 'ASC'}
|
||||||
if (data.length === 0) {
|
|
||||||
return data
|
|
||||||
}
|
|
||||||
const firstEntry = data[0]
|
|
||||||
const sort: Query<any>['sort'] = query.sort ?? {field: 'releaseDate' in firstEntry ? 'releaseDate' : 'id', order: 'ASC'}
|
|
||||||
const field = sort.field
|
const field = sort.field
|
||||||
const order = sort.order ?? 'ASC'
|
const order = sort.order ?? 'ASC'
|
||||||
|
const firstEntry = data[0]
|
||||||
|
|
||||||
// early exit if the order is not correctly set
|
// early exit if the order is not correctly set
|
||||||
if (order !== 'ASC' && order !== 'DESC') {
|
if (order !== 'ASC' && order !== 'DESC') {
|
||||||
@@ -147,7 +142,7 @@ export function handleSort(data: Array<any>, query: Query<any>) {
|
|||||||
* @returns the data that is in the paginated query
|
* @returns the data that is in the paginated query
|
||||||
*/
|
*/
|
||||||
export function handlePagination(data: Array<any>, query: Query<any>) {
|
export function handlePagination(data: Array<any>, query: Query<any>) {
|
||||||
if (!query.pagination || data.length === 0) {
|
if (!query.pagination) {
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
const itemsPerPage = query.pagination.itemsPerPage ?? 100
|
const itemsPerPage = query.pagination.itemsPerPage ?? 100
|
||||||
|
Reference in New Issue
Block a user