Skip to content

Commit

Permalink
Implement marked_as_done for updating texts.
Browse files Browse the repository at this point in the history
  • Loading branch information
BurnyLlama committed Apr 21, 2024
1 parent ea118ca commit 7ea4031
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sql/articles/update.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ UPDATE articles SET
text_type = $5,
updated_at = NOW(),
tags = $6,
is_published = $7
is_published = $7,
marked_as_done = $8
FROM creators
WHERE
articles.author = creators.username
AND
id = $8
id = $9
RETURNING
id,
title,
Expand Down
1 change: 1 addition & 0 deletions src/api/text/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ pub async fn text_edit(
form.text_type,
&tags,
should_publish,
form.marked_as_done,
)
.await?;

Expand Down
2 changes: 2 additions & 0 deletions src/database/models/article.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ impl Text {
text_type: TextType,
tags: &Vec<String>,
is_published: bool,
marked_as_done: bool,
) -> Result<Text, Error> {
sqlx::query_file_as!(
Self,
Expand All @@ -146,6 +147,7 @@ impl Text {
text_type as TextType,
tags,
is_published,
marked_as_done,
id,
)
.fetch_one(&db.pool)
Expand Down

0 comments on commit 7ea4031

Please sign in to comment.