The POST api/words/route now calls the new addNewUserWord service that takes a userword from the client and the user object res.locals and does these things:
adds new word to words table or find existing word,
adds that word's id to the userword object,
adds user id word id and status to users_words table,
adds the provided translation to translations table,
adds new translation's id to userword object's translation object
adds user id and translation id and context to users_translations table
returns the updated userword.
I also had to make changes to translation services and data-access functions to make it work.
Description
The
POST api/words/
route now calls the newaddNewUserWord
service that takes a userword from the client and the user objectres.locals
and does these things:words
table or find existing word,users_words
table,translations
table,users_translations
tableI also had to make changes to translation services and data-access functions to make it work.
Related Issue
Closes #79 Closes #76
Type of Changes
Testing Steps / QA Criteria
Please test it and tell me this works ;)