You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.0 KiB
57 lines
1.0 KiB
const mongoose = require('mongoose');
|
|
|
|
//trim pour supprimer les espaces
|
|
const postSchema = new mongoose.Schema(
|
|
{
|
|
postedId: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
message: {
|
|
type: String,
|
|
maxlength: 250,
|
|
trim: true
|
|
},
|
|
lien: {
|
|
type: String,
|
|
required: true,
|
|
trim: true
|
|
},
|
|
likers: {
|
|
type: [String],
|
|
required: true
|
|
},
|
|
tags: {
|
|
type: [String],
|
|
required: true
|
|
},
|
|
image:{
|
|
type: String,
|
|
},
|
|
|
|
publique: {
|
|
type: Boolean
|
|
},
|
|
privee: {
|
|
type: Boolean
|
|
},
|
|
comments: {
|
|
type: [
|
|
{
|
|
commentId: String,
|
|
commentPseudo: String,
|
|
text: String,
|
|
timestamp: Number
|
|
}
|
|
],
|
|
required: true,
|
|
}
|
|
},
|
|
{
|
|
timestamps: true,
|
|
}
|
|
);
|
|
|
|
const PostModel = mongoose.model("post", postSchema);
|
|
|
|
module.exports = PostModel; |