-
Notifications
You must be signed in to change notification settings - Fork 0
APIs
Kohei Asai edited this page Apr 5, 2020
·
15 revisions
- Get post(s)
- Create a post
- Get answer(s)
- Create an answer to a post
- Delete an answer from a post
- Get comment(s)
- Create a comment to an answer
- Delete a comment from an answer
- Check if liked/disliked an answer
- Like or dislike an answer
- Undo like or dislike an answer
- Check if liked/disliked a comment
- Like or dislike a comment
- Undo like or dislike a comment
TBD
TBD
TBD
Create a Firestore document to /posts/{postId}/answers/{answerId}.
- Needs to be authenticated
| Key | Type | Conditions |
|---|---|---|
post |
Reference | It must point to the parent document (/posts/{postId}). |
user |
Reference | It must point to the request user itself (/users/{userId}). |
body |
String | It needs to be more than or equal 8 character length and less than 65536 character length. |
likes |
Integer | It must be 0. |
dislikes |
Integer | It must be 0. |
createdAt |
Timestamp | It must be FieldValue.serverTimestamp()
|
Delete a Firestore document at /posts/{postId}/answers/{answerId}.
- Needs to be authenticated
- The target answer's
useris the request user
TBD
Create a Firestore document to /posts/{postId}/answers/{answerId}/comments/{commentId}.
- Needs to be authenticated
| Key | Type | Conditions |
|---|---|---|
answer |
Reference | It must point to the parent document (/posts/{postId}/answers/{answerId}). |
user |
Reference | It must point to the request user itself (/users/{userId}). |
body |
String | It needs to be more than or equal 8 character length and less than 65536 character length. |
likes |
Integer | It must be 0. |
dislikes |
Integer | It must be 0. |
createdAt |
Timestamp | It must be FieldValue.serverTimestamp()
|
Delete a Firestore document at /posts/{postId}/answers/{answerId}/comments/{commentId}.
- Needs to be authenticated
- The target comment's
useris the request user
TBD
Create a Firestore document to /posts/{postId}/answers/{answerId}/reactions/{auth.uid}.
- Needs to be authenticated
| Key | Type | Conditions |
|---|---|---|
answer |
Reference | It must point to /posts/{postId}/answers/{answerId}. The document that the reference points to needs to exists. |
user |
Reference | It must point to /users/{auth.uid}. |
type |
"LIKE" or "DISLIKE"
|
"LIKE" to like or "DISLIKE" to dislike. |
Delete the Firestore document at /posts/{postId}/answers/{answerId}/reactions/{auth.uid}.
- Needs to be authenticated
app
.firestore()
.collection("posts")
.doc(post.id)
.collection("answers")
.doc(answer.id)
.collection("comments")
.doc(comment.id)
.collection("reactions")
.doc(user.id)
.get();- Needs to be authenticated
| Key | Type | Conditions |
|---|---|---|
user |
Reference | The user who liked/disliked the comment. It should point the request user. |
type |
"LIKE" or "DISLIKE"
|
"LIKE" to like or "DISLIKE" to dislike. |
Create a Firestore document to /posts/{postId}/answers/{answerId}/comments/{commentId}/reactions/{auth.uid}.
- Needs to be authenticated
| Key | Type | Conditions |
|---|---|---|
comment |
Reference | It must point to /posts/{postId}/answers/{answerId}/comments/{commentId}. The document that the reference points to needs to exists. |
user |
Reference | It must point to /users/{auth.uid}. |
type |
"LIKE" or "DISLIKE"
|
"LIKE" to like or "DISLIKE" to dislike. |
Delete the Firestore document at /posts/{postId}/answers/{answerId}/comments/{commentId}/reactions/{auth.uid}.
- Needs to be authenticated