Manually setting the deletedAt value

In my application, I am trying to implement the Offline-First architecture. On the client, I use Core Data to store model objects. And for some reason, instead of using the GET, POST, DELETE, PUT methods, it is more convenient for me to use only PUT.
Can I directly set a value for the deletedAt attribute that was created using property @Timestamp(key: “deleted_at”, on: .delete) instead of using delete and restore methods? Will Vapor handle this correctly?

You can manually set the deletedAt attribute, Fluent should work fine with that.

However, I don’t understand why it’s more convenient for you to just use PUT requests? Surely it doesn’t make any difference to the actual code?

Additionally, why does sticking to PUT requests mean you can’t call delete or restore?

1 Like