feat: Updates to use swift-validations for database.
All checks were successful
CI / Linux Tests (push) Successful in 6m28s
All checks were successful
CI / Linux Tests (push) Successful in 6m28s
This commit is contained in:
10
Sources/DatabaseClient/Internal/Model+validateAndSave.swift
Normal file
10
Sources/DatabaseClient/Internal/Model+validateAndSave.swift
Normal file
@@ -0,0 +1,10 @@
|
||||
import Fluent
|
||||
import Validations
|
||||
|
||||
extension Model where Self: Validations.Validatable {
|
||||
|
||||
func validateAndSave(on database: any Database) async throws {
|
||||
try self.validate()
|
||||
try await self.save(on: database)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user