84 lines
2.7 KiB
Rust
84 lines
2.7 KiB
Rust
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
use sqlx::{self, FromRow};
|
|
|
|
#[derive(Clone, Serialize, Deserialize, Debug, FromRow)]
|
|
pub(crate) struct RawPage {
|
|
pub id: i64,
|
|
pub slug: String,
|
|
pub title: String,
|
|
pub note_id: i64,
|
|
pub creation_date: DateTime<Utc>,
|
|
pub updated_date: DateTime<Utc>,
|
|
pub lastview_date: DateTime<Utc>,
|
|
pub deleted_date: Option<DateTime<Utc>>,
|
|
}
|
|
|
|
#[derive(Clone, Serialize, Deserialize, Debug, FromRow)]
|
|
pub(crate) struct RawNote {
|
|
pub id: i64,
|
|
pub uuid: String,
|
|
pub content: String,
|
|
pub notetype: String,
|
|
pub creation_date: DateTime<Utc>,
|
|
pub updated_date: DateTime<Utc>,
|
|
pub lastview_date: DateTime<Utc>,
|
|
pub deleted_date: Option<DateTime<Utc>>,
|
|
}
|
|
|
|
// // A Resource is either content or a URL to content that the
|
|
// // user embeds in a note. TODO: I have no idea how to do this yet,
|
|
// // but I'll figure it out.
|
|
// #[derive(Clone, Serialize, Deserialize, Debug)]
|
|
// pub struct Resource {
|
|
// pub id: String,
|
|
// pub content: String,
|
|
// }
|
|
//
|
|
// // A Breadcrumb is a component of a reference. Every element should
|
|
// // be clickable, although in practice what's going to happen is that
|
|
// // the user will be sent to the *page* with that note, then *scrolled*
|
|
// // to that note via anchor.
|
|
// #[derive(Clone, Debug)]
|
|
// pub struct Breadcrumb {
|
|
// pub note_id: String,
|
|
// pub summary: String,
|
|
// }
|
|
//
|
|
// // A Note is the heart of our system. It is a single object that has
|
|
// // a place in our system; it has a parent, but it also has embedded
|
|
// // references that allow it to navigate through a web of related
|
|
// // objects. It may have children. *AT THIS LAYER*, though, it is
|
|
// // returned as an array. It is up to the
|
|
// #[derive(Clone, Debug)]
|
|
// pub struct Note {
|
|
// pub id: String,
|
|
// pub parent_id: String,
|
|
// pub content: String,
|
|
// pub resources: Vec<Resource>,
|
|
// pub note_type: String, // Describes the relationship to the parent note.
|
|
// pub created: DateTime<Utc>,
|
|
// pub updated: DateTime<Utc>,
|
|
// pub viewed: DateTime<Utc>,
|
|
// pub deleted: Option<DateTime<Utc>>,
|
|
// }
|
|
//
|
|
// pub struct Reference {
|
|
// pub page_id: String,
|
|
// pub page_title: String,
|
|
// pub reference_summary_titles: Vec<Breadcrumbs>,
|
|
// pub reference_summary: String,
|
|
// }
|
|
|
|
pub struct Page {
|
|
pub slug: String,
|
|
pub title: String,
|
|
// pub notes: Vec<Notes>, // The actual notes on this page.
|
|
// pub references: Vec<Reference>, // All other notes that reference this page.
|
|
// pub unlinked_references: Vec<Reference>,
|
|
pub created: DateTime<Utc>,
|
|
pub updated: DateTime<Utc>,
|
|
pub viewed: DateTime<Utc>,
|
|
pub deleted: Option<DateTime<Utc>>,
|
|
}
|