Skip to main content

alibi_sqlx/store/entities/
team.rs

1use crate::SqlxModel;
2use alibi_core::types::Team;
3use chrono::{DateTime, Utc};
4
5#[derive(Clone, Debug, PartialEq, Eq, sqlx::FromRow, SqlxModel)]
6#[auth(table = "team")]
7pub struct Model {
8    pub id: String,
9    pub name: String,
10    pub organization_id: String,
11    pub member_count: i64,
12    pub created_at: DateTime<Utc>,
13    pub updated_at: Option<DateTime<Utc>>,
14}
15
16impl From<Model> for Team {
17    fn from(model: Model) -> Self {
18        Self {
19            id: model.id,
20            name: model.name,
21            organization_id: model.organization_id,
22            member_count: model.member_count,
23            created_at: model.created_at,
24            updated_at: model.updated_at,
25        }
26    }
27}