Skip to content
This repository was archived by the owner on Sep 3, 2021. It is now read-only.

Commit c63d12f

Browse files
authored
Update README.md
1 parent 223a0c5 commit c63d12f

File tree

1 file changed

+140
-2
lines changed

1 file changed

+140
-2
lines changed

README.md

+140-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,140 @@
1-
# realm-tutorials
2-
MongoDB Realm Tutorials
1+
# Task Tracker Tutorial
2+
3+
## Open Questions
4+
5+
- Do we need to emphasize MDBRealm first in tutorials or can we make it a later step?
6+
- What is the status of embedded objects in Realm DB?
7+
- Sample data generation scripts/functions
8+
- Do sync rules allow `%function` in Apply When expressions?
9+
- Do sync rules allow `%%root` in Apply When expressions? (probably not)
10+
11+
12+
## Frontend Tutorial Flow
13+
14+
0. Tracker App Introduction
15+
1. Data Model Explanation
16+
17+
Web:
18+
19+
2. Create a Realm App
20+
3. Define Realm Schemas
21+
4. Enable Auth
22+
5. Define Rules
23+
6. Use create-react-app to setup
24+
7. Add auth
25+
8. Add GraphQL
26+
9. Add "sync" with subscriptions
27+
28+
Mobile:
29+
30+
2. Set up project in XCode/Android Studio
31+
3. Add dependencies w/ CocoaPods/Gradle
32+
4. Explain how the pre-made UI is wired up
33+
5. Define RealmObject Models
34+
6. Hook up UI to models
35+
7. Create a Realm App
36+
- Enable Auth
37+
- Enable and Configure Sync
38+
- Enable Dev Mode
39+
8. Add auth to client
40+
9. Delete local realm and open a synced realm
41+
10. Back to the app
42+
- Define rules
43+
- Turn off dev mode
44+
45+
## Application Flow
46+
47+
1. Enter app and see a list of `Project`s (or create a new one)
48+
2. The next view shows the project detail, i.e. a list of tasks
49+
- Each task is a line item that shows the task name and its status
50+
- Assigned tasks show the avatar of the assignee
51+
- List should be sorted by status
52+
- action: add a member
53+
3. Tasks show a detail modal/screen with actions on click/tap
54+
- action: change the task status
55+
- action: change the task assignee
56+
57+
## PartitionKey
58+
59+
- Project ID
60+
61+
## List
62+
63+
function getUsersForProject() {
64+
65+
}
66+
67+
```ts
68+
type ProjectBoard = {
69+
_id: ProjectID;
70+
_partition: ProjectID;
71+
name: String;
72+
// isPrivate: Boolean;
73+
users: User[]
74+
}
75+
type ProjectID = ObjectID;
76+
```
77+
78+
## Task
79+
80+
```ts
81+
type Task = {
82+
_id: ObjectID;
83+
_partition: ProjectID;
84+
assignee: User | null;
85+
status: TaskStatus;
86+
description: String;
87+
watchers: UserID[];
88+
}
89+
90+
enum TaskStatus {
91+
Open,
92+
InProgress,
93+
Complete,
94+
}
95+
```
96+
97+
## User
98+
99+
- Read-only on clients
100+
- Must use a function to update
101+
102+
```ts
103+
type UserID = String
104+
type User = {
105+
_id: ObjectID;
106+
_partition: UserID;
107+
id: UserID;
108+
name: String;
109+
image: String;
110+
projects: String[];
111+
}
112+
```
113+
114+
## Roles
115+
116+
### Tasks
117+
118+
- IsInMyProject (ReadWrite)
119+
{
120+
"%%user.projects": "%%partition"
121+
}
122+
- IsPublic (ReadOnly)
123+
{ "%%true": true }
124+
<!-- {
125+
"%%false": {
126+
"%function": {
127+
name: "IsPrivateProject",
128+
arguments: ["%%partition"]
129+
}
130+
}
131+
} -->
132+
133+
### Users
134+
135+
- IsThisUser
136+
{
137+
"%%user.id": "%%partition"
138+
}
139+
140+

0 commit comments

Comments
 (0)