Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #19 from nodes-vapor/bugfix/softdelete-symbols
Browse files Browse the repository at this point in the history
Fixed softdelete for classes.
  • Loading branch information
Casperhr authored Mar 23, 2017
2 parents 823f1e3 + 32d6d4b commit c12c751
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Sources/NodesModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,16 @@ extension NodesModel {
try Self.query().save(&self)
}

public mutating func delete() throws {
public func delete() throws {
if Self.softDeletable {
deletedAt = Date()
try save()
var temp = self
temp.deletedAt = Date()

self.willDelete()

try temp.save()

self.didDelete()
} else {
try Self.query().delete(self)
}
Expand Down

0 comments on commit c12c751

Please sign in to comment.