Design notes - mgp/sharebears GitHub Wiki
Entry data type
- matcher: URL -> bool
- fetcher: public API -> model
- converter:
- serializer: model -> ORM entity
- deserializer: ORM entity -> model
- renderer: model -> HTML
Transformers
Turns [model]*
into [model]*
A transformer can take a sequence of Photo
instances and group them into a Slideshow
instance composed of those photos.
Where in the pipeline should they be introduced? Upon writing or reading Post
instances?
URL types
Message format
Loosely it's:
([text]? [url])+ [text]? [hashtag]*
Rules:
- There must be at least one
url
- There must be at least one
text
- Consecutive
url
tokens that are images will collapse into a slideshow/carousel
Entity types
User
id
(pk)
GoogleUser
user_id
(fk)google_id
(pk)
Post
id
(pk)creator
(fk)created_time
num_stars
data
Must create an index on (created_time, id)
to efficiently return all posts sorted by time.
HashTag
post_id
(fk, pk)hashtag
(pk)created_time
This allows returning all hash tags for a post. To show all posts, sorted by time for a given hash tag, index on (hashtag, created_time, post_id)
.
StarredPost
post_id
(fk, pk)user_id
(fk, pk)created_time
This allows returning all users that starred a post. To show all starred posts sorted by time for a given user, index on (user_id, created_time, post_id)
.