feat: implement episode actions add endpoint

This commit is contained in:
Jef Roosens 2025-03-04 09:47:13 +01:00
parent 064365fb4f
commit bcfb8805eb
No known key found for this signature in database
GPG key ID: 21FD3D77D56BAF49
13 changed files with 152 additions and 63 deletions

View file

@ -1,6 +1,6 @@
drop table episode_actions;
drop table subscriptions;
drop table device_subscriptions;
drop table devices;

View file

@ -38,7 +38,7 @@ create table device_subscriptions (
podcast_url text not null,
time_changed bigint not null default 0,
time_changed bigint not null,
deleted boolean not null default false,
unique (device_id, podcast_url)
@ -55,6 +55,8 @@ create table episode_actions (
podcast_url text not null,
episode_url text not null,
time_changed bigint not null,
timestamp bigint,
action text not null,
started integer,
@ -62,10 +64,10 @@ create table episode_actions (
total integer,
-- Position should be set if the action type is "Play" and null otherwise
check ((action = "Play") = (position is not null)),
check ((action = "play") = (position is not null)),
-- Started and position can only be set if the action type is "Play"
check (action = "Play" or (started is null and position is null)),
check (action = "play" or (started is null and position is null)),
-- Started and position should be provided together
check ((started is null) = (total is null))