fleshing out the core a bit more
This commit is contained in:
parent
e05815e550
commit
c8bb484a53
13 changed files with 497 additions and 9 deletions
|
@ -1,11 +1,63 @@
|
|||
use crate::images::Image;
|
||||
use crate::presentations::Presentation;
|
||||
use crate::songs::Song;
|
||||
use crate::videos::Video;
|
||||
|
||||
use super::kinds::ServiceItemKind;
|
||||
|
||||
#[derive(Debug, Default, PartialEq)]
|
||||
struct ServiceItem {
|
||||
id: i32,
|
||||
database_id: i32,
|
||||
kind: ServiceItemKind,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, PartialEq)]
|
||||
struct ServiceItemModel {
|
||||
items: Vec<ServiceItem>,
|
||||
}
|
||||
|
||||
impl From<Song> for ServiceItem {
|
||||
fn from(_song: Song) -> Self {
|
||||
Self {
|
||||
kind: ServiceItemKind::Song,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Video> for ServiceItem {
|
||||
fn from(_video: Video) -> Self {
|
||||
Self {
|
||||
kind: ServiceItemKind::Video,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Image> for ServiceItem {
|
||||
fn from(_image: Image) -> Self {
|
||||
Self {
|
||||
kind: ServiceItemKind::Image,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Presentation> for ServiceItem {
|
||||
fn from(presentation: Presentation) -> Self {
|
||||
let preskind = presentation.get_kind();
|
||||
Self {
|
||||
kind: ServiceItemKind::Presentation(preskind.clone()),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
#[test]
|
||||
pub fn test_service_item() {
|
||||
assert_eq!(true, true)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue