use diesel::{Associations, Identifiable, Insertable, Queryable, Selectable}; use std::time::SystemTime; #[derive(Queryable, Selectable, Insertable, Identifiable, Debug, PartialEq, Clone)] #[diesel(table_name = crate::schema::users)] #[diesel(check_for_backend(diesel::pg::Pg))] pub struct User { pub id: String, pub email: String, } #[derive( Queryable, Selectable, Insertable, Identifiable, Associations, Debug, PartialEq, Clone, )] #[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, } #[derive( Queryable, Selectable, Insertable, Identifiable, Associations, Debug, PartialEq, Clone, )] #[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, } #[derive( Queryable, Selectable, Insertable, Identifiable, Associations, Debug, PartialEq, Clone, )] #[diesel(belongs_to(User))] #[diesel(table_name = crate::schema::totp_authenticators)] #[diesel(check_for_backend(diesel::pg::Pg))] pub struct TotpAuthenticator { pub id: String, pub user_id: String, pub secret: String, pub verified: bool, }