32 lines
611 B
Rust
32 lines
611 B
Rust
use chrono::prelude::*;
|
|
use juniper::graphql_object;
|
|
use uuidv7::Uuid;
|
|
|
|
use crate::api::{scalars, Context};
|
|
|
|
#[derive(Clone, Debug)]
|
|
pub struct Directory {
|
|
pub id: Uuid,
|
|
pub created_at: DateTime<Utc>,
|
|
pub updated_at: Option<DateTime<Utc>>,
|
|
}
|
|
|
|
#[graphql_object(context = Context)]
|
|
impl Directory {
|
|
fn id(&self) -> scalars::Uuid {
|
|
scalars::Uuid(self.id)
|
|
}
|
|
|
|
fn path(&self) -> String {
|
|
format!("{}", self.id)
|
|
}
|
|
|
|
fn created_at(&self) -> DateTime<Utc> {
|
|
self.created_at
|
|
}
|
|
|
|
fn updated_at(&self) -> Option<DateTime<Utc>> {
|
|
self.updated_at
|
|
}
|
|
}
|