Adds storeParent to manage substorage directories

sync3
Laurent 6 months ago
parent 96b6c657e3
commit ec1f6825c0
  1. 5
      LeStorage/StoredCollection.swift
  2. 1
      LeStorageTests/ApiCallTests.swift
  3. 4
      LeStorageTests/CollectionsTests.swift
  4. 3
      LeStorageTests/IdentifiableTests.swift
  5. 1
      LeStorageTests/StoredCollectionTests.swift

@ -271,6 +271,11 @@ public class StoredCollection<T: Storable>: SomeCollection {
self.addItem(instance: instance)
}
/// Deletes the instance in the collection and sets the collection as changed to trigger a write
public func delete(instance: T) {
self.delete(instance: instance, actionOption: .cascade)
}
/// Deletes the instance in the collection and sets the collection as changed to trigger a write
public func delete(instance: T, actionOption: ActionOption) {
defer {

@ -18,6 +18,7 @@ class Thing: SyncedModelObject, SyncedStorable, URLParameterConvertible {
static func tokenExemptedMethods() -> [LeStorage.HTTPMethod] { return [] }
static func filterByStoreIdentifier() -> Bool { return false }
static var copyServerResponse: Bool = false
static func storeParent() -> Bool { return false }
var id: String = Store.randomId()
var name: String = ""

@ -17,6 +17,7 @@ class Car: ModelObject, Storable {
}
static func relationships() -> [LeStorage.Relationship] { return [] }
static func storeParent() -> Bool { return false }
}
@ -24,7 +25,7 @@ class Boat: ModelObject, SyncedStorable {
var id: String = Store.randomId()
var lastUpdate: Date = Date()
var shared: Bool? = false
var sharing: LeStorage.SharingStatus?
override required init() {
super.init()
@ -33,6 +34,7 @@ class Boat: ModelObject, SyncedStorable {
static func tokenExemptedMethods() -> [LeStorage.HTTPMethod] { return [] }
static func resourceName() -> String { return "boat" }
static var copyServerResponse: Bool = false
static func storeParent() -> Bool { return false }
var storeId: String? { return nil }
func copy(from other: any LeStorage.Storable) {

@ -12,6 +12,7 @@ class IntObject: ModelObject, Storable {
static func resourceName() -> String { "int" }
static func tokenExemptedMethods() -> [LeStorage.HTTPMethod] { [] }
static func storeParent() -> Bool { return false }
var id: Int
var name: String
@ -30,8 +31,10 @@ class IntObject: ModelObject, Storable {
}
class StringObject: ModelObject, Storable {
static func resourceName() -> String { "string" }
static func tokenExemptedMethods() -> [LeStorage.HTTPMethod] { [] }
static func storeParent() -> Bool { return false }
var id: String
var name: String

@ -136,5 +136,6 @@ class MockStorable: ModelObject, Storable {
static func relationships() -> [LeStorage.Relationship] {
return []
}
static func storeParent() -> Bool { return false }
}

Loading…
Cancel
Save