Skip to content

Instantly share code, notes, and snippets.

@sysashi
Created February 5, 2024 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sysashi/63726304db3d33a41be57c79aba24189 to your computer and use it in GitHub Desktop.
Save sysashi/63726304db3d33a41be57c79aba24189 to your computer and use it in GitHub Desktop.
Find A Player Test Project

Overview

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

Task

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.

Current Software Versions

  • Elixir 1.16.1
  • Erlang/OTP 26.2.1
  • Postgres 14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment