fix(calendar): change owner_id from String to Uuid type

The database schema defines owner_id as UUID, but the Calendar entity
stored it as String. This caused a type mismatch error when creating
calendars via CalDAV clients like DAVx:

  column "owner_id" is of type uuid but expression is of type text

Changes:
- Change Calendar.owner_id from String to Uuid
- Update new() and with_id() to accept Uuid
- Update owner_id() getter to return &Uuid
- Update belongs_to() to accept &Uuid
- Update calendar_storage_adapter to pass Uuid directly
- Update tests to use Uuid::new_v4()

Fixes #200
This commit is contained in:
BillionClaw
2026-03-17 02:58:34 +08:00
parent 036a345b4e
commit 7645792d5a
2 changed files with 17 additions and 28 deletions
@@ -49,7 +49,7 @@ impl CalendarStoragePort for CalendarStorageAdapter {
dto: CreateCalendarDto,
owner_id: Uuid,
) -> Result<CalendarDto, DomainError> {
let calendar = Calendar::new(dto.name, owner_id.to_string(), dto.description, dto.color)?;
let calendar = Calendar::new(dto.name, owner_id, dto.description, dto.color)?;
let created = self.calendar_repository.create_calendar(calendar).await?;
Ok(CalendarDto::from(created))