feat(calendar,addressbook): remove old sharing code
This commit is contained in:
@@ -6,6 +6,15 @@ use crate::domain::entities::contact::AddressBook;
|
||||
|
||||
pub type AddressBookRepositoryResult<T> = Result<T, DomainError>;
|
||||
|
||||
/// Repository interface for AddressBook entity operations.
|
||||
///
|
||||
/// Post-Round-3, access-control state lives in `storage.role_grants`.
|
||||
/// The pre-Round-3 methods that read/wrote `carddav.address_book_shares`
|
||||
/// (`get_shared_address_books`, `share_address_book`,
|
||||
/// `unshare_address_book`, `get_address_book_shares`) have been removed
|
||||
/// from this trait. The `carddav.address_book_shares` table still
|
||||
/// exists for one-release rollback safety; a follow-up migration drops
|
||||
/// it.
|
||||
pub trait AddressBookRepository: Send + Sync + 'static {
|
||||
async fn create_address_book(
|
||||
&self,
|
||||
@@ -20,28 +29,13 @@ pub trait AddressBookRepository: Send + Sync + 'static {
|
||||
&self,
|
||||
id: &Uuid,
|
||||
) -> AddressBookRepositoryResult<Option<AddressBook>>;
|
||||
/// Direct owner enumeration — same semantics as the calendar
|
||||
/// counterpart. The service layer prefers
|
||||
/// `authz.list_incoming_grants`, but internal maintenance paths
|
||||
/// keep the owner-only lookup available.
|
||||
async fn get_address_books_by_owner(
|
||||
&self,
|
||||
owner_id: Uuid,
|
||||
) -> AddressBookRepositoryResult<Vec<AddressBook>>;
|
||||
async fn get_shared_address_books(
|
||||
&self,
|
||||
user_id: Uuid,
|
||||
) -> AddressBookRepositoryResult<Vec<AddressBook>>;
|
||||
async fn get_public_address_books(&self) -> AddressBookRepositoryResult<Vec<AddressBook>>;
|
||||
async fn share_address_book(
|
||||
&self,
|
||||
address_book_id: &Uuid,
|
||||
user_id: Uuid,
|
||||
can_write: bool,
|
||||
) -> AddressBookRepositoryResult<()>;
|
||||
async fn unshare_address_book(
|
||||
&self,
|
||||
address_book_id: &Uuid,
|
||||
user_id: Uuid,
|
||||
) -> AddressBookRepositoryResult<()>;
|
||||
async fn get_address_book_shares(
|
||||
&self,
|
||||
address_book_id: &Uuid,
|
||||
) -> AddressBookRepositoryResult<Vec<(String, bool)>>;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,15 @@ use uuid::Uuid;
|
||||
|
||||
pub type CalendarRepositoryResult<T> = Result<T, DomainError>;
|
||||
|
||||
/// Repository interface for Calendar entity operations
|
||||
/// Repository interface for Calendar entity operations.
|
||||
///
|
||||
/// Post-Round-3, access-control state lives in `storage.role_grants` —
|
||||
/// the pre-Round-3 methods that read/wrote `caldav.calendar_shares`
|
||||
/// (`list_calendars_shared_with_user`, `user_has_calendar_access`,
|
||||
/// `share_calendar`, `remove_calendar_sharing`, `get_calendar_shares`)
|
||||
/// have been removed from this trait. The `caldav.calendar_shares` table
|
||||
/// still exists for one-release rollback safety; a follow-up migration
|
||||
/// drops it.
|
||||
pub trait CalendarRepository: Send + Sync + 'static {
|
||||
/// Creates a new calendar
|
||||
async fn create_calendar(&self, calendar: Calendar) -> CalendarRepositoryResult<Calendar>;
|
||||
@@ -18,7 +26,11 @@ pub trait CalendarRepository: Send + Sync + 'static {
|
||||
/// Finds a calendar by its ID
|
||||
async fn find_calendar_by_id(&self, id: &Uuid) -> CalendarRepositoryResult<Calendar>;
|
||||
|
||||
/// Lists all calendars for a specific user
|
||||
/// Lists all calendars owned by a specific user. Post-Round-3 the
|
||||
/// service layer prefers `authz.list_incoming_grants` (surfaces
|
||||
/// owned + shared in one union), but this direct lookup remains
|
||||
/// available for internal maintenance / migration paths that need
|
||||
/// owner-only enumeration without going through the engine.
|
||||
async fn list_calendars_by_owner(
|
||||
&self,
|
||||
owner_id: Uuid,
|
||||
@@ -31,12 +43,6 @@ pub trait CalendarRepository: Send + Sync + 'static {
|
||||
owner_id: Uuid,
|
||||
) -> CalendarRepositoryResult<Calendar>;
|
||||
|
||||
/// Lists calendars shared with a specific user
|
||||
async fn list_calendars_shared_with_user(
|
||||
&self,
|
||||
user_id: Uuid,
|
||||
) -> CalendarRepositoryResult<Vec<Calendar>>;
|
||||
|
||||
/// List public calendars
|
||||
async fn list_public_calendars(
|
||||
&self,
|
||||
@@ -44,13 +50,6 @@ pub trait CalendarRepository: Send + Sync + 'static {
|
||||
offset: i64,
|
||||
) -> CalendarRepositoryResult<Vec<Calendar>>;
|
||||
|
||||
/// Checks if a user has access to a calendar
|
||||
async fn user_has_calendar_access(
|
||||
&self,
|
||||
calendar_id: &Uuid,
|
||||
user_id: Uuid,
|
||||
) -> CalendarRepositoryResult<bool>;
|
||||
|
||||
/// Gets a custom property for a calendar
|
||||
async fn get_calendar_property(
|
||||
&self,
|
||||
@@ -78,25 +77,4 @@ pub trait CalendarRepository: Send + Sync + 'static {
|
||||
&self,
|
||||
calendar_id: &Uuid,
|
||||
) -> CalendarRepositoryResult<std::collections::HashMap<String, String>>;
|
||||
|
||||
/// Share calendar with another user
|
||||
async fn share_calendar(
|
||||
&self,
|
||||
calendar_id: &Uuid,
|
||||
user_id: Uuid,
|
||||
access_level: &str,
|
||||
) -> CalendarRepositoryResult<()>;
|
||||
|
||||
/// Remove calendar sharing for a user
|
||||
async fn remove_calendar_sharing(
|
||||
&self,
|
||||
calendar_id: &Uuid,
|
||||
user_id: Uuid,
|
||||
) -> CalendarRepositoryResult<()>;
|
||||
|
||||
/// Get calendar sharing information (who has access to this calendar)
|
||||
async fn get_calendar_shares(
|
||||
&self,
|
||||
calendar_id: &Uuid,
|
||||
) -> CalendarRepositoryResult<Vec<(String, String)>>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user