fix: identity status - TMDb and user_defined identities start as 'pending' (確認制)
This commit is contained in:
@@ -264,7 +264,7 @@ def register_identity_to_db(
|
|||||||
name,
|
name,
|
||||||
"people",
|
"people",
|
||||||
"tmdb",
|
"tmdb",
|
||||||
"confirmed",
|
"pending", # TMDb identities need manual confirmation
|
||||||
embedding_str,
|
embedding_str,
|
||||||
json.dumps(reference_data),
|
json.dumps(reference_data),
|
||||||
tmdb_id,
|
tmdb_id,
|
||||||
|
|||||||
26
scripts/update_identity_status.py
Normal file
26
scripts/update_identity_status.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/opt/homebrew/bin/python3.11
|
||||||
|
"""
|
||||||
|
Update identity status from confirmed to pending
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
import psycopg2
|
||||||
|
|
||||||
|
DATABASE_URL = os.getenv("DATABASE_URL", "postgres://accusys@localhost:5432/momentry")
|
||||||
|
|
||||||
|
conn = psycopg2.connect(DATABASE_URL)
|
||||||
|
cur = conn.cursor()
|
||||||
|
|
||||||
|
# Update all confirmed identities to pending
|
||||||
|
cur.execute("UPDATE identities SET status='pending' WHERE status='confirmed'")
|
||||||
|
rows_affected = cur.rowcount
|
||||||
|
conn.commit()
|
||||||
|
|
||||||
|
print(f"Updated {rows_affected} identities from 'confirmed' to 'pending'")
|
||||||
|
|
||||||
|
# Verify
|
||||||
|
cur.execute("SELECT COUNT(*) FROM identities WHERE status='pending'")
|
||||||
|
pending_count = cur.fetchone()[0]
|
||||||
|
print(f"Total pending identities: {pending_count}")
|
||||||
|
|
||||||
|
cur.close()
|
||||||
|
conn.close()
|
||||||
@@ -3950,7 +3950,7 @@ sqlx::query(
|
|||||||
// Not found: create new with generated uuid
|
// Not found: create new with generated uuid
|
||||||
let id: i32 = sqlx::query_scalar(&format!(
|
let id: i32 = sqlx::query_scalar(&format!(
|
||||||
"INSERT INTO {} (uuid, name, identity_type, source, status) \
|
"INSERT INTO {} (uuid, name, identity_type, source, status) \
|
||||||
VALUES (gen_random_uuid(), $1, 'people', 'user_defined', 'confirmed') \
|
VALUES (gen_random_uuid(), $1, 'people', 'user_defined', 'pending') \
|
||||||
RETURNING id",
|
RETURNING id",
|
||||||
identities_table
|
identities_table
|
||||||
))
|
))
|
||||||
|
|||||||
Reference in New Issue
Block a user