//
//  PersistenceUPDATE.swift
//  Feels
//
//  Created by Trey Tartt on 2/18/22.
//

import Foundation

extension PersistenceController {
    @discardableResult
    public func update(entryDate: Date, withModd mood: Mood) -> Bool {
        guard let existingEntry = getEntry(byDate: entryDate) else {
            return false
        }
        
        existingEntry.setValue(mood.rawValue, forKey: "moodValue")
        saveAndRunDataListerners()
        
        EventLogger.log(event: "update_entry")
        
        return true
    }
}
