You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
707 B
29 lines
707 B
import Fluent |
|
import struct Foundation.UUID |
|
|
|
/// Property wrappers interact poorly with `Sendable` checking, causing a warning for the `@ID` property |
|
/// It is recommended you write your model with sendability checking on and then suppress the warning |
|
/// afterwards with `@unchecked Sendable`. |
|
final class Todo: Model, @unchecked Sendable { |
|
static let schema = "todos" |
|
|
|
@ID(key: .id) |
|
var id: UUID? |
|
|
|
@Field(key: "title") |
|
var title: String |
|
|
|
init() { } |
|
|
|
init(id: UUID? = nil, title: String) { |
|
self.id = id |
|
self.title = title |
|
} |
|
|
|
func toDTO() -> TodoDTO { |
|
.init( |
|
id: self.id, |
|
title: self.$title.value |
|
) |
|
} |
|
}
|
|
|