41 lines
983 B
TypeScript
41 lines
983 B
TypeScript
|
|
import { IGroupingStore } from '../core/IGroupingStore';
|
||
|
|
|
||
|
|
export interface Team {
|
||
|
|
id: string;
|
||
|
|
name: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface Resource {
|
||
|
|
id: string;
|
||
|
|
name: string;
|
||
|
|
teamId: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export class MockTeamStore implements IGroupingStore<Team> {
|
||
|
|
readonly type = 'team';
|
||
|
|
|
||
|
|
private teams: Team[] = [
|
||
|
|
{ id: 'alpha', name: 'Team Alpha' },
|
||
|
|
{ id: 'beta', name: 'Team Beta' }
|
||
|
|
];
|
||
|
|
|
||
|
|
getByIds(ids: string[]): Team[] {
|
||
|
|
return this.teams.filter(t => ids.includes(t.id));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export class MockResourceStore implements IGroupingStore<Resource> {
|
||
|
|
readonly type = 'resource';
|
||
|
|
|
||
|
|
private resources: Resource[] = [
|
||
|
|
{ id: 'alice', name: 'Alice', teamId: 'alpha' },
|
||
|
|
{ id: 'bob', name: 'Bob', teamId: 'alpha' },
|
||
|
|
{ id: 'carol', name: 'Carol', teamId: 'beta' },
|
||
|
|
{ id: 'dave', name: 'Dave', teamId: 'beta' }
|
||
|
|
];
|
||
|
|
|
||
|
|
getByIds(ids: string[]): Resource[] {
|
||
|
|
return this.resources.filter(r => ids.includes(r.id));
|
||
|
|
}
|
||
|
|
}
|