Coder Social home page Coder Social logo

favorite-things's Introduction

Note: This repo was a take-away assignment submitted to a company for a job.

favorite-things

  • Folder backed contains everything related to run backend.
  • Same folder structure for frontend. Frontend is a Single Page React App.

DB schema

Database Schema

Approach

  • A new table user_category is defined to store categories defined by users.
    By default it gets populated with 3 categories ["person","place,"food"] as soon as a new user is created.

  • The most important part of the application was to reorder the list of favorite things whenever user changes category and/or ranking of the favorite things.


    This logic was developed on both frontend and backend.
    This logic was also build into frontend because the user wants to see the result of action performed by user.
    frontend makes an network request and updates the state locally because the network request may fail or may take few seconds depending on the internet connection.
    The logic is as follows:
    • only ranking is changed

      • is old rank is greater than new rank?
        • no, decrement ranking of favorite things between (old rank, new rank] and assign the new rank to the updated favorite thing
        • yes, increment ranking of favorite things between [new rank, old rank) and assign the new rank to the updated favorite thing
    • category changed

      • decrease ranking of other favorite things of old category having ranking greater than old ranking of to be updated favorite thing.
      • increase ranking of other favorite things of new category having ranking greater than new ranking of to be updated favorite thing.
      • assign category and ranking(if present else last ranking in the new category) to the favorite thing.
    • Audit logs are created on every user actions.

Deployment

  • Backend : flask-uwsgi server running on an aws ec2 instance with nginx as reverse proxy.
    I tried aws lambda and zappa but i was facing issues after deployment. I almost spend one day to trouble shoot the problems.
  • Frontend is deployed on aws s3 bucket.

Technologies

  • Backend: Python, Flask, SqlAlchemy, Alembic, pytest.
  • Frontend: JavaScript, ReactJS,React-Redux, Redux, material-ui.

Linting

  • Backend: Pycharm's inbuilt linter along with flake8.
  • Frontend: Prettier.

favorite-things's People

Contributors

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