fix(daemon): use canonical movie states in import
ci / web (push) Successful in 57s
ci / rust (push) Successful in 1m45s
e2e / e2e (push) Successful in 1m48s

PRs #82 and #85 were each green pre-merge; #85 renamed movie states
(grabbed->downloading, imported->available) and #82's import path
still wrote the old names, so main failed the movies CHECK constraint.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Miguel Palhas
2026-08-22 23:23:56 +01:00
parent ffb8485939
commit 0343783a57
3 changed files with 16 additions and 16 deletions
@@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "UPDATE movies\n SET state = 'imported',\n updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')\n WHERE id = ?",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
},
"hash": "93d05b3370c722a59239b486f5ca68123fb59610ba8ab8e8f6c1a1189610e377"
}
@@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "UPDATE movies\n SET state = 'available',\n updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')\n WHERE id = ?",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
},
"hash": "c17e4da86245ae665fc2326f0939eacba63e1e3e7f3bb39e38beee5a170c6984"
}
+4 -4
View File
@@ -405,7 +405,7 @@ async fn record_import(
.await?; .await?;
sqlx::query!( sqlx::query!(
"UPDATE movies "UPDATE movies
SET state = 'imported', SET state = 'available',
updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now') updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
WHERE id = ?", WHERE id = ?",
pending.movie_id pending.movie_id
@@ -633,7 +633,7 @@ mod tests {
.unwrap(); .unwrap();
sqlx::query( sqlx::query(
"INSERT INTO movies (tmdb_id, title, year, original_language, root_id, state) "INSERT INTO movies (tmdb_id, title, year, original_language, root_id, state)
SELECT 693134, 'Dune: Part Two', 2024, 'en', id, 'grabbed' SELECT 693134, 'Dune: Part Two', 2024, 'en', id, 'downloading'
FROM roots WHERE kind = 'movie' AND audience = 'main'", FROM roots WHERE kind = 'movie' AND audience = 'main'",
) )
.execute(database.pool()) .execute(database.pool())
@@ -728,7 +728,7 @@ mod tests {
.fetch_one(h.database.pool()) .fetch_one(h.database.pool())
.await .await
.unwrap(); .unwrap();
assert_eq!(movie_state, "imported"); assert_eq!(movie_state, "available");
} }
/// §5.3 through §5.7: Profile 5 is a hard fail — blacklisted, grab /// §5.3 through §5.7: Profile 5 is a hard fail — blacklisted, grab
@@ -786,7 +786,7 @@ mod tests {
.execute(h.database.pool()) .execute(h.database.pool())
.await .await
.unwrap(); .unwrap();
sqlx::query("UPDATE movies SET state = 'grabbed'") sqlx::query("UPDATE movies SET state = 'downloading'")
.execute(h.database.pool()) .execute(h.database.pool())
.await .await
.unwrap(); .unwrap();