Fix error in emoji update SQL query

This commit is contained in:
silverpill 2023-03-24 22:54:51 +00:00
parent 521c2cbe41
commit 76e85a3b7b
2 changed files with 27 additions and 1 deletions

View file

@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Fixed
- Fixed error in emoji update SQL query.
## [1.18.0] - 2023-03-21
### Added

View file

@ -65,7 +65,7 @@ pub async fn update_emoji(
SET
image = $1,
updated_at = $2
WHERE id = $4
WHERE id = $3
RETURNING emoji
",
&[
@ -224,6 +224,28 @@ mod tests {
assert_eq!(emoji.hostname, Some(hostname.to_string()));
}
#[tokio::test]
#[serial]
async fn test_update_emoji() {
let db_client = &create_test_database().await;
let image = EmojiImage::default();
let emoji = create_emoji(
db_client,
"test",
None,
image.clone(),
None,
&Utc::now(),
).await.unwrap();
let updated_emoji = update_emoji(
db_client,
&emoji.id,
image,
&Utc::now(),
).await.unwrap();
assert_ne!(updated_emoji.updated_at, emoji.updated_at);
}
#[tokio::test]
#[serial]
async fn test_delete_emoji() {