@lovebowls/leagueelements
Version:
League Elements package for LoveBowls
36 lines (32 loc) • 1.39 kB
text/typescript
import { LeagueElement, LeagueElementConfig } from '../types';
/**
* Base class for all league elements
*/
export class BaseLeagueElement implements LeagueElement {
public readonly id: string;
public readonly type: string;
public readonly createdAt: Date;
public updatedAt: Date;
constructor(config: LeagueElementConfig) {
this.id = config.id ?? crypto.randomUUID();
this.type = config.type;
this.createdAt = new Date();
this.updatedAt = new Date();
}
/**
* Updates the element's data
* @param data - The data to update
*/
public update(data: Partial<LeagueElementConfig>): void {
Object.assign(this, data);
this.updatedAt = new Date();
}
}
export { default as LeagueMatch } from './leagueMatch/leagueMatch.js';
export { default as LeagueAdminElement } from './leagueAdminElement/leagueAdminElement.js';
export { default as LeagueElement } from './leagueElement/leagueElement.js';
export { default as LeagueMatchesAttention } from './LeagueMatchesAttention/LeagueMatchesAttention.js';
export { default as LeagueMatchesRecent } from './LeagueMatchesRecent/LeagueMatchesRecent.js';
export { default as LeagueMatchesUpcoming } from './LeagueMatchesUpcoming/LeagueMatchesUpcoming.js';
export { default as LeagueSchedule } from './LeagueSchedule/LeagueSchedule.js';
export { default as LeagueTeams } from './leagueTeams/leagueTeams.js';