Skip to content

Instantly share code, notes, and snippets.

@y-nk
Created August 19, 2020 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save y-nk/a2ba7a3ca5e98234d5651442e90b51eb to your computer and use it in GitHub Desktop.
Save y-nk/a2ba7a3ca5e98234d5651442e90b51eb to your computer and use it in GitHub Desktop.
{
post: {
postId: 'postId',
data: {
images: [{
postId: 'childPost',
fileId: 'imageId',
}]
},
parentId: 'parentId',
},
reactions: [{
}],
users: [{
}],
comments: [{
}],
}
// -----------------------------------
GET /post/postId
-> the post
-> all reactions belong to post
-> all users belong to post
-> all comments belong to post
-> all children of post
UPDATE /post/postId
-> the post
-> parent post or all children of post
DELETE /post/postId
-> all mutated posts
childrenPosts = parentPost.children.map(id => postRepo.findById(id))
{
post: [
{
postId: 'parentId',
data: {
text: '',
},
children: ['child1'],
},
{
postId: 'child1',
data: {
imageFileId: 'img'
}
parentId: 'parentId',
}]
reactions: [{
}],
users: [{
}],
comments: [{
}],
}
GET /v3/xxx-feed
{
feedOrder: [id1, id2]
posts: [
]
}
// ----------------------------------------------------------------------------------------
{
post: {
postId: 'parentId',
data: {
images: [{
postId: 'postId',
fileId: 'imageId',
}]
}
},
reactions: [{
}],
users: [{
}],
comments: [{
}],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment