Basic Working Product
The QueryBuilder is now being used to get data for each different class i.e. Card, Set, Type, SuperType and SubType
This commit is contained in:
@ -6,6 +6,7 @@ import { ISet } from '../interfaces/set';
|
||||
import { IType } from '../interfaces/type';
|
||||
import { IAttack } from '../interfaces/attack';
|
||||
import { QueryBuilder } from '../queryBuilder';
|
||||
import { IQuery } from '../interfaces/query';
|
||||
|
||||
export class Card implements ICard {
|
||||
id: number;
|
||||
@ -34,19 +35,28 @@ export class Card implements ICard {
|
||||
|
||||
constructor() {}
|
||||
|
||||
static resource(): string {
|
||||
resource(): string {
|
||||
return 'cards';
|
||||
}
|
||||
|
||||
find(id: string): Card {
|
||||
return QueryBuilder.find<Card>(id);
|
||||
static find(id: string): Promise<Card> {
|
||||
return QueryBuilder.find(this, id)
|
||||
.then(response => {
|
||||
return response;
|
||||
});
|
||||
}
|
||||
|
||||
all(): ICard[] {
|
||||
throw new Error("Method not implemented.");
|
||||
static all(): Promise<Card[]> {
|
||||
return QueryBuilder.all(this)
|
||||
.then(response => {
|
||||
return response;
|
||||
});
|
||||
}
|
||||
|
||||
where(args: object): ICard {
|
||||
throw new Error("Method not implemented.");
|
||||
static where(params: IQuery[]): Promise<Card[]> {
|
||||
return QueryBuilder.where(this, params)
|
||||
.then(response => {
|
||||
return response;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,6 @@
|
||||
import { ISet } from '../interfaces/set';
|
||||
import { QueryBuilder } from '../queryBuilder';
|
||||
import { IQuery } from '../interfaces/query';
|
||||
|
||||
export class Set implements ISet {
|
||||
code: string;
|
||||
@ -14,19 +16,28 @@ export class Set implements ISet {
|
||||
constructor() {}
|
||||
|
||||
resource(): string {
|
||||
return "sets";
|
||||
return 'sets';
|
||||
}
|
||||
|
||||
find(id: number): ISet {
|
||||
throw new Error("Method not implemented.");
|
||||
static find(id: string): Promise<Set> {
|
||||
return QueryBuilder.find(this, id)
|
||||
.then(response => {
|
||||
return response;
|
||||
});
|
||||
}
|
||||
|
||||
all(): ISet[] {
|
||||
throw new Error("Method not implemented.");
|
||||
static all(): Promise<Set[]> {
|
||||
return QueryBuilder.all(this)
|
||||
.then(response => {
|
||||
return response;
|
||||
});
|
||||
}
|
||||
|
||||
where(args: object): ISet {
|
||||
throw new Error("Method not implemented.");
|
||||
static where(params: IQuery[]): Promise<Set[]> {
|
||||
return QueryBuilder.where(this, params)
|
||||
.then(response => {
|
||||
return response;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,14 +1,20 @@
|
||||
import { ISubType } from '../interfaces/subType';
|
||||
import { QueryBuilder } from '../queryBuilder';
|
||||
|
||||
export class SubType implements ISubType {
|
||||
types: string[];
|
||||
|
||||
constructor() {}
|
||||
|
||||
resource(): string {
|
||||
return 'subtypes';
|
||||
}
|
||||
|
||||
all(): ISubType[] {
|
||||
throw new Error("Method not implemented.");
|
||||
static all(): Promise<SubType[]> {
|
||||
return QueryBuilder.all(this)
|
||||
.then(response => {
|
||||
return response;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,13 +1,19 @@
|
||||
import { ISuperType } from '../interfaces/superType';
|
||||
import { QueryBuilder } from '../queryBuilder';
|
||||
|
||||
export class SuperType implements ISuperType {
|
||||
types: string[];
|
||||
|
||||
constructor () {}
|
||||
|
||||
resource(): string {
|
||||
return 'supertypes';
|
||||
}
|
||||
|
||||
all(): ISuperType[] {
|
||||
throw new Error("Method not implemented.");
|
||||
static all(): Promise<SuperType[]> {
|
||||
return QueryBuilder.all(this)
|
||||
.then(response => {
|
||||
return response;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user