For the registration user in system he needs to enter his number phone and name.
If user with enterred data hasn't existed yet then notify user about a success registration in the system, also return him an unique key that will be used for future requests to the server
If wroted number phone by user has already existed then we notify user about a failure registration in the system and navigate him to the login screen
We have a two cases login user to system
-
Login by generated unique id
TranslatorApp is storing unique id in local storage. It unique id user got from server after success register or login.
When we launch app then do request on server and send unique id.
If unique id will be find in the server database then we navigate user to main screen app.
If unique id is lost, we can use the second case -
Login by number phone and user name If unique id is lost (cached data on device is cleared) we can use in this way for login to system.
When we this request we will should to send name and phone
If user sent correctly data(wrote name and number phone was founded in the server database) then server will send unique id for further communication with server
If user will want to auth in system(register or login to account) then all words on user device will be send to server for synchronization.
Server will need to receive them and save to remote storage
- Translate words when user already auth in system
Translated words will be save on server and will be cache on user device
Synchronization not needs
Request: baseUrl/syncWords/UniqueKey
Param: wordsJson
Value:
{
"words" : [{
"src":"Ноутбук",
"translated":"Laptop"
}, {
"src":"Кнопка",
"translated":"Button"
}]
}
Response:
{
"mark": "Success",
"message": "Success sync words"
}
Request: baseUrl/users/UserName/words
Response:
{
"user_name": "UserName",
"user_words": [
{
"src": "Ноутбук",
"translated": "Notebook"
},
{
"src": "Пентхаус",
"translated": "Penthouse"
}
]
}
1.Delete all translated words by user unique key
Request: baseUrl/deleteWords/UniqueKey
Response:
{
"mark": "Success",
"message": "Words were deleted"
}
2.Delete certain translated word by user unique key
Request: baseUrl/deleteWord/UniqueKey
Param: translatedWord, value: Home
Response:
{
"mark": "Success",
"message": "Home deleted"
}
Request: baseUrl/users
Response:
{
"users": [
"FirstUser",
"SecondUser"
]
}
Request: baseUrl/users/UserName/words
Response:
{
"user_name": "UserName",
"user_words": [
{
"src": "Дом",
"translated": "House"
},
{
"src": "Телефон",
"translated": "Phone"
}
]
}
Base url: https://uehuf.pythonanywhere.com