From 84cbd8d76859c601da8b250da70f9152b0a46e5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Neto?= Date: Fri, 3 Mar 2023 00:39:05 +0000 Subject: [PATCH] use insert batch --- Sources/manager/Controllers/ApodManagerController.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Sources/manager/Controllers/ApodManagerController.swift b/Sources/manager/Controllers/ApodManagerController.swift index 5b8403f..4b56c29 100644 --- a/Sources/manager/Controllers/ApodManagerController.swift +++ b/Sources/manager/Controllers/ApodManagerController.swift @@ -57,8 +57,10 @@ public class ApodManagerController { private func saveItems(_ items: [NasaApodDto]?) async throws { let itemsAdd: [ApodStorage] = items?.map { ApodStorage($0) } ?? [] - for item in itemsAdd { - try await storageController.asyncSaveItem(item) - } + try storageController.saveItemsSql(itemsAdd) + self.items = try getAll()?.mapToEntity() + // for item in itemsAdd { + // try await storageController.asyncSaveItem(item) + // } } }