Last active
May 31, 2018 12:20
-
-
Save hsharghi/62b03d7de40ae183aaf449e57f6e9de5 to your computer and use it in GitHub Desktop.
User model for Blog API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FluentMySQL | |
import Vapor | |
final class User: MySQLModel { // 1 | |
/// The unique identifier for `User` // 2 | |
var id: Int? | |
// Additional properties of `User` // 3 | |
var email: String | |
var password: String | |
var nickname: String? | |
/// Creates a new `User`. //4 | |
init(id: Int? = nil, nickname: String? = nil, email: String, password: String) { | |
self.id = id | |
self.email = email | |
self.nickname = nickname | |
self.password = password | |
} | |
} | |
extension User: Migration { } // 5 | |
extension User: Content { } // 6 | |
extension User: Parameter { } // 7 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment