trifid/trifid-api/src/models.rs

30 lines
967 B
Rust
Raw Normal View History

2023-11-19 16:31:30 +00:00
use std::time::SystemTime;
use diesel::{Associations, Identifiable, Insertable, Queryable, Selectable};
2023-11-19 15:49:08 +00:00
2023-11-19 16:31:30 +00:00
#[derive(Queryable, Selectable, Insertable, Identifiable, Debug, PartialEq)]
2023-11-19 15:49:08 +00:00
#[diesel(table_name = crate::schema::users)]
#[diesel(check_for_backend(diesel::pg::Pg))]
pub struct User {
pub id: String,
pub email: String
2023-11-19 16:31:30 +00:00
}
#[derive(Queryable, Selectable, Insertable, Identifiable, Associations, Debug, PartialEq)]
#[diesel(belongs_to(User))]
#[diesel(table_name = crate::schema::magic_links)]
#[diesel(check_for_backend(diesel::pg::Pg))]
pub struct MagicLink {
pub id: String,
pub user_id: String,
pub expires: SystemTime
2023-11-20 01:58:46 +00:00
}
#[derive(Queryable, Selectable, Insertable, Identifiable, Associations, Debug, PartialEq)]
#[diesel(belongs_to(User))]
#[diesel(table_name = crate::schema::session_tokens)]
#[diesel(check_for_backend(diesel::pg::Pg))]
pub struct SessionToken {
pub id: String,
pub user_id: String,
pub expires: SystemTime
2023-11-19 15:49:08 +00:00
}