Skip to content

ifyoudieincanada/user_service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UserService

The UserService handles storage and management of Users. The required tables are as follows:

  • Users The Users table contains important information about the User such as email, username, and password. The Users table also has a belongs_to relationship with the Gender table.

    The Users table has a unique constraint on both username and email to ensure that we don't have name conflicts and that each user can only make one account. This can be circumvented by creating additional emails to register more accounts, but who really cares tbh.

    Users has_many Permissions.

  • Permissions Permissions should be a list of named permissions that other services will recognize and be able to adapt to.

    Initially, the Permissions table will be pre-loaded with admin which will be assigned to the first User to create an account. the admin User will be able to alter the permissions of other Users.

    Columns: name, the name of the permission description, a detailed description of the permission so developers of other services will be able to use these permissions effectively.

    Permissions has_many Users.

The UserService is also responsible for signing User Tokens that other services can relay to the UserService in order to ensure a User is who they say they are.

Endpoints:

  • POST /users/create The URL used to create Users.
  • GET /users/:user_id The URL to get information about a specific User.
  • POST /users/authenticate The URL that verifies a User is real with a username and password and returns a signed UserToken.
  • GET /users/:user_id?permission=":permission" When provided with a permission in the payload, it provides whether a user has this permission.
  • GET /users/:user_id/permissions Lists all permissions owned by the user
  • GET /permissions A list of all available permissions and their descriptions.
  • POST /permissions/create The URL used to create permissions

To start your Phoenix app:

  • Run setup.sh to create the required postgresql users
  • Install dependencies with mix deps.get
  • Create and migrate your database with mix ecto.create && mix ecto.migrate
  • Start Phoenix endpoint with mix phoenix.server

Now you can visit localhost:4000 from your browser.

Ready to run in production? Please check our deployment guides.

Learn more

About

Network/UserService for the Social Network API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published