zeeguu / api

API for tracking a learner's progress when reading materials in a foreign language and recommending further personalized exercises and readings.
https://zeeguu.org
MIT License
8 stars 24 forks source link

Moving article_id to bookmark from text table #278

Open tfnribeiro opened 2 weeks ago

tfnribeiro commented 2 weeks ago

Currently, a bookmark will be associated with a text_id, which points to the Text table, that contains a context and an article_id. Currently, this association is not enforced by a FK constraint, and lead to some errors when a bookmark no longer can find the article_id associated to it. (This was quite rare).

However, further reflection lead us to discuss that instead of associating the text with the article, we should instead associate the bookmark with an article_id, which will then have the span (Text) it appears on. This would allow us in the future to maybe have different types of contexts where the word can be found (e.g. video, photo by the user) which would be a context_id, with a particular span.