GithubHelp home page GithubHelp logo

url-shortner's People

Contributors

mmattax avatar

Watchers

 avatar  avatar

url-shortner's Issues

Build out PUT /api/urls/:id

Allow the url field to be changed. Because (account_id, url) is unique, we'll need to check for an existing url before we update.

TBD: When a url is changed, should we reset visit_count and delete the visit records?

Build out /:slug

  • Insert a visits record
  • Increment url.visit_count
  • 302 to the destination url

We should be careful when incrementing url.visit_count. Write the SQL to perform the update atomically:

update visit_count = visit_count + 1 where id = ?

Build out /api/urls/:id/analytics

  • Should support date filtering: start, end
  • Allow date sorting direction ?sort=asc|desc
  • Don't worry about paging for now

Response should look something like:

{
    total_visits: 2344,
    total_unique: 1567,
    visits: [
      {
        date: '2020-04-26'
        total: 345,
        unique: 298
      },
      ...
    ]
}

Queries look something like:

Total:

select date(created_at) as d, count(*) from visits where created_at >= $start and created <= $end group by d

Unique:

select date(created_at) as d, count(unique(vistor_fingerprint)) from visits where created_at >= $start and created <= $end group by d

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.