34 lines
1.1 KiB
Swift
34 lines
1.1 KiB
Swift
//
|
|
// StorageServiceProtocol.swift
|
|
// AutoCatCore
|
|
//
|
|
// Created by Selim Mustafaev on 13.07.2024.
|
|
// Copyright © 2024 Selim Mustafaev. All rights reserved.
|
|
//
|
|
|
|
import Mockable
|
|
import Foundation
|
|
|
|
@Mockable
|
|
public protocol StorageServiceProtocol: Sendable {
|
|
|
|
// Generic
|
|
var dbFileURL: URL? { get async }
|
|
|
|
// Vehicles
|
|
func loadVehicles() async -> [VehicleDto]
|
|
func loadVehicle(number: String) async throws -> VehicleDto
|
|
@discardableResult
|
|
func updateVehicle(dto: VehicleDto, policy: DbUpdatePolicy) async throws -> Bool
|
|
|
|
// Notes
|
|
func addNote(text: String, to number: String) async throws -> VehicleDto
|
|
func deleteNote(id: String, for number: String) async throws -> VehicleDto
|
|
func editNote(id: String, text: String, for number: String) async throws -> VehicleDto
|
|
|
|
// Events
|
|
func add(event: VehicleEventDto, to number: String) async throws -> VehicleDto
|
|
func remove(event id: String, from number: String) async throws -> VehicleDto
|
|
func edit(event: VehicleEventDto, for number: String) async throws -> VehicleDto
|
|
}
|