Make force rarity configurable
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
1a4d4b4e23
commit
ada907e2a4
7 changed files with 31 additions and 2 deletions
|
@ -2,6 +2,7 @@ import { Column, Entity, ManyToOne } from "typeorm";
|
|||
import CardBaseEntity from "../../../contracts/CardBaseEntity";
|
||||
import { CardRarity } from "../../../constants/CardRarity";
|
||||
import Series from "./Series";
|
||||
import CardDataSource from "../../dataSources/cardDataSource";
|
||||
|
||||
@Entity()
|
||||
export default class Card extends CardBaseEntity {
|
||||
|
@ -33,4 +34,12 @@ export default class Card extends CardBaseEntity {
|
|||
|
||||
@ManyToOne(() => Series, x => x.Cards)
|
||||
Series: Series;
|
||||
|
||||
public static async FetchAllByRarity(rarity: CardRarity, relations?: string[]): Promise<Card[]> {
|
||||
const repository = CardDataSource.getRepository(Card);
|
||||
|
||||
const all = await repository.find({ where: { Rarity: rarity }, relations: relations || [] });
|
||||
|
||||
return all;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue