Skip to content

Instantly share code, notes, and snippets.

@hsharghi
Last active May 31, 2018 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hsharghi/62b03d7de40ae183aaf449e57f6e9de5 to your computer and use it in GitHub Desktop.
Save hsharghi/62b03d7de40ae183aaf449e57f6e9de5 to your computer and use it in GitHub Desktop.
User model for Blog API
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