Implementation of a generic backend of eshop in Crystal
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 

21 rindas
500 B

require "json"
require "uuid"
require "uuid/json"
require "crypto/bcrypt/password"
require "./invoice"
enum UserType
Normal=0,
Administrator=1,
end
class User
JSON.mapping(
addresses: {type: Array(Address), nilable: true},
invoices: {type: Array(Invoice), nilable: true},
tokens: {type: Array(UUID), nilable: true},
email: String,
password_hash: {type: String, nilable: true},
type: {type: UserType, default: UserType::Normal},
)
end