import { CourseConfig, CourseElo, DataShape, SkuilderCourseData } from '@vue-skuilder/common'; import { StudyContentSource, StudySessionItem } from './contentSource'; import { TagStub, Tag, QualifiedCardID } from '../types/types-legacy'; import { DataLayerResult } from '../types/db'; import { NavigationStrategyManager } from './navigationStrategyManager'; /** * Course content and management */ export interface CoursesDBInterface { /** * Get course config */ getCourseConfig(courseId: string): Promise; /** * Get a list of all courses */ getCourseList(): Promise; disambiguateCourse(courseId: string, disambiguator: string): Promise; } export interface CourseInfo { cardCount: number; registeredUsers: number; } export interface CourseDBInterface extends NavigationStrategyManager, StudyContentSource { /** * Get course config */ getCourseConfig(): Promise; getCourseID(): string; /** * Set course config */ updateCourseConfig(cfg: CourseConfig): Promise; getCourseInfo(): Promise; getCourseDoc( id: string, options?: PouchDB.Core.GetOptions ): Promise; getCourseDocs( ids: string[], options?: PouchDB.Core.AllDocsOptions ): Promise>; /** * Get cards sorted by ELO rating */ getCardsByELO( elo: number, limit?: number ): Promise< { courseID: string; cardID: string; elo?: number; }[] >; /** * Get ELO data for specific cards */ getCardEloData(cardIds: string[]): Promise; /** * Update card ELO rating */ updateCardElo(cardId: string, elo: CourseElo): Promise; /** * Get cards centered at a particular ELO rating */ getCardsCenteredAtELO( options: { limit: number; elo: 'user' | 'random' | number }, filter?: (card: QualifiedCardID) => boolean ): Promise; /** * Get tags for a card */ getAppliedTags(cardId: string): Promise>; /** * Get tags for multiple cards in a single batch query. * More efficient than calling getAppliedTags() for each card. * * This method reduces redundant database operations when multiple filters * need tag data for the same cards. The Pipeline uses this to pre-hydrate * tags on WeightedCard objects before filters run. * * @param cardIds - Array of card IDs to fetch tags for * @returns Map from cardId to array of tag names */ getAppliedTagsBatch(cardIds: string[]): Promise>; /** * Get all card IDs in the course. * Used by diagnostics to scan the full card space. */ getAllCardIds(): Promise; /** * Add a tag to a card */ addTagToCard(cardId: string, tagId: string, updateELO?: boolean): Promise; /** * Remove a tag from a card */ removeTagFromCard(cardId: string, tagId: string): Promise; /** * Create a new tag */ createTag(tagName: string, author: string): Promise; /** * Get a tag by name */ getTag(tagName: string): Promise; /** * Update a tag */ updateTag(tag: Tag): Promise; /** * Get all tag stubs for a course */ getCourseTagStubs(): Promise>; /** * Add a note to the course */ addNote( codeCourse: string, shape: DataShape, data: unknown, author: string, tags: string[], uploads?: { [key: string]: PouchDB.Core.FullAttachment }, elo?: CourseElo ): Promise; removeCard(cardId: string): Promise; getInexperiencedCards(): Promise< { courseId: string; cardId: string; count: number; elo: CourseElo; }[] >; /** * Search for cards by text content * @param query Text to search for * @returns Array of matching card data */ searchCards(query: string): Promise; /** * Find documents using PouchDB query syntax * @param request PouchDB find request * @returns Query response */ find(request: PouchDB.Find.FindRequest): Promise>; }