fix(daemon): use canonical movie states in import
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:
@@ -405,7 +405,7 @@ async fn record_import(
|
||||
.await?;
|
||||
sqlx::query!(
|
||||
"UPDATE movies
|
||||
SET state = 'imported',
|
||||
SET state = 'available',
|
||||
updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
|
||||
WHERE id = ?",
|
||||
pending.movie_id
|
||||
@@ -633,7 +633,7 @@ mod tests {
|
||||
.unwrap();
|
||||
sqlx::query(
|
||||
"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'",
|
||||
)
|
||||
.execute(database.pool())
|
||||
@@ -728,7 +728,7 @@ mod tests {
|
||||
.fetch_one(h.database.pool())
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(movie_state, "imported");
|
||||
assert_eq!(movie_state, "available");
|
||||
}
|
||||
|
||||
/// §5.3 through §5.7: Profile 5 is a hard fail — blacklisted, grab
|
||||
@@ -786,7 +786,7 @@ mod tests {
|
||||
.execute(h.database.pool())
|
||||
.await
|
||||
.unwrap();
|
||||
sqlx::query("UPDATE movies SET state = 'grabbed'")
|
||||
sqlx::query("UPDATE movies SET state = 'downloading'")
|
||||
.execute(h.database.pool())
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user