notesmachine/server/nm-store/src/structs.rs

59 lines
2.0 KiB
Rust
Raw Normal View History

use chrono::{DateTime, Utc};
use sqlx::{self, FromRow};
2020-10-06 15:01:25 +00:00
// // 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>>,
}