Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MVP Domain Model + Application Core #2

Open
SophieDeBenedetto opened this issue Jun 24, 2021 · 3 comments
Open

MVP Domain Model + Application Core #2

SophieDeBenedetto opened this issue Jun 24, 2021 · 3 comments

Comments

@SophieDeBenedetto
Copy link
Collaborator

Problem Statement

From the gist we wrote up last week here https://gist.github.com/SophieDeBenedetto/4127f6fc7112d3277b04f3493e4b7ee0, we decided our MVP (Minimum Viable Product) should look something like this:

Elixir Education Resource Portal

  • Users should be able to log in
  • Users should be able to submit a resource
  • Users should be able to browse resources
  • Users should be able to search resources

The first step towards building this functionality is implementing the core modules and schemas that will represent users and resources, and map to a users database table and resources database table.

Deliverable

  • There is a users database table with some of the attributes we specified here https://gist.github.com/SophieDeBenedetto/4127f6fc7112d3277b04f3493e4b7ee0#gistcomment-3784430
  • There is a User schema implemented in our application core that maps to this database table.
  • There is a resources database table with some of the attributes we specified here https://gist.github.com/SophieDeBenedetto/4127f6fc7112d3277b04f3493e4b7ee0#gistcomment-3784430
  • There is a Resource schema implemented in our application core that maps to this database table
  • There is a relationship between the user that posts a resource and the resource: A user has many resources and a resource belongs to a user. This represents the user that posted the resource. Later we may implement some functionality for users to save or favorite resources, but not yet. So, we will need to implement this "has_many/belongs_to" relationship between these two entities.
  • There are some passing tests for the User and Resource modules that verifies the behavior of the modules.

Implementation Details

@SophieDeBenedetto
Copy link
Collaborator Author

Team User

  • Herminio
  • Jackie
  • Juliana
  • Cristine

Team Resource

  • Juan
  • Castilho
  • Grace

@SophieDeBenedetto
Copy link
Collaborator Author

How to build "user has many resources"/"resource belongs to user" relationship

This describes the relationship between a resource and the user that posted it. Later, we may build more relationships to allow users to "favorite" or "save" resources.

What column do we need to add to either table?

  • resource will have a foreign key of user_id
  • so, we will need a new migration to add this to the resources table

What schema will we need?

  • resource belongs_to user
  • user has_many resources

What roles/permissions will users need to do different actions, like:

  • Deleting a resource - You can delete a resource if you are the person who created it. Later on: an admin can do this too.
  • Editing a resource - You can edit a resource if you are the person who created it. Later on: an admin can do this too.
  • Creating a resource - Anyone can create a resource.

@SophieDeBenedetto
Copy link
Collaborator Author

SophieDeBenedetto commented Jul 1, 2021

Today:

  • Add the migration and schema changes to implement the relationship between resources and users
  • Add a link attribute to the resources table and give it a unique index. (link = URL to the resource on the web)
  • Define a context module that exposes these functions:
    • Function to create a resource that belongs to a given user.
    • There should be a test for the context and this function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant