- Implemented `getAppConfig` and `upsertAppConfig` functions in `config.ts` for managing application settings in the database. - Updated `mod.ts` to export the new configuration functions. - Refactored `ComicConfig.ts` to load and update comic watch paths using the new configuration functions. - Modified `comic_watcher.ts` to accept paths as parameters for creating watchers. - Created a new settings router in `settings.ts` for managing application settings via HTTP requests. - Integrated the settings router into the main server in `server.ts`. - Updated the settings management to use the new database-backed configuration. - Removed legacy configuration management code from `configRW.ts`. - Added integration tests for the settings router and error handling. - Updated `vitest` configuration for testing. - Cleaned up unused type definitions in `pnpm-lock.yaml`.
		
			
				
	
	
		
			22 lines
		
	
	
	
		
			646 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
	
		
			646 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { Kysely } from "kysely";
 | 
						|
 | 
						|
const CONFIG_TABLE = "app_config";
 | 
						|
const SCHEMA_VERSION = "2025-09-30";
 | 
						|
 | 
						|
export async function up(db: Kysely<any>) {
 | 
						|
    await db.schema
 | 
						|
        .createTable(CONFIG_TABLE)
 | 
						|
        .ifNotExists()
 | 
						|
        .addColumn("key", "varchar", (col) => col.notNull().primaryKey())
 | 
						|
        .addColumn("value", "text", (col) => col.notNull())
 | 
						|
        .execute();
 | 
						|
 | 
						|
    await db
 | 
						|
        .updateTable("schema_migration")
 | 
						|
        .set({ version: SCHEMA_VERSION, dirty: 0 })
 | 
						|
        .execute();
 | 
						|
}
 | 
						|
 | 
						|
export async function down(_db: Kysely<any>) {
 | 
						|
    throw new Error("Downward migrations are not supported. Restore from backup.");
 | 
						|
}
 |