GithubHelp home page GithubHelp logo

e-core's Introduction

Solution

In order to achieve the usage of Role over the Team Members, I create two tables. The first is called Roles, where we store the role definition (id, name) and the second is called Membership Roles, where we keep the association between the Role and Membership (User in a Team).

Users that do not belong to a Team cannot have a Role, I decided this base on the definition of a Team Member.

The solutions REST are:

  • Create a new role
    • POST v1/roles - {"name":"e-code"}
      • The name is required and has a max of 20 chars.
  • Assign a role to a team member
    • POST v1/teams/{teamId}/users/{userId}/roles/{roleId} - EMPTY BODY
      • The team, user and role must exist
  • Look up a role for a membership
    • GET v1/teams/{teamId}/users/{userId}/roles
      • The team and user must exist.
  • Look up memberships for a role
    • GET v1/roles/{roleId}
      • The role must exist.

Cache

I did not have enough time to add a modern cache provider like Redis, but it's using the default one for now.

Scheduler

I created a scheduler to check if Team or User has deleted and then remove any Membership Role.

Suggestion

I believe the Membership needs to be created when a User is assigned to a Team, in short, the Membership is the product of the N:N relationship between the User and Team. Then with Membership's id, we can simplify the Role service.

Running

Requirements

  • JDK 11
  • Maven

Build Project

On the source folder run mvn clean install

Docker

The source has a docker-compose file with the DB and credentials that will speed up your test. On the source folder run docker-compose up In case you want to use your DB, please change the configuration on the application.yml

e-core's People

Contributors

lshens avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.