Fix duplicated infrastructures/servers

Leftover from some refactoring, was not deleting older
infrastructures before adding a new one.
This commit is contained in:
Davide De Rosa 2022-05-05 10:45:38 +02:00
parent 15a4cc8f75
commit ae6b5c50d9
1 changed files with 2 additions and 0 deletions

View File

@ -55,6 +55,8 @@ class InfrastructureRepository: Repository {
infrastructure.name,
vpnProtocol.rawValue
)
let existing = try context.fetch(request)
existing.forEach(context.delete)
let dto = InfrastructureMapper(
context,