adding all of our core sql systems

This commit is contained in:
Chris Cochrun 2024-11-12 06:29:24 -06:00
parent 2408404ff4
commit c9225680c3
20 changed files with 1055 additions and 227 deletions

View file

@ -2,7 +2,7 @@ use std::{error::Error, fmt::Display};
use serde::{Deserialize, Serialize};
use crate::presentations::PresKind;
use super::presentations::PresKind;
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
pub enum ServiceItemKind {
@ -22,9 +22,7 @@ impl std::fmt::Display for ServiceItemKind {
Self::Video => "video".to_owned(),
Self::Presentation(PresKind::Html) => "html".to_owned(),
Self::Presentation(PresKind::Pdf) => "pdf".to_owned(),
Self::Presentation(PresKind::Generic) => {
"presentation".to_owned()
}
Self::Presentation(PresKind::Generic) => "presentation".to_owned(),
Self::Content => "content".to_owned(),
};
write!(f, "{s}")
@ -38,9 +36,7 @@ impl TryFrom<String> for ServiceItemKind {
"song" => Ok(Self::Song),
"image" => Ok(Self::Image),
"video" => Ok(Self::Video),
"presentation" => {
Ok(Self::Presentation(PresKind::Generic))
}
"presentation" => Ok(Self::Presentation(PresKind::Generic)),
"html" => Ok(Self::Presentation(PresKind::Html)),
"pdf" => Ok(Self::Presentation(PresKind::Pdf)),
"content" => Ok(Self::Content),
@ -55,9 +51,7 @@ impl From<ServiceItemKind> for String {
ServiceItemKind::Song => "song".to_owned(),
ServiceItemKind::Video => "video".to_owned(),
ServiceItemKind::Image => "image".to_owned(),
ServiceItemKind::Presentation(_) => {
"presentation".to_owned()
}
ServiceItemKind::Presentation(_) => "presentation".to_owned(),
ServiceItemKind::Content => "content".to_owned(),
}
}
@ -71,10 +65,7 @@ pub enum ParseError {
impl Error for ParseError {}
impl Display for ParseError {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::fmt::Result {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let message = match self {
Self::UnknownType => "The type does not exist. It needs to be one of 'song', 'video', 'image', 'presentation', or 'content'",
};