Page MenuHomePhabricator
Paste P2117

Test
ActivePublic

Authored by andytruong on Jul 9 2019, 10:40 AM.
Tags
None
Referenced Files
F6570413: raw.txt
Jul 9 2019, 10:40 AM
Subscribers
None
## database structure
### tadaa_stream
- id < uint, autoincrease
- title < string: Event type
- created < int: UNIX timestamp
- payload < blob
### tadaa_deals
- uuid < string: local ID of curated deal
- title < string: Short description of
- provider_uuid < string
- cateory_uuid < string
- tags < []string
- discount < Discount
- image < url: For deal preview.
### tadaa_deal_categories
- uuid < string
- slug < string
- title < string
### tadaa_users
- uuid < string: If of our system user.
- status < smallint
- -1: Blocked
- 0: Unsubscribed
- 1: Active
- message_pid: Message user PID we can use to send message to.
### tadaa_subscription
- category_uuid < string
- user_uuid < string
## Use cases
### User starts the journey
```
{
"title": "tadaa/messeneger.start:v1",
"created": int,
"data": {
"psid": int,
"text": ?string
}
}
```
### User unsubscribes
```
{
"title": "tadaa/messeneger.end:v1",
"created": int,
"actor": "user",
"data": {
"psid": int,
"text": ?string,
}
}
```
### Failed to delivery message to user > Handle error > Auto unsubscribe if user already delete the thread.
Commit this event to stream:
````
{
"title": "tadaa/messeneger.end:v1",
"created": int,
"actor": "system",
"data": {
"psid": int
}
}
```