You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to add filters for searching cards based on sets. I am wondering which approach is better so I'd love some input.
Approach 1:
# Filters to be used with the Card queryinputCardsFilters {
# ...setId: StringsetName: String # other set properties
}
and then in Cards.ts:
publicstaticfind(lang: SupportedLanguages,params: Partial<Record<keyofSDKCard,any>>={},pagination?: Pagination){// .....filter((c)=>{returnobjectLoop(params,(it,key)=>{if(key=='setId'){returnc.set.id===it;// new line, same for all other set properties}returnlightCheck(c[keyas'localId'],it)});})// ....}
Approach 2:
# Filters to be used with the Card queryinputCardsFilters {
# ... set: CardsFiltersSet
}
inputCardsFiltersSet {
id: Stringname: StringtcgOnline: StringreleaseDate: Stringsymbol: String
}
and then in Cards.ts:
publicstaticfind(lang: SupportedLanguages,params: Partial<Record<keyofSDKCard,any>>={},pagination?: Pagination){// ....filter((c)=>{returnobjectLoop(params,(it,key)=>{// vvvv new code starts here vvvvif(key==='set'){returnobjectLoop(it,(nestedIt,nestedKey)=>{returnlightCheck(c[keyas'set'][nestedKeyas'id'|'name'],nestedIt);})}// ^^^ new code starts here ^^^});})// ...}
I have no idea why everything in the code snippets (ts) is so indented...
The text was updated successfully, but these errors were encountered:
Hey, I did some edits to implement new features set for the server, I also made some more place to simplify filtering, it should be easier to implement now, let me know if you need anything !
Data affected
Please explain in more details what idea you have
Hi,
I want to add filters for searching cards based on sets. I am wondering which approach is better so I'd love some input.
Approach 1:
and then in
Cards.ts
:Approach 2:
and then in
Cards.ts
:I have no idea why everything in the code snippets (ts) is so indented...
The text was updated successfully, but these errors were encountered: