42 lines
1.1 KiB
Rust
42 lines
1.1 KiB
Rust
use chrono::{offset::Utc, DateTime};
|
|
use diesel::{pg::Pg, prelude::*};
|
|
use uuid::Uuid;
|
|
|
|
use crate::schema;
|
|
|
|
#[derive(Clone, Debug, Identifiable, Insertable, Queryable, Selectable)]
|
|
#[diesel(table_name = schema::teams)]
|
|
#[diesel(check_for_backend(Pg))]
|
|
pub struct Team {
|
|
pub id: Uuid,
|
|
pub name: String,
|
|
}
|
|
|
|
#[derive(Associations, Clone, Debug, Identifiable, Insertable, Queryable, Selectable)]
|
|
#[diesel(table_name = schema::team_memberships)]
|
|
#[diesel(belongs_to(Team))]
|
|
#[diesel(belongs_to(crate::users::User))]
|
|
#[diesel(primary_key(team_id, user_id))]
|
|
#[diesel(check_for_backend(Pg))]
|
|
pub struct TeamMembership {
|
|
pub team_id: Uuid,
|
|
pub user_id: Uuid,
|
|
pub roles: Vec<Option<String>>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Identifiable, Queryable, Selectable)]
|
|
#[diesel(table_name = schema::browser_sessions)]
|
|
#[diesel(check_for_backend(Pg))]
|
|
pub struct BrowserSession {
|
|
pub id: String,
|
|
pub serialized: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Identifiable, Queryable, Selectable)]
|
|
#[diesel(table_name = schema::csrf_tokens)]
|
|
#[diesel(check_for_backend(Pg))]
|
|
pub struct CsrfToken {
|
|
pub id: Uuid,
|
|
pub user_id: Option<Uuid>,
|
|
pub expires_at: DateTime<Utc>,
|
|
}
|