Store release_date on added movies
Needed so the frontend can sort lists by release date, not just by when they were added. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+3
-3
@@ -9,10 +9,10 @@ class Movie {
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
public function add($userId, $tmdbId, $title, $poster, $type) {
|
||||
public function add($userId, $tmdbId, $title, $poster, $type, $releaseDate = null) {
|
||||
// 1. On insère le film
|
||||
$stmt = $this->db->prepare("INSERT INTO movies (user_id, tmdb_id, title, poster_path, media_type, is_common) VALUES (?, ?, ?, ?, ?, 0)");
|
||||
$stmt->execute([$userId, $tmdbId, $title, $poster, $type]);
|
||||
$stmt = $this->db->prepare("INSERT INTO movies (user_id, tmdb_id, title, poster_path, media_type, release_date, is_common) VALUES (?, ?, ?, ?, ?, ?, 0)");
|
||||
$stmt->execute([$userId, $tmdbId, $title, $poster, $type, $releaseDate ?: null]);
|
||||
|
||||
// 2. On récupère l'ID du partenaire (supposons que tu as une table 'users' avec un champ 'partner_id')
|
||||
$stmt = $this->db->prepare("SELECT partner_id FROM users WHERE id = ?");
|
||||
|
||||
Reference in New Issue
Block a user