- Implement camera capture and plant identification workflow - Add Core Data persistence for plants, care schedules, and cached API data - Create collection view with grid/list layouts and filtering - Build plant detail views with care information display - Integrate Trefle botanical API for plant care data - Add local image storage for captured plant photos - Implement dependency injection container for testability - Include accessibility support throughout the app Bug fixes in this commit: - Fix Trefle API decoding by removing duplicate CodingKeys - Fix LocalCachedImage to load from correct PlantImages directory - Set dateAdded when saving plants for proper collection sorting Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
45 lines
1.8 KiB
Swift
45 lines
1.8 KiB
Swift
//
|
|
// CareScheduleRepositoryProtocol.swift
|
|
// PlantGuide
|
|
//
|
|
// Created for PlantGuide plant identification app.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
/// Repository protocol defining the data access contract for PlantCareSchedule entities.
|
|
/// Implementations handle persistence operations for plant care scheduling data.
|
|
protocol CareScheduleRepositoryProtocol: Sendable {
|
|
|
|
/// Saves a care schedule to the repository.
|
|
/// - Parameter schedule: The care schedule entity to save.
|
|
/// - Throws: An error if the save operation fails.
|
|
func save(_ schedule: PlantCareSchedule) async throws
|
|
|
|
/// Fetches the care schedule for a specific plant.
|
|
/// - Parameter plantID: The unique identifier of the plant whose schedule to fetch.
|
|
/// - Returns: The care schedule if found, or nil if no schedule exists for the given plant.
|
|
/// - Throws: An error if the fetch operation fails.
|
|
func fetch(for plantID: UUID) async throws -> PlantCareSchedule?
|
|
|
|
/// Fetches all care schedules from the repository.
|
|
/// - Returns: An array of all stored care schedules.
|
|
/// - Throws: An error if the fetch operation fails.
|
|
func fetchAll() async throws -> [PlantCareSchedule]
|
|
|
|
/// Fetches all care tasks across all schedules.
|
|
/// - Returns: An array of all care tasks.
|
|
/// - Throws: An error if the fetch operation fails.
|
|
func fetchAllTasks() async throws -> [CareTask]
|
|
|
|
/// Updates a specific care task in the repository.
|
|
/// - Parameter task: The updated care task.
|
|
/// - Throws: An error if the update operation fails.
|
|
func updateTask(_ task: CareTask) async throws
|
|
|
|
/// Deletes the care schedule for a specific plant.
|
|
/// - Parameter plantID: The unique identifier of the plant whose schedule to delete.
|
|
/// - Throws: An error if the delete operation fails.
|
|
func delete(for plantID: UUID) async throws
|
|
}
|