One of the desired features for Find A Player app is a Contacts Sync service. You would need to implement one in Elixir using standard library, OTP and couple external libraries:
- Ecto
- Oban (optional)
When user allows phone contacts access mobile app makes a POST request to API server with the following structure:
"contacts": [
{
"name": <string>
"importance_score": null | <positive int>
"phone_numbers": [
{
"phone_number": <string>
},
...
]
},
...
]
After authentication step, we would get: current_user
making request and the above payload ^
Consider the following user and phones structure in database:
Users
id |
---|
int |
UsersPhoneNumbers
phone_number | user_id |
---|---|
unique string | fk to the users table |
Come up with database table(s) to interlink users phone number with contacts, process to import contacts in a reliable way, notifying client if there are any errors in the process.
(Optional) Notify client about progress, a simple message (via phoenix pubsub topic) would suffice.
- Elixir 1.16.1
- Erlang/OTP 26.2.1
- Postgres 14