UserEntity.vala 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using InvercargillSql.Orm;
  2. using Inversion;
  3. namespace Spry.Authentication {
  4. /**
  5. * Persistent user account row (`spry_users`). Passwords are stored as
  6. * libsodium hashes via {@link UserService}.
  7. */
  8. public class UserEntity : Object {
  9. public int64 id { get; set; }
  10. public string username { get; set; }
  11. public string email { get; set; }
  12. public string forename { get; set; }
  13. public string surname { get; set; }
  14. public string password_hash { get; set; }
  15. public DateTime date_of_birth { get; set; }
  16. public DateTime created { get; set; }
  17. public DateTime modified { get; set; }
  18. public bool enabled { get; set; }
  19. public static void entity_mapping(EntityMapperBuilder<UserEntity> cfg) {
  20. cfg.table("spry_users")
  21. .column<int64?>("id", o => o.id, (o, v) => o.id = v)
  22. .column<string>("username", o => o.username, (o, v) => o.username = v)
  23. .column<string>("email", o => o.email, (o, v) => o.email = v)
  24. .column<string>("forename", o => o.forename, (o, v) => o.forename = v)
  25. .column<string>("surname", o => o.surname, (o, v) => o.surname = v)
  26. .column<string>("password_hash", o => o.password_hash, (o, v) => o.password_hash = v)
  27. .column<DateTime>("date_of_birth", o => o.date_of_birth, (o, v) => o.date_of_birth = v)
  28. .column<DateTime>("created", o => o.created, (o, v) => o.created = v)
  29. .column<DateTime>("modified", o => o.modified, (o, v) => o.modified = v)
  30. .column<bool>("enabled", o => o.enabled, (o, v) => o.enabled = v);
  31. }
  32. }
  33. }