feat(cardav): create cardav router with GET /accounts

Add CardDAV API router with GET /accounts endpoint. Returns all
CardDAV accounts from database via cardav-sync service. Added test
infrastructure with _setTestDatabase helper for isolated API testing.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Ulas Kalayci
2026-05-04 16:47:24 +02:00
parent a71547562e
commit cf68bff25f
3 changed files with 114 additions and 1 deletions
+9 -1
View File
@@ -1354,6 +1354,14 @@ function transaction(fn) {
return get().transaction(fn)();
}
/**
* ONLY FOR TESTING: Override the internal db instance
* @param {import('better-sqlite3').Database} testDb
*/
function _setTestDatabase(testDb) {
db = testDb;
}
init(); // auto-initialise when module is first imported
export { init, get, transaction, currentVersion, getPath, backupToFile, restoreFromFile, MIGRATIONS };
export { init, get, transaction, currentVersion, getPath, backupToFile, restoreFromFile, MIGRATIONS, _setTestDatabase };