Skip to content

Latest commit

 

History

History
52 lines (43 loc) · 1.59 KB

README.md

File metadata and controls

52 lines (43 loc) · 1.59 KB

Models


User

field data_type constraints
id ObjectId autogenerated
email string required and unique
firstname string required
lastname string required
password string required
repeatPassword string required
blogs ObjectId generated on creation
user_type string required, default: user, enum: ["user", "admin"]
createAt Date autogenerated
updatedAt Date autogenerated

Blog

field data_type constraints
id ObjectId autogenerated
title string required and unique
description string required
owner string generated on creation
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.