Commit Graph

782 Commits

Author SHA1 Message Date
Ulas Kalayci 8f78ed6fa2 fix: Isolate Contact Merge Logic tests via suite-level before hook
All 4 previously interdependent tests now use shared aliceContact from
before() hook. 54/54 tests passing with full isolation.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 12:32:15 +02:00
Ulas Kalayci 8b8ac083a5 docs: Clarify REPLACEMENT semantics for PUT /contacts/:id multi-values
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 12:29:29 +02:00
Ulas Kalayci bb961a417c docs: Add CardDAV API Routes implementation design
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 12:28:17 +02:00
Ulas Kalayci 7bdf88f94c docs: add progress tracker for CardDAV implementation
Task #1 completed, Task #2 needs 4 test interdependency fixes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 12:08:38 +02:00
Ulas Kalayci a38c2c84fd Fix test interdependencies and remove duplicate test suite in test-carddav.js
- Make all tests independent by creating their own test data
- Remove duplicate Account Management Operations suite (lines 744-801)
- Each test now creates its own accounts instead of relying on previous tests
- Fix unique constraint violations by using distinct account URLs
- All 54 tests now pass independently

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 12:02:42 +02:00
Ulas Kalayci 96b4f43aff test: add comprehensive account and addressbook management tests
Add test coverage for CardDAV account management, addressbook discovery UPSERT logic, and contact merge scenarios. Tests verify plain-text password storage, duplicate prevention, CASCADE SET NULL on account deletion, addressbook toggle functionality, and NULL-only field updates during sync.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 11:53:01 +02:00
Ulas Kalayci c4b8b76221 Fix critical database issues in CardDAV sync service
Issue #1: Wrapped DELETE + INSERT operations in updateContactMultiValues in transaction to prevent inconsistent state if INSERT fails after DELETE.

Issue #2: Replaced N+1 query pattern with batch INSERT statements using VALUES list for phones, emails, and addresses. Also optimized primary entry check queries to use SELECT 1 instead of COUNT(*).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 11:45:07 +02:00
Ulas Kalayci 689b479b2d Implement CardDAV sync service with account and contact management
- Add server/services/cardav-sync.js with full CardDAV functionality
- Implement account management (add, delete, list, test connection)
- Implement addressbook discovery and selection toggle
- Add vCard parser with support for all standard fields (FN, N, TEL, EMAIL, ADR, ORG, TITLE, URL, BDAY, PHOTO, NICKNAME, NOTE, CATEGORIES)
- Implement smart merge logic for contact deduplication (UID match, email/phone match)
- Handle multi-value fields (phones, emails, addresses) with primary flag preservation
- Add comprehensive tests for vCard parsing and database operations
- All 46 tests passing

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 11:34:25 +02:00
Ulas Kalayci 3f77fdb11d Fix Migration 30 code quality issues
C1 (CRITICAL): Refactor test-carddav.js to import migrations
- Import MIGRATIONS from server/db.js instead of duplicating SQL
- Export MIGRATIONS array from server/db.js
- Use better-sqlite3 to apply Migration 30 dynamically
- Ensures future changes to Migration 30 are reflected in tests

I1 (IMPORTANT): Add UNIQUE index on carddav_uid
- Create idx_contacts_carddav_uid_unique partial index
- Prevents duplicate CardDAV contacts per account+addressbook
- WHERE clause excludes NULL values (manual contacts allowed)
- Add test to verify unique constraint enforcement

I3 (IMPORTANT): Rename cardav → carddav (RFC 6352 compliance)
- Table: cardav_accounts → carddav_accounts
- Table: cardav_addressbook_selection → carddav_addressbook_selection
- Column: contacts.cardav_* → contacts.carddav_*
- Index: idx_cardav_* → idx_carddav_*
- Test file: test-cardav.js → test-carddav.js
- Package.json: test:cardav → test:carddav
- All test assertions updated

All 25 tests pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 10:55:30 +02:00
Ulas Kalayci 18310dbfe5 feat(cardav): add Migration 30 for CardDAV contacts schema
Add comprehensive database schema for CardDAV multi-account contacts sync:

New tables:
- cardav_accounts: Store CardDAV server credentials
- cardav_addressbook_selection: Per-account addressbook enable/disable
- contact_phones: Multiple phone numbers per contact with labels
- contact_emails: Multiple email addresses per contact with labels
- contact_addresses: Multiple postal addresses per contact with labels

Extended contacts table with 9 new columns:
- organization, job_title, birthday, website, photo, nickname
- cardav_account_id (FK to cardav_accounts, ON DELETE SET NULL)
- cardav_uid (vCard UID from server)
- cardav_addressbook_url (source addressbook URL)

Features:
- UNIQUE constraints on (cardav_url, username) and (account_id, addressbook_url)
- CASCADE delete for addressbook selection and contact sub-tables
- Performance indices for cardav_uid and email lookups
- Support for manual contacts (NULL cardav_account_id)
- is_primary flag for phone/email/address selection

Test coverage:
- 23 comprehensive tests verify all tables, constraints, indices
- FK CASCADE delete behavior validated
- UNIQUE constraints enforced
- Data integrity scenarios tested

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 10:47:16 +02:00
Ulas Kalayci 6cc72676c6 docs: add CardDAV contacts sync design spec
- Multi-account CardDAV support with addressbook selection
- Inbound-only sync (CardDAV → Oikos)
- Smart merge by email/phone, preserve manual changes
- Extended contacts schema: organization, job_title, birthday, website, photo, nickname
- Separate tables for multiple phones/emails/addresses
- UI integration in Settings → Calendar tab
- Issue #10

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 10:33:01 +02:00
Ulas Kalayci dc0352545a chore: release v0.44.0
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 08:53:01 +02:00
Ulas Kalayci 4b4d9a1ffd feat: generic CalDAV multi-account sync (#90)
Replaces single Apple CalDAV with generic multi-account CalDAV integration.

Features:
- Multiple CalDAV accounts (iCloud, Nextcloud, Radicale, Baikal)
- Per-account calendar selection via checkboxes
- Bidirectional sync (CalDAV ↔ Oikos)
- Optional outbound target selection per event
- Migration of existing Apple CalDAV data

Technical:
- New tables: caldav_accounts, caldav_calendar_selection
- New service: server/services/caldav-sync.js
- New API routes: /calendar/caldav/*
- Enhanced UI in Settings and Calendar event modal
- 7 new tests, all passing

Closes #90

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 08:52:36 +02:00
Ulas Kalayci 2a4a6b945b docs: update documentation for CalDAV multi-account feature
- README.md: Updated Calendar feature description to mention multi-account CalDAV support
- docs/SPEC.md: Added caldav_accounts and caldav_calendar_selection table schemas, updated external_source enum, documented target columns
- public/locales/en.json: Added missing CalDAV i18n keys (calendarEnabled, calendarDisabled, calendarsRefreshed, deleteAccountConfirm, lastSync)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 08:51:38 +02:00
Ulas Kalayci 4bca84a609 test(caldav): add test suite for CalDAV multi-account sync
Add comprehensive test coverage for CalDAV multi-account functionality:
- Schema validation for caldav_accounts and caldav_calendar_selection tables
- UNIQUE constraint enforcement on account credentials
- Foreign key CASCADE delete behavior
- Calendar selection enable/disable filtering
- Target calendar columns in calendar_events table

All 7 tests pass using Node.js in-memory SQLite.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 08:44:06 +02:00
Ulas Kalayci 3c9b2840e7 feat(caldav): add Settings UI and Event Modal CalDAV target selection
- Add CalDAV accounts card to Settings page with:
  * List of configured accounts showing URL and last sync
  * Expandable calendar list with enable/disable checkboxes
  * Sync Now, Refresh Calendars, and Delete actions per account
  * Add Account modal with name, URL, username, password fields
- Add CalDAV target selector to event modal:
  * Dropdown showing local and all enabled CalDAV calendars
  * Grouped by account using optgroups
  * Pre-selects current target when editing events
  * Includes target_caldav_account_id and target_caldav_calendar_url in save
- Add CalDAV component styles to settings.css:
  * Account cards with header, meta, and action sections
  * Expandable calendar details with checkboxes and color dots
  * Empty state for no accounts
- Add missing i18n keys for calendar enable/disable, refresh, delete confirm
- Load CalDAV targets async when modal opens
- Admin-only access to account management

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 08:41:02 +02:00
Ulas Kalayci e149f5c01e feat(caldav): add German and English i18n keys 2026-05-04 08:34:31 +02:00
Ulas Kalayci c5a9799983 feat(caldav): add calendar selection, sync, and API routes
- Add getCalendars() and updateCalendarSelection() to caldav-sync.js
- Add sync() function for bidirectional CalDAV synchronization
- Add getStatus() to report on all accounts and enabled calendars
- Add 8 new API routes to calendar.js for CalDAV account and calendar management
- All routes require admin role for security

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 08:32:46 +02:00
Ulas Kalayci 01ccf715e5 feat(caldav): add account management functions (add, list, update, delete) 2026-05-04 08:20:17 +02:00
Ulas Kalayci 59773bd797 feat(caldav): implement account CRUD operations
Add createAccount, updateAccount, deleteAccount functions with validation, error handling, and logging. Implements Task 3 from the CalDAV multi-account spec.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 08:00:49 +02:00
Ulas Kalayci 7b91fa5136 Fix caldav-sync.js imports to match Task 2 spec
Remove buildICS, escapeICS, unescapeICS imports - these will be
needed in Task 5 (Sync Functions), not in Task 2. Keep only the
4 functions specified in the Task 2 spec: parseICS, formatICSDate,
tzLocalToUTC, applyDuration.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 07:56:57 +02:00
Ulas Kalayci a159a57e9c feat(caldav): add caldav-sync service base structure with helpers
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 07:53:39 +02:00
Ulas Kalayci 4eb7e852fd feat: add DB migration for CalDAV multi-account support
- caldav_accounts table for account credentials
- caldav_calendar_selection table for calendar selection
- Migrate Apple CalDAV data to caldav tables
- Add target_caldav_* columns to calendar_events
- Update external_source CHECK to include 'caldav'
- Update external_calendars.source CHECK to include 'caldav'
- Enhance migration runner to support function-based migrations

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 07:42:57 +02:00
Ulas Kalayci 26168ebef0 docs: spec self-review - klarstellungen zu scope und designentscheidungen 2026-05-04 07:24:29 +02:00
Ulas Kalayci d9aa70eedf docs: design spec für generisches CalDAV Multi-Account Sync
- Transformation Apple CalDAV → generisch
- Multiple Accounts parallel
- Kalenderauswahl per Checkboxen
- Bidirektional mit Account-Auswahl
- Vollständige Architektur, DB-Schema, API, UI, Migration, Testing

Siehe Issue #90
2026-05-04 07:23:38 +02:00
Ulas Kalayci 4bce97dd04 chore: release v0.43.0
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 07:03:41 +02:00
Ulas Kalayci 9b29d1847c feat: automatische geplante Backups mit Rotation
Phase 1.3 - Automatische Backups:
- Cron-basierter Scheduler (Standard: täglich 2 Uhr)
- Konfigurierbar über .env (Zeitplan, Verzeichnis, Anzahl)
- Automatische Rotation: behält nur letzte N Backups (Standard: 7)
- UI in Settings → Backup: Status-Anzeige und manueller Trigger
- Tests: 7 erfolgreiche Tests für Scheduler-Funktionalität

Neue Umgebungsvariablen:
- BACKUP_ENABLED (Standard: true)
- BACKUP_SCHEDULE (Standard: 0 2 * * *)
- BACKUP_DIR (Standard: ./backups)
- BACKUP_KEEP (Standard: 7)
- TZ (für Zeitzone)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 07:02:38 +02:00
Ulas Kalayci 99a2280c02 chore: release v0.42.0
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-04 06:52:35 +02:00
Ulas Kalayci 3b02cb1aee docs: update BACKLOG, SPEC, README, and CONTRIBUTING to v0.41.0
- BACKLOG: added completed entries for v0.38.2–v0.41.0 (loans, widget sizes,
  date formats, birthday badge, calendar improvements, typography, reminders)
- SPEC: added Budget Loans and Budget Loan Payments data-model tables; updated
  Budget module description with Loans tab and API; updated Dashboard with
  widget size presets; corrected Settings tab count from 8 to 9
- README: Budget feature row now mentions the loans tracker
- CONTRIBUTING: added test:kitchen-tabs and test:setup to individual suite list

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 20:16:26 +02:00
Ulas Kalayci 6eae4bae24 chore: release v0.41.0 2026-05-01 18:40:24 +02:00
Ulas Kalayci 2c948eb235 chore: release v0.40.1 2026-05-01 17:57:30 +02:00
Ulas Kalayci f21c6b0ca9 chore: release v0.40.0 2026-05-01 17:43:32 +02:00
ulsklyc c9b8381206 Merge pull request #117 from rafaelfoster/improvement-dashboard-customization
Dashboard Customization & Widget Layout Enhancements
2026-05-01 17:42:34 +02:00
Ulas Kalayci d61bdab65d Merge origin/main into improvement-dashboard-customization
Resolve sv.json conflict: take Swedish subcategory translations from
main and loan keys from PR branch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 17:42:23 +02:00
Ulas Kalayci f3dbbb37d7 fix: preserve dmy=DD.MM.YYYY, add dmy_slash for DD/MM/YYYY
The PR changed dmy from dots to slashes, breaking existing users.
Revert dmy to dots (backward compat), add dmy_slash for DD/MM/YYYY.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 15:28:18 +02:00
Rafael Foster 2b4f7352ed Refactor widget size selector to show only numeric dimensions 2026-05-01 09:18:44 -03:00
Rafael Foster f5377bd2f1 Improve dashboard widget sizing controls 2026-05-01 09:05:20 -03:00
Rafael Foster 9c5f8c9a99 Add dashboard widget customization 2026-05-01 08:53:25 -03:00
Rafael Foster e34ba33f9b Refine loan tab filtering and date formats 2026-05-01 08:24:39 -03:00
Rafael Foster 79f55cbfbc Improve loan dashboard interactions 2026-05-01 08:09:12 -03:00
Rafael Foster 977bee8a3a Separate budget and loan views 2026-05-01 07:52:43 -03:00
Ulas Kalayci 2588cc43f1 chore: release v0.39.2 2026-05-01 09:46:54 +02:00
Ulas Kalayci 270c8cda9d chore: release v0.39.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 08:24:30 +02:00
Ulas Kalayci a97e0f1480 Merge PR #115: Complete Swedish translation and fix missing i18n keys
Translates remaining English strings in sv.json and fills missing keys
(calendar/notes colors, emptyHint texts, shortcuts, navLabelOverdue,
photoOptional) across all 14 locale files.

Co-Authored-By: Andreas Olsson <olsson82@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 08:23:27 +02:00
Ulas Kalayci 8489022186 i18n: complete Swedish translation and fill missing keys in all locales
Translates remaining English strings in sv.json (attachment, API tokens,
budget categories, backup, onboarding, offline banner).

Also adds missing keys (calendar/notes color names, emptyHint texts,
shortcut labels, tasks.navLabelOverdue, birthdays.photoOptional) to all
13 other locale files so every language is now complete against de.json.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 08:23:13 +02:00
Andreas Olsson 647b9a9aa0 Update swedish translation
Updated non translated strings to swedish.
2026-05-01 06:38:32 +02:00
Rafael Foster 9a80b785c8 Refine budget loan entry flow 2026-04-30 23:20:25 -03:00
Rafael Foster ce107c80a4 Add budget loan tracking 2026-04-30 23:12:38 -03:00
Ulas Kalayci ef1f9e9383 chore: release v0.39.0 2026-04-30 19:54:44 +02:00
Ulas Kalayci 51bb0f95b2 feat(settings): add time format preference (24h/12h) (#114)
Co-authored-by: rafaelfoster <rafaelfoster@users.noreply.github.com>
2026-04-30 19:54:19 +02:00