+ Adding Videos field to json store
Basically the json store keeps the keys _and_ the meta data for the videos At some we'll change this however this would be a dblib only change
This commit is contained in:
parent
3623a8236f
commit
27f337f63a
@ -6,6 +6,7 @@ use serde::{Serialize, Deserialize};
|
|||||||
|
|
||||||
pub mod request;
|
pub mod request;
|
||||||
pub mod keystore;
|
pub mod keystore;
|
||||||
|
pub mod videostore;
|
||||||
pub mod err;
|
pub mod err;
|
||||||
use request::ApiKey;
|
use request::ApiKey;
|
||||||
|
|
||||||
@ -25,15 +26,22 @@ fn dev_urandom() -> std::io::Result<String> {
|
|||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct VideoMeta {
|
pub struct VideoMeta {
|
||||||
pub id: u64,
|
pub id: String,
|
||||||
pub string: String,
|
pub name: String,
|
||||||
|
pub desc: Option<String>
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
struct VideoMetaEntry {
|
||||||
|
pub name: String,
|
||||||
pub desc: Option<String>
|
pub desc: Option<String>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct DB {
|
pub struct DB {
|
||||||
keys: Vec<ApiKey>,
|
keys: Vec<ApiKey>,
|
||||||
videos: HashMap<String, VideoMeta>
|
// We map the video meta id to its actual body content
|
||||||
|
videos: HashMap<String, VideoMetaEntry>
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: add some proper lifetime management here and some docs
|
// TODO: add some proper lifetime management here and some docs
|
||||||
@ -46,8 +54,8 @@ pub trait KeyStore {
|
|||||||
|
|
||||||
pub trait VideoStore {
|
pub trait VideoStore {
|
||||||
fn new_video(name: &str, desc: &str) -> err::Result<()>;
|
fn new_video(name: &str, desc: &str) -> err::Result<()>;
|
||||||
fn del_video(id: u64) -> err::Result<()>;
|
fn del_video(id: String) -> err::Result<()>;
|
||||||
fn get_video(id: Option<u64>, name: Option<&str>) -> err::Result<VideoMeta>;
|
fn get_video(id: Option<String>, name: Option<&str>) -> err::Result<VideoMeta>;
|
||||||
fn rename_video(id: u64, new: &str) -> err::Result<()>;
|
fn rename_video(id: String, new: &str) -> err::Result<()>;
|
||||||
fn redescribe_video(id: u64, new: &str) -> err::Result<()>;
|
fn redescribe_video(id: String, new: &str) -> err::Result<()>;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user