Generate Vapor project.
This commit is contained in:
17
Sources/stella/DTOs/TodoDTO.swift
Normal file
17
Sources/stella/DTOs/TodoDTO.swift
Normal file
@@ -0,0 +1,17 @@
|
||||
import Fluent
|
||||
import Vapor
|
||||
|
||||
struct TodoDTO: Content {
|
||||
var id: UUID?
|
||||
var title: String?
|
||||
|
||||
func toModel() -> Todo {
|
||||
let model = Todo()
|
||||
|
||||
model.id = self.id
|
||||
if let title = self.title {
|
||||
model.title = title
|
||||
}
|
||||
return model
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user