Skip to content

Latest commit

 

History

History
51 lines (40 loc) · 2.07 KB

README.md

File metadata and controls

51 lines (40 loc) · 2.07 KB

Models


User

field data_type constraints
id ObjectId autogenerated
email string required and unique
firstName string required
lastName string required
passWord string required
blogs ObjectId generated on creation
createAt Date autogenerated
updatedAt Date autogenerated

Blog

field data_type constraints
id ObjectId autogenerated
title string required and unique
description string required
author objectId generated on creation
state string required, default: draft, enum: ["draft", "published"]
readCount number default: 0, autoincrements on get request
readingTime Number generated on creation
tags string optional
body string required
createAt Date autogenerated
updatedAt Date autogenerated

Explanation of Some Fields

  • owner: the author of the blog that is used to query by author.
  • readCount: the number of times the blog was visited.
  • readTime: time taken to read the blog. The algorithm used is shown below:
200 words = 1 minute
1 word = 1/200 minute
(title + description + body) = total words
total words will take `total words / 200 minutes`
  • tags: these are various categories the blog falls under. e.g #entertainment, #sports etc.