authd/src/user.cr

26 lines
405 B
Crystal
Raw Normal View History

require "pg"
require "crecto"
class User < Crecto::Model
schema "users" do # table name
field :username, String
field :realname, String
field :avatar, String
field :password, String
field :perms, Array(String)
end
validate_required [:username, :password, :perms]
def to_h
{
:username => @username,
:realname => @realname,
:perms => @perms,
:avatar => @avatar
}
end
end