pub struct ArticleService { /* private fields */ }Expand description
Service for managing articles and their associated images
Provides high-level operations for creating, reading, updating and deleting articles, while also handling associated image management.
Implementations§
Source§impl ArticleService
impl ArticleService
Sourcepub async fn list_articles(
&self,
filter: Option<HashMap<String, String>>,
) -> Result<Vec<Article>, Box<dyn Error>>
pub async fn list_articles( &self, filter: Option<HashMap<String, String>>, ) -> Result<Vec<Article>, Box<dyn Error>>
Sourcepub async fn create_article(
&self,
title: &str,
slug: &str,
description: &str,
author: &str,
kind: Option<ArticleKind>,
) -> Result<Uuid, Box<dyn Error>>
pub async fn create_article( &self, title: &str, slug: &str, description: &str, author: &str, kind: Option<ArticleKind>, ) -> Result<Uuid, Box<dyn Error>>
Sourcepub async fn update_article(
&self,
id: Uuid,
title: &str,
slug: &str,
description: &str,
author: Vec<String>,
status: Option<&str>,
created: Option<DateTime<Utc>>,
contents: &str,
images: Vec<String>,
source: &str,
publish: Option<DateTime<Utc>>,
kind: Option<ArticleKind>,
) -> Result<(), Box<dyn Error>>
pub async fn update_article( &self, id: Uuid, title: &str, slug: &str, description: &str, author: Vec<String>, status: Option<&str>, created: Option<DateTime<Utc>>, contents: &str, images: Vec<String>, source: &str, publish: Option<DateTime<Utc>>, kind: Option<ArticleKind>, ) -> Result<(), Box<dyn Error>>
Updates an existing article and its associated images
§Arguments
id- Article UUIDtitle- New titleslug- New slugdescription- New descriptionauthor- New author liststatus- Optional new statuscreated- Optional new creation datecontents- New contentimages- New list of image pathssource- New sourcepublish- Optional new publish datekind- Optional new article type
§Returns
Ok(()) if successful, otherwise an error
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ArticleService
impl !RefUnwindSafe for ArticleService
impl Send for ArticleService
impl Sync for ArticleService
impl Unpin for ArticleService
impl !UnwindSafe for ArticleService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more