Created a User class and extended the functionality of DbClient and DbItem to make writing/reading from database easy.
DbClient
DbClient now has the ability write to database
The write comes in the form of either a replacement (if the object exists, replace it, if not insert)
This will hopefully reduce duplication (but it is unavoidable if two queries happen at the same time for a song and the two objects are created from those queries, they will have no way of knowing if one writes or not)
To eliminate duplication we can either keep an in-memory map through redis... can help with caching too OR we can just run a script every hour to delete dupes
DbClient can delete from the database
DbItem
Contains a writeToDatabase function to make it easy for the class to write from itself
Contains a removeFromDatabase function to make it easy to delete the item from the db
User
Complete class with fromId and verifyRequest.
fromId - Checks to see if a user exists in the database and if so, it returns a user object.
const user = await User.fromId(id);
verifyRequest - Verify the user exists in the database and that the refresh token match
Thanks for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).
Features
Created a
User
class and extended the functionality ofDbClient
andDbItem
to make writing/reading from database easy.DbClient
DbItem
writeToDatabase
function to make it easy for the class to write from itselfremoveFromDatabase
function to make it easy to delete the item from the dbUser Complete class with
fromId
andverifyRequest
.fromId
- Checks to see if a user exists in the database and if so, it returns a user object.verifyRequest
- Verify the user exists in the database and that the refresh token matchLinter Changes
_
as a prefix to the nameBreaking Changes
Moved config dir to
/opt/oracle/instantclient
because we switched over the instance and ubuntu needs access to the file through sudo.Fixes #8