Blog Module
feature
- basic blog attribute similar to aia-one cms
- have to login to fetch data
- fetch comments per blog
- fetch likes per blog
- comment on blog
- allow multiple submit per user
- cannot edit
- cannot delete
- like the blog
- only once per user
- either like / remove like
- subscribe blog section
- only once per user
- either subscribe / unsubscribe
- control blog visibility by field
publishStartTime
& publishEndTime
( for Scheduled ) / isDeleted
- only text based content is allowed
schema for comments
{
userId: ( ObjectId ),
content: ( html string ),
createdAt: ( date ),
}
schema for likes
{
_id: false,
userId: ( ObjectId ),
createdAt: ( date ),
}
schema for subscribers
{
_id: false,
userId: ( ObjectId ),
email: (string)
createdAt: ( date ),
}
schema for blog
{
// Basic Attribute
_id: ,
content: ( multi_lang html string ),
title: ( multi_lang string ),
author: ( multi_lang string ),
coverImage: ( url string ),
publishStartTime: ( date ),
publishEndTime: ( date ),
isDeleted: ( boolean ),
viewCount: ( number ),
tags: [ (string) ],
// Additional Feature
comments: [ ( schema for comments ) ],
likes: [ ( schema for likes ) ],
// Access Control
roleCanAccess: [ (sting) ]
// subscriber ( special record only contain _id & subscribers field )
subscribers: [ ( schema for subscribers ) ],
}
Business logic to impletement
// basic crud method
function getList() =>
function getOne() =>
function updateOne() =>
function disableOne() =>
// additional feature
function handleComment() =>
function handleLike() =>
function handleSubscribe() =>