Skip to content

Add navbar #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"semi": false
}
18 changes: 9 additions & 9 deletions models/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ const dompurify = createDomPurify(new JSDOM().window)
const articleSchema = new mongoose.Schema({
title: {
type: String,
required: true
required: true,
},
description: {
type: String
type: String,
},
markdown: {
type: String,
required: true
required: true,
},
createdAt: {
type: Date,
default: Date.now
default: Date.now,
},
slug: {
type: String,
required: true,
unique: true
unique: true,
},
sanitizedHtml: {
type: String,
required: true
}
required: true,
},
})

articleSchema.pre('validate', function(next) {
articleSchema.pre('validate', function (next) {
if (this.title) {
this.slug = slugify(this.title, { lower: true, strict: true })
}
Expand All @@ -44,4 +44,4 @@ articleSchema.pre('validate', function(next) {
next()
})

module.exports = mongoose.model('Article', articleSchema)
module.exports = mongoose.model('Article', articleSchema)
Loading