Translator App Server

Features

1. Authentication on server

Register user in system

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

How to Login user in the system?

We have a two cases login user to system

  1. 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

  2. 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

2. Synchronization local and remote words

User can use our app without auth there. \n We have two cases: 1. Translate words in app without auth in system Translated words will be save to local storage on user device

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
  1. 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"
}

3. Fetching user words by his name

Request: baseUrl/users/UserName/words
Response:

{
    "user_name": "UserName",
    "user_words": [
        {
            "src": "Ноутбук",
            "translated": "Notebook"
        },
        {
            "src": "Пентхаус",
            "translated": "Penthouse"
        }
    ]
}

4. Delete translated words

Two away
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"
}

5. Fetch all users which is authorized in system

Request: baseUrl/users
Response:

{
    "users": [
        "FirstUser",
        "SecondUser"
    ]
}

6. Fetch all translated word user by his name

Request: baseUrl/users/UserName/words
Response:

{
    "user_name": "UserName",
    "user_words": [
        {
            "src": "Дом",
            "translated": "House"
        },
        {
            "src": "Телефон",
            "translated": "Phone"
        }
    ]
}

API

Base url: https://uehuf.pythonanywhere.com