Consolidates V2 codebase into main project directory Updates build script to support simplified entry points Removes redundant files and cleans up project organization Simplifies module imports and entry points for calendar application
25 lines
895 B
TypeScript
25 lines
895 B
TypeScript
import { IDepartment, EntityType, IEventBus } from '../../types/CalendarTypes';
|
|
import { DepartmentStore } from './DepartmentStore';
|
|
import { BaseEntityService } from '../BaseEntityService';
|
|
import { IndexedDBContext } from '../IndexedDBContext';
|
|
|
|
/**
|
|
* DepartmentService - CRUD operations for departments in IndexedDB
|
|
*/
|
|
export class DepartmentService extends BaseEntityService<IDepartment> {
|
|
readonly storeName = DepartmentStore.STORE_NAME;
|
|
readonly entityType: EntityType = 'Department';
|
|
|
|
constructor(context: IndexedDBContext, eventBus: IEventBus) {
|
|
super(context, eventBus);
|
|
}
|
|
|
|
/**
|
|
* Get departments by IDs
|
|
*/
|
|
async getByIds(ids: string[]): Promise<IDepartment[]> {
|
|
if (ids.length === 0) return [];
|
|
const results = await Promise.all(ids.map(id => this.get(id)));
|
|
return results.filter((d): d is IDepartment => d !== null);
|
|
}
|
|
}
|