---
# System prepended metadata

title: Forum happ

---

# Forum happ

> Note: this is a very minimal design for an application. Usually you'll need more DNA/zomes and complexity to cover all that you need to cover your use case

[TOC]

# Requirements
- Normal post sharing app, with no upvoting of any kind
- Only authors can update their posts
- UI should be able to query by time range

# DNAs

## Forum DNA

- Membrane: open membrane, anyone can join.

### Posts zome 

Entry Relationship Diagram:

```graphviz
digraph g {

node [
fontsize = "16"
shape = "record"
];
// Maybe this with timestamp mods?
"path1" [label = "{Path | 'all_posts'}"];
"path2" [label = "{Path | 'all_posts.2021'}"];
"path3" [label = "{Path | 'all_posts.2021.01'}"];
"path4" [label = "{Path | 'all_posts.2021.01.18'}"]; 
"path5" [label = "{Path | 'all_posts.2021.01.19'}"]; 

"path1"->"path2" [label="child"]
"path2"->"path3" [label="child"]
"path3"->"path4" [label="child"]
"path4"->"path5" [label="child"]
"alice" [label="{AgentPubKey | 'ALICE_PUB_KEY'}"]
"post1" [label="{Post | { content | author | timestamp  }}"]
"post2" [label="{Post | { content | author | timestamp  }}"]
"alice"->"post1" [label="authored_post"]
"alice"->"post2" [label="authored_post"]
"path4"->"post1"
"path5"->"post2"
"post1"->"alice" [style="dashed"]
"post2"->"alice" [style="dashed"]
}
```

When querying by time, you can first get all the paths that are 

#### Validation

Entries

* `posts`:
  * Create:
      * Check that the author of the element matches the author field inside the post entry. is valid if the post's author is signing the entry
  * Update or Delete:
      * Check that  is valid if the author of the update or delete element matches the author of the original element. action is the author of the original post

Links
* `path->post`:
  * CreateLink and DeleteLink: 
      * Get target post of link
      * Check that post.author matches link.author

#### Signals
- Every time someone likes your post, the UI will receive a signal: 
```
{
  "post_hash": <POST_HASH>,
  "agent_pub_key": <AGENT_PUB_KEY>,
  "action": "LIKE"
}
```
