32 lines
832 B
Rust
32 lines
832 B
Rust
use crate::{DateTimeUtc, RepoId, UserId};
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use super::LockType;
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "repo_lfs_lock")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
#[sea_orm(column_name = "repo_uuid")]
|
|
pub repo: RepoId,
|
|
#[sea_orm(primary_key)]
|
|
pub path: String,
|
|
pub lock_type: String,
|
|
#[sea_orm(column_name = "locked_by")]
|
|
pub locked_by: UserId,
|
|
pub locked_at: DateTimeUtc,
|
|
pub unlocked_at: Option<DateTimeUtc>,
|
|
}
|
|
|
|
impl Model {
|
|
pub fn lock_type_enum(&self) -> Result<LockType, &'static str> {
|
|
self.lock_type.parse()
|
|
}
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|