alexandria-reader / backend

Alexandria reading app back end
https://tryalexandria.com/
6 stars 1 forks source link

When updating translations, properties are sent back in snake_case and the context is not being sent to the frontend #131

Closed eamon0989 closed 2 years ago

eamon0989 commented 2 years ago

The properties of updated translations are being sent in snake_case, they need to be converted to camelCase before being sent to the frontend.

The context is not being sent back from the server when a translation is updated.

mrchrmn commented 2 years ago

The context is not part of the translation. It is part of the connection between user and translation. Do you need the original context back?

eamon0989 commented 2 years ago

If possible that would be great. Then it greatly simplifies frontend logic as I can just swap to updated translation object with the old one.

mrchrmn commented 2 years ago

OK, you want a UserTranslation object back. Got it. Slightly more complicated.

mrchrmn commented 2 years ago

What are you sending to the server for a translation update? A UserTranslation, ie. translation + potentially changed context? Or just a Translation? Does the context always remain the same, ie. from the first encounter?

eamon0989 commented 2 years ago

The context always stays the same, it's set when a user first adds a translation and is always linked to that object, event if the user changes the translation.

Here's an example of what is being sent:

{ 
  context: "SONDAGE - Selon un sondage Odoxa-Backbone Consulting pour Le Figaro, les Français 
    seraient 59% à être d'accord avec Emmanuel Macron, mais le jugent «brutal» (59%) et moins 
    «proche des gens» (74%)."
  id: 35
  targetLanguageId: "en"
  translation: "judge"
  wordId: 19
}