fleshing out the core a bit more

This commit is contained in:
Chris Cochrun 2024-10-06 05:51:39 -05:00
parent e05815e550
commit c8bb484a53
13 changed files with 497 additions and 9 deletions

View file

@ -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)
}
}