63 lines
1.3 KiB
Rust
63 lines
1.3 KiB
Rust
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)
|
|
}
|
|
}
|