-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Is your feature request related to a problem? Please describe.
Right now it is not possible (or at least not efficient) to sort and Play entries as they are all saved in an array in one object per user.
Describe the solution you'd like
A new data model that is capable of filtering and sorting would be desirable. Other factors should also be taken into account, like statistics (how many songs have been played, how many artists, how many times each song, etc).
One option, assuming MongoDB is kept, each Play entry could have its own document instead of being kept in the user's play history document. This new Play entry could store the user ID, the "played at" date, track info, album info, and artists' info.
For the album and artists' info, a smaller set of data could be kept such as ID and name. I'm not sure if this will help with the GraphQL resolver. Is it always necessary to go to the Spotify API even if the user only asks for the properties stored in the database?
Any solution for the database model will also mean changing the GraphQL schema, at the very least the resolvers to get the data.
Describe alternatives you've considered
Another alternative would be to move to a SQL DB although I'm not sure how it would handle possible scaling and statistics queries