CrmDatabase.swift 32 lignes · 1257 octets
import Foundation

/// Aggregate over the Data-layer DAO ports (Kotlin Room `CrmDatabase`),
/// consumed by `SyncEngine`/`AgendaSyncCoordinator`. The SQLite implementation
/// and in-memory test double both conform to this.
protocol CrmDatabase {
    var crmContactDao: CrmContactDao { get }
    var entrepriseDao: EntrepriseDao { get }
    var projetDao: ProjetDao { get }
    var tacheDao: TacheDao { get }
    var interactionDao: InteractionDao { get }
    var workflowDao: WorkflowDao { get }
    var rdvDao: RdvDao { get }
    var reservationDao: ReservationDao { get }
    var indisponibiliteDao: IndisponibiliteDao { get }
    var syncMetaDao: SyncMetaDao { get }
    var syncOpDao: SyncOpDao { get }
    var noteProjetDao: NoteProjetDao { get }
}

/// The SQLite facade exposes exactly these DAO properties.
extension Card2vcfDatabase: CrmDatabase {}

/// Slice of Android `ContactImageStore` used by `SyncEngine` to persist downloaded
/// contact images; returns the stored file path. The Data-layer `ContactImageStore`
/// class already provides this method.
protocol ContactImageSaving {
    @discardableResult
    func saveBytes(contactId: Int64, name: String, bytes: Data) throws -> String
}

extension ContactImageStore: ContactImageSaving {}