feat: move core services to services directory

This commit is contained in:
Andrew Phillips
2025-08-25 18:22:17 -03:00
committed by Andrew Phillips (aider)
parent 8cc0cfc606
commit 321e00171e
9 changed files with 201 additions and 533 deletions

22
src/services/types.rs Normal file
View File

@@ -0,0 +1,22 @@
use crate::db::{Item, Meta, Tag};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ItemWithMeta {
pub item: Item,
pub tags: Vec<Tag>,
pub meta: Vec<Meta>,
}
impl ItemWithMeta {
pub fn meta_as_map(&self) -> HashMap<String, String> {
self.meta.iter().cloned().map(|m| (m.name, m.value)).collect()
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ItemWithContent {
pub item_with_meta: ItemWithMeta,
pub content: Vec<u8>,
}