Skip to main content

notes_tools/
note_summary.rs

1//! Metadata returned when listing accessible notes.
2
3use chrono::{DateTime, Utc};
4use serde::{Deserialize, Serialize};
5
6use crate::Note;
7
8#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
9pub struct NoteSummary {
10    pub id: String,
11    pub owner_id: String,
12    pub family_id: Option<String>,
13    pub title: String,
14    pub created_at: DateTime<Utc>,
15    pub updated_at: DateTime<Utc>,
16}
17
18impl From<Note> for NoteSummary {
19    fn from(note: Note) -> Self {
20        Self {
21            id: note.id,
22            owner_id: note.owner_id,
23            family_id: note.family_id,
24            title: note.title,
25            created_at: note.created_at,
26            updated_at: note.updated_at,
27        }
28    }
29}