Clean up architecture
This commit is contained in:
@@ -8,6 +8,7 @@ pub mod error;
|
||||
pub mod model;
|
||||
pub mod store;
|
||||
|
||||
pub use brittle_model::ReferenceSummary;
|
||||
pub use error::{BibtexError, BrittleError, StoreError, ValidationError};
|
||||
pub use model::{
|
||||
Annotation, AnnotationId, AnnotationSet, AnnotationType, Color, EntryType, Library, LibraryId,
|
||||
@@ -18,33 +19,8 @@ pub use store::{FsStore, MemoryStore, Store};
|
||||
use crate::bibtex::export_references;
|
||||
use crate::error::EntityType;
|
||||
use chrono::Utc;
|
||||
use serde::Serialize;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
/// A lightweight summary of a reference, suitable for list views.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
|
||||
pub struct ReferenceSummary {
|
||||
pub id: ReferenceId,
|
||||
pub cite_key: String,
|
||||
pub entry_type: EntryType,
|
||||
pub title: Option<String>,
|
||||
pub authors: Vec<Person>,
|
||||
pub year: Option<String>,
|
||||
}
|
||||
|
||||
impl From<&Reference> for ReferenceSummary {
|
||||
fn from(r: &Reference) -> Self {
|
||||
Self {
|
||||
id: r.id,
|
||||
cite_key: r.cite_key.clone(),
|
||||
entry_type: r.entry_type.clone(),
|
||||
title: r.title().map(str::to_owned),
|
||||
authors: r.authors.clone(),
|
||||
year: r.year().map(str::to_owned),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The main entry point for Brittle.
|
||||
///
|
||||
/// Generic over [`Store`] to allow testing with [`MemoryStore`] and production
|
||||
|
||||
Reference in New Issue
Block a user