mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
Introduce a shared database schema library for Drizzle ORM and configure its TypeScript build settings. Move the canonical schema into libs/shared/database/src/lib/schema.ts and expose strong typing and table definitions for playlists, categories, content, recently_viewed and favorites. Add tsconfig.lib.json to set outDir, declaration output and node types for the shared lib. Keep apps/electron-backend compatibility by re-exporting the schema and types from the new shared library (apps/electron-backend now imports the shared definitions rather than duplicating them). These changes centralize the database schema as a single source of truth, prevent duplication, and enable read-only consumers (e.g. agent-backend) to depend on compiled type declarations.
Database
Shared database library for IPTVnator providing Drizzle ORM schema and connection utilities.
Usage
// Full access (electron-backend)
import { getDatabase, initDatabase } from 'database';
// Read-only access (agent-backend)
import { getReadOnlyDatabase } from 'database';
// Schema and types
import { content, categories, playlists, type Content } from 'database';
Exports
Schema (schema.ts)
- Tables:
playlists,categories,content,recentlyViewed,favorites - Types:
Playlist,Category,Content,RecentlyViewed,Favorite(andNew*variants)
Connection (connection.ts)
getDatabase(options?)- Full read-write accessgetReadOnlyDatabase()- Read-only access for agent queriesinitDatabase(options?)- Initialize with custom optionscloseDatabase()- Close connectiongetDatabasePath()- Get database file path
Database Location
The SQLite database is stored at: ~/.iptvnator/databases/iptvnator.db