← Back to team overview

launchpad-dev team mailing list archive

Re: "thanks" microservice

 

On Tue, Nov 29, 2011 at 12:51 PM, Martin Pool <mbp@xxxxxxxxxxxxx> wrote:

> Inspired by the notification description here is how I think this
> could work as a microservice:
>
> There is a button ("thanks" or thumbs up) on various objects for which
> someone might express appreciation: ppas, products, bugs, bug
> comments, mp comments, etc.
>
> There is a table in a separate service of (person_name, person_url,
> thanked_url).

I think what you want is (object id, object id) - with SOA object
references (which are still subject to refinement) - otherwise you'll
be in the business of updating thanks rows on every user rename, which
isn't a terribly interesting thing to do.

I also have some suggested tweaks to the API:

> There is a microservice that provides these operations:
>
>  give_thanks(person_name, person_url, url) - add a row

-> give_thanks(object id[person], object id[thanked thing])

>  get_thanks(person, url) - called by this person (or null), return
>    - whether the current user thanked that object
>    - how many people thanked it in total
>    - a possibly truncated list of some people who thanked it

This should be set based - eg.
get_thanks (object id[current user], object ids[multiple things to check]):
 returns a list of (object id checked, did-current-user-thank,
total-thanks, [object ids of some thankers])

> There are thin api shims in the webapp that pass external requests
> through to the service after
  - mapping the current user to a obj id
  - checking the current user has access to the relevant urls

And so forth - rather than querying each comment, query them all.
Rather than querying each bug in a bug listing, query them all.


> I don't think this is the most important thing at the moment but I
> thought I'd write it down while it's fresh and while we're talking
> about that sort of thing.

I think it looks quite nice as a concept. Maybe ratings and reviews
has some need for this (or an in-house implementation they'd be
interesting in dropping and migrating onto a common service?)

-Rob


Follow ups

References