# Profile Zome
## User Stories
* As an unregistered user, I want to sign up using my email_address so that I can tie up my account to my email_address
* This user stories is currently not being met as username is the only identifiable information being stored on dht
## Entry Structure
This first anchor type is from [holochain_anchors](https://github.com/holochain/holochain_anchors)
```rust
// Can have a Profile Entry that can dynamically store profile fields
Entry "anchor" {
struct Anchor {
anchor_type: String,
anchor_text: Option<String>
}
}
Entry "username"
struct Username {
username: String
}
Links: {
anchor->username|username_<INITIAL>|
anchor->username|usernames|
agent_id->username|username|
}
}
```
Anchors will contain this:
```rust
// This anchor will link to all usernames
{
anchor_type: "USERNAMES"
anchor_test: "USERNAMES"
}
// This anchor will link to usernames with certain initials
{
anchor_type: "USERNAME_<INITIAL_OF_USERNAME>",
anchor_text: "USERNAME_<INITIAL_OF_USERNAME>"
}
.
.
.
example
{
anchor_type: "USERNAME_a",
anchor_text: "USERNAME_a"
}
{
anchor_type: "USERNAME_b",
anchor_text: "USERNAME_b"
}
// The username filter anchor will automatically be
// generated when an agent registers a profile that
// has an inital that is not yet existing.
// BETTER IMPLEMENTATION: (not yet sure if updated)
// https://github.com/willemolding/holochain-collections
```
## Entry Relationship Diagram
```mermaid
graph TD
subgraph profile_zome
subgraph anchors
usernames
usernames_a
end
subgraph username
usernames_a-->|username|alice_1
usernames-->|username|alice_1
end
subgraph agents
alice_id-->|username|alice_1
end
end
```
## Validation
### Entries
* `anchors`:
* Update/Delete is not valid
* create is always valid
* `username`
* update/delete is valid if the address of the agent committing the entry is the same with the agent address of the author of the entry
* create is valid only once when username doesn't exist yet for the authoring agent (Currently being checked at commit time)
* create is only valid when there is no same entry exisiting (Currently being checked in commit time)
### Links
* `anchor->username`
* only valid when the agent is signing
* RemoveLink valid if the author of the entry is removing
## [Zome functions(Outdated)](https://hackmd.io/9SsMD9TBSTSLcTyXXWcF2w)