Update TaglineInserForm and TaglineUpdateForm

This commit is contained in:
Freek van Zee 2024-04-11 21:40:50 +02:00
parent 6935acba2f
commit 999e9845e7
3 changed files with 6 additions and 4 deletions

View file

@ -31,7 +31,9 @@ pub async fn create_tagline(
let content = process_markdown(&data.content, &slur_regex, &url_blocklist, &context).await?;
is_valid_tagline_content(&content)?;
let tagline_form = TaglineInsertForm { content };
let tagline_form = TaglineInsertForm {
content: Some(content),
};
let tagline = Tagline::create(&mut context.pool(), &tagline_form).await?;

View file

@ -33,7 +33,7 @@ pub async fn update_tagline(
is_valid_tagline_content(&content)?;
let tagline_form = TaglineUpdateForm {
content,
content: Some(content),
updated: Some(Some(naive_now())),
};

View file

@ -24,13 +24,13 @@ pub struct Tagline {
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
#[cfg_attr(feature = "full", diesel(table_name = tagline))]
pub struct TaglineInsertForm {
pub content: String,
pub content: Option<String>,
}
#[derive(Clone, Default)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
#[cfg_attr(feature = "full", diesel(table_name = tagline))]
pub struct TaglineUpdateForm {
pub content: String,
pub content: Option<String>,
pub updated: Option<Option<DateTime<Utc>>>,
}