I want to make a duplicate check in my createHandler for myModelController.
My initial idea was to initialize the object: let object = try Object(...)
then query all the objects ( Object.query(on: req).all().flatMap { objects in ... }) and iterate through the objects array
then compare properties β¦
I was wondering if there was an easier way to do this with Vapor and Fluent queries?
@gflo Donβt know if this would help you but there is a better solution for that by just tell vapor to take care of it through Migration. Here is an example: