@@ -105,12 +105,7 @@ func CreateFilm(tmdbID int, title, year, path string, overview string, runtime i
105105 return id , nil
106106}
107107
108- func UpdateFilm (id int , tmdbID int , title , year , path string , overview string , runtime int , published bool ) error {
109- var tmdbIDPtr * int
110- if tmdbID > 0 {
111- tmdbIDPtr = & tmdbID
112- }
113-
108+ func UpdateFilm (id int , tmdbID * int , title , year , path string , overview string , runtime int , published bool ) error {
114109 var yearPtr * int
115110 if year != "" {
116111 y , err := strconv .Atoi (year )
@@ -128,7 +123,7 @@ func UpdateFilm(id int, tmdbID int, title, year, path string, overview string, r
128123 UPDATE films
129124 SET tmdb_id = $1, title = $2, year = $3, overview = $4, runtime = $5, published = $6, path = $7
130125 WHERE id = $8
131- ` , tmdbIDPtr , title , yearPtr , overview , runtimePtr , published , path , id )
126+ ` , tmdbID , title , yearPtr , overview , runtimePtr , published , path , id )
132127 if err != nil {
133128 return fmt .Errorf ("failed to update film: %w" , err )
134129 }
0 commit comments