Last active
July 28, 2017 09:41
-
-
Save stalniy/f70a8f0aac905ae8281b3c34477f769a to your computer and use it in GitHub Desktop.
Blog app feathers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (app) { | |
const mongooseClient = app.get('mongooseClient'); | |
const { Schema } = mongooseClient; | |
const Comment = new Schema({ | |
author: { type: Schema.Types.ObjectId, ref: 'users', required: true }, | |
post: { type: Schema.Types.ObjectId, ref: 'posts', required: true }, | |
text: { type: String, required: true }, | |
}, { | |
timestamps: true | |
}); | |
return mongooseClient.model('comments', Comment); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (app) { | |
const mongooseClient = app.get('mongooseClient'); | |
const { Schema } = mongooseClient; | |
const Post = new Schema({ | |
author: { type: Schema.Types.ObjectId, ref: 'users', required: true }, | |
title: { type: String, required: true }, | |
text: { type: String, required: true } | |
}, { | |
timestamps: true | |
}); | |
return mongooseClient.model('posts', Post); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment