22 lines
639 B
Crystal
22 lines
639 B
Crystal
require "jennifer/model/authentication"
|
|
|
|
class User < Jennifer::Model::Base
|
|
with_timestamps
|
|
|
|
# it adds authenticate
|
|
include Jennifer::Model::Authentication
|
|
with_authentication
|
|
|
|
mapping(
|
|
id: { type: UUID, primary: true, default: UUID.random },
|
|
username: String,
|
|
email: String?,
|
|
password_digest: { type: String, default: "" },
|
|
password: Password, # String?, virtual, no setter
|
|
password_confirmation: { type: String?, virtual: true },
|
|
created_at: { type: Time, default: Time.utc },
|
|
updated_at: { type: Time, default: Time.utc },
|
|
roles: { type: Array(String), default: Array(String).new }
|
|
)
|
|
end
|