[READ-ONLY] Mirror of https://github.com/flo-bit/skywatched. review movies and tv shows, based on at proto skywatched.app
0

Configure Feed

Select the types of activity you want to include in your feed.

fix

Florian (Dec 4, 2024, 2:04 PM +0100) b8a35b62 263c3ddf

+7 -5
+2 -1
src/lib/server/db/schema.ts
··· 16 16 }); 17 17 18 18 export const movies = sqliteTable('movies', { 19 - id: integer('id').primaryKey(), 19 + id: text('id').primaryKey(), 20 + movieId: integer('movie_id').notNull(), 20 21 username: text('username') 21 22 .notNull() 22 23 .references(() => user.username),
+5 -4
src/routes/movie/[id]/+page.server.ts
··· 24 24 .select() 25 25 .from(table.movies) 26 26 .where( 27 - and(eq(table.movies.id, id), eq(table.movies.username, event.locals.user?.username)) 27 + and(eq(table.movies.movieId, id), eq(table.movies.username, event.locals.user?.username)) 28 28 ); 29 29 if (movie.length > 0 && movie[0].watched !== 0) { 30 30 watched = true; ··· 52 52 const movie = await db 53 53 .select() 54 54 .from(table.movies) 55 - .where(and(eq(table.movies.id, movieId), eq(table.movies.username, username))); 55 + .where(and(eq(table.movies.movieId, movieId), eq(table.movies.username, username))); 56 56 57 57 if (movie.length > 0) { 58 58 await db 59 59 .update(table.movies) 60 60 .set({ watched: movie[0].watched !== 0 ? 0 : 1 }) 61 - .where(eq(table.movies.id, movieId)); 61 + .where(eq(table.movies.movieId, movieId)); 62 62 } else { 63 63 await db.insert(table.movies).values({ 64 64 username, 65 - id: movieId, 65 + id: crypto.randomUUID(), 66 + movieId: movieId, 66 67 watched: 1, 67 68 originalTitle: result.original_title, 68 69 posterPath: result.poster_path,