headless_lms_models/
course_language_groups.rs

1use crate::prelude::*;
2
3#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
4pub struct CourseLanguageVersion {
5    pub id: Uuid,
6    pub created_at: DateTime<Utc>,
7    pub updated_at: DateTime<Utc>,
8    pub deleted_at: Option<DateTime<Utc>>,
9}
10
11pub async fn insert(conn: &mut PgConnection, pkey_policy: PKeyPolicy<Uuid>) -> ModelResult<Uuid> {
12    let res = sqlx::query!(
13        "
14INSERT INTO course_language_groups (id)
15VALUES ($1)
16RETURNING id
17        ",
18        pkey_policy.into_uuid(),
19    )
20    .fetch_one(conn)
21    .await?;
22    Ok(res.id)
23}