feat: save watch progress
This commit is contained in:
@@ -46,14 +46,22 @@ RETURNING *;
|
||||
SELECT * FROM anime WHERE id = ? LIMIT 1;
|
||||
|
||||
-- name: UpsertWatchListEntry :one
|
||||
INSERT INTO watch_list_entry (id, user_id, anime_id, status, current_episode, updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, CURRENT_TIMESTAMP)
|
||||
INSERT INTO watch_list_entry (id, user_id, anime_id, status, current_episode, current_time_seconds, updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP)
|
||||
ON CONFLICT (user_id, anime_id) DO UPDATE SET
|
||||
status = excluded.status,
|
||||
current_episode = excluded.current_episode,
|
||||
current_time_seconds = excluded.current_time_seconds,
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
RETURNING *;
|
||||
|
||||
-- name: SaveWatchProgress :exec
|
||||
UPDATE watch_list_entry
|
||||
SET current_episode = ?,
|
||||
current_time_seconds = ?,
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
WHERE user_id = ? AND anime_id = ?;
|
||||
|
||||
-- name: GetWatchListEntry :one
|
||||
SELECT * FROM watch_list_entry
|
||||
WHERE user_id = ? AND anime_id = ? LIMIT 1;
|
||||
|
||||
Reference in New Issue
Block a user