Git Product home page Git Product logo

investor_marketplace's Introduction

Investor Marketplace

Instructions setup and run this Phoenix application

  • git clone [email protected]:fmarkwong/parallel_markets.git
  • cd parallel_markets
  • Make sure you have PostgreSQL running locally and check in config/dev.exs that the db parameters are correct
  • Install dependencies with mix deps.get
  • Create and migrate your database with mix ecto.setup
  • Install Node.js dependencies with cd assets && npm install
  • Start Phoenix endpoint with mix phx.server in project root directory

Now you can visit localhost:4000 from your browser.

The new investor form is at "/". File uploads are stored at uploads directory at the root of this project.

New Investor Creation Application

Architecture

Database tables

users: has_one investor, has_many uploads

  • first_name
  • last_name
  • dob
  • phone
  • address
  • state
  • zip

investors: belongs_to user

  • user_id

uploads: belongs_to user

  • filename
  • size
  • content_type
  • user_id

Phoenix architecture

The app is called ParallelMarkets and has three contexts

  • Accounts which just has an User schema
  • MarketPlace which has an Investor schema
    • User and Investor have a 1-to-1 relationship. The idea is an Investor is a "type" of User. We put all the attributes that are universal to all users of the system in User and for any attributes that are exclusive to Investors we place there. In this case, it happens that all the required specified attributes seem to belong in User so Investor only has a user_id to relate it to it's User. For example, if we find if we find later that investors need something like an investment account number, that would go in the Investor schema. In this way, we have a specialized schema for each type of user in our system (others could be Partner, Admin, etc.). This makes user related code more expressive, makes authorization easier and helps seperate concerns.
  • Documents which has an Upload schema to store our uploaded file information.

The only controller is investor_controller which has new and create actions to render our new investor form and create one upon submit.

And last is the corresponding investor view and template for the form itself.

The path where uploads are stored on the server is set in config/dev as parallel_markets.uploads_directory

Done

  • All basic functionality works. At localhost:4000, a new investor form is shown where upon you enter investor info and select a file to upload. Upon submission, a success alert is shown, the file is saved to the server's file system and a new form is shown ready to create another investor.
  • Error reporting for empty form fields
  • Increased max upload file size to 20MB

Things I would have like to do/fix if more time

  • I took a shortcut for handling the error alert when the user submits without an upload file. See the comment at MarketPlace#create_investor for details
  • Tests. Very important, but didn't have time.
  • Authentication and authorization
  • Form field validation
  • Implement the frontend with Phoenix LiveView. SPA-like UI with no JavaScript ftw!

investor_marketplace's People

Contributors

fmarkwong avatar

Watchers

 avatar  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.