KristerV / heliumpay-budgetweb-backend

2 stars 2 forks source link

Proposals / Background Sync #29

Open jschr opened 7 years ago

jschr commented 7 years ago

Overview

Users will need to browse active proposals. To avoid pulling from the cli on each request, a background process needs to be created that will fetched proposals every minute and sync them to the database.

This will also make the app more scalable since we can keep the background sync separate from the web servers.

Proposals will also need to be associated with a user so we will need to store that association.

Storing proposals will also let us generate a url-friendly slug based on the title to allow the frontend to present clean, memorable and seo-compatible urls: https://www.dashcentral.org/p/texas-btc-conf

API

GET   /proposals              -> all proposals
GET   /proposals?slug=:slug   -> proposals matching slug
GET   /proposals/:id          -> single proposal
GET   /proposals/:id/comments -> all comments for proposal

Schema

proposal
  id: pk
  slug: string # unique, case-insensitive, url-safe name (ie. heliumlabs.org/proposals/my-proposal-slug)
  hash: string # stores propsal.hash returned by the cli
  userId: fk -> user.id # owner
  title: string
  description: string
  ...

References

KristerV commented 7 years ago

yeah i agree with all of it. Moved to v2.0 project.