42 lines
856 B
Rust
42 lines
856 B
Rust
use std::collections::HashMap;
|
|||
|
|
use chrono::{DateTime, Utc};
|
||
|
|
use crate::core::srs::WordOpenMode;
|
||
|
|
use crate::data::{Id, INVALID_ID};
|
||
|
|
|
||
|
|
#[derive(Clone, Debug)]
|
||
|
|
pub struct WordData {
|
||
|
|
pub id: Id,
|
||
|
|
pub key: String,
|
||
|
|
pub value: String,
|
||
|
|
pub tags: String,
|
||
|
|
pub additional: HashMap<String, String>,
|
||
|
|
pub group_id: Id,
|
||
|
|
}
|
||
|
|
#[derive(Clone)]
|
||
|
|
pub struct WordGroup {
|
||
|
|
pub id: Id,
|
||
|
|
pub name: String,
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
impl WordData {
|
||
|
|
pub fn new() -> Self {
|
||
|
|
Self {
|
||
|
|
id: INVALID_ID,
|
||
|
|
key: String::new(),
|
||
|
|
value: String::new(),
|
||
|
|
tags: String::new(),
|
||
|
|
additional: Default::default(),
|
||
|
|
group_id: 1.into(),
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Clone)]
|
||
|
|
pub struct HistoryItem {
|
||
|
|
pub timestamp: DateTime<Utc>,
|
||
|
|
pub word_id: Id,
|
||
|
|
pub mode: WordOpenMode,
|
||
|
|
pub before: u8,
|
||
|
|
pub after: u8,
|
||
|
|
}
|