-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add playlists to sync code, DB & API and add playlist direct links #1159
Open
LukasKalbertodt
wants to merge
8
commits into
elan-ev:master
Choose a base branch
from
LukasKalbertodt:add-playlists
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Commits on Jun 3, 2024
-
Add playlists to DB and harvest module
This means that Tobira will store all playlist info already when syncing. I thought about the DB "array vs. table" question for some time. Here are my notes that made me decide for the array solution: Should the entries be stored as an array in a column of the `playlists` table? Or be a separate table that needs to be joined? The latter would be the traditionally "better" version, as it normalizes the data. A playlist entry contains these fields: - Opencast ID, - Type (e.g. video) - Content ID (e.g. Opencast video ID). If we store it in a separate table we also need the following fields: - Playlist: foreign key to playlist ID - Index: ordering in a table is not well defined, so to get a definite order, we need another index field. - Potentially another artificial ID? - Normalization is what you're supposed to do, right? - Allows to use LIMIT and OFFSET, i.e. only load part of all entries. (Kind of possible with arrays as well though). - Allows to modify/delete individual entries without rewriting all of them - Many situations treat the entries as one atomic value: - Harvest/sync: the API sends the full playlist object including entries. If using an extra table, we would have to delete all old entries there, then insert all new ones. - Playlist block: loads all entries. Ok but what about pagination: we don't have that yet. But we should at some point? - Even in the modifying/moving/deleting a single entry case: - Opencast's APIs require us to send all entries, so while we can do very localized updates in our DB, we have to load all entries anyway. - After changing something, the Harvest API will send an update which leads to overwriting all entries again. - Extra table requires at least two additional fields to be stored (foreign key & index) - Management of `index` adds complexity whenever somehow editing entries. Just writing all entries at once again is easier. Also: should there be DB checks that make sure the indices are always 0 to N like for blocks? Adds more complexity and we ran into problems with that once. - Even if we add pagination: apart from offering a different UX, pagination helps with performance in four spots: rendering, backend<->frontend communication, DB<->backend communication, DB loading from disk. The first three benefits we can still have, even with arrays. - Looking at how PostgreSQL stores rows, arrays shouldn't incur any meaningful overhead and might even be faster in the majority of situations.
Configuration menu - View commit details
-
Copy full SHA for a5640d1 - Browse repository at this point
Copy the full SHA a5640d1View commit details -
Fix
db clear
after adding playlist typesWe did not have types depending on other types before. Adding "cascade" luckily fixes this.
Configuration menu - View commit details
-
Copy full SHA for ca39d98 - Browse repository at this point
Copy the full SHA ca39d98View commit details -
Split
blocks/Series.tsx
into two filesI only moved stuff around and fixed imports, that's all. I did that so that the reviewer can just skip this commit. It is preparation for making a general `VideoListBlock`.
Configuration menu - View commit details
-
Copy full SHA for e4137e9 - Browse repository at this point
Copy the full SHA e4137e9View commit details -
Refactor
VideoListBlock
to be more independent of "series"Again, preparation for using that for playlists as well
Configuration menu - View commit details
-
Copy full SHA for 5ae7896 - Browse repository at this point
Copy the full SHA 5ae7896View commit details -
Remove unused
order
parameter fromSeries.events
This was added a long time ago. By now, the ordering is done in the frontend, so the parameter is completely unused. We can get rid of some complexity by removing it.
Configuration menu - View commit details
-
Copy full SHA for 29fe59f - Browse repository at this point
Copy the full SHA 29fe59fView commit details -
This only adds querying capabilities, no mutations yet.
Configuration menu - View commit details
-
Copy full SHA for c276b48 - Browse repository at this point
Copy the full SHA c276b48View commit details -
Configuration menu - View commit details
-
Copy full SHA for d29530c - Browse repository at this point
Copy the full SHA d29530cView commit details -
Improve warning when harvest item cannot be deserialized
This is a band aid fix and not perfect. When I added the `Unknown` variant to the enum, I wasn't aware that it was used when other variants fail to deserialize even with `kind: "event"`. So the warning there was misleading. It's still not perfect because I ideally want to print more information on the deseralization failure. And the `kind` strings are duplicated now. I think in the future, the `HarvestResponse` might have items of type `{ kind: String, #[serde(flatten)] body: serde_json::Value }` or something like that. And then we deserialize it manually in a second step. We will see.
Configuration menu - View commit details
-
Copy full SHA for 3244bc0 - Browse repository at this point
Copy the full SHA 3244bc0View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.