Implementation of a generic backend of eshop in Crystal
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
500 B

5 years ago
  1. require "json"
  2. require "uuid"
  3. require "uuid/json"
  4. require "crypto/bcrypt/password"
  5. require "./invoice"
  6. enum UserType
  7. Normal=0,
  8. Administrator=1,
  9. end
  10. class User
  11. JSON.mapping(
  12. addresses: {type: Array(Address), nilable: true},
  13. invoices: {type: Array(Invoice), nilable: true},
  14. tokens: {type: Array(UUID), nilable: true},
  15. email: String,
  16. password_hash: {type: String, nilable: true},
  17. type: {type: UserType, default: UserType::Normal},
  18. )
  19. end