Project Message Board

Hello, i trying to pass in the test " You can send a POST request to /api/threads/{board} with form data including text and delete_password . The saved database record will have at least the fields _id , text , created_on (date & time), bumped_on (date & time, starts same as created_on ), reported (boolean), delete_password , & replies (array)."

my code is:
//Mongoose Schema and Model Database
const repliesSchema = mongoose.Schema({
“text”: {type: String, required: true},
“delete_password”: {type: String, required: true},
“created_on”: {type: Date, required: true},
“reported”: {type: Boolean, default: false}
const Replies = mongoose.model(“Replies”, repliesSchema);

const threadSchema = mongoose.Schema({
	"board": String,
	"text": String,
	"delete_password": String,
	"created_on": {type: Date},
	"bumped_on": {type: Date},
	"reported": {type: Boolean, default: false}, 
	"replies": [repliesSchema],
	"replycount": {type: Number, default: undefined}

const Thread = mongoose.model("Thread", threadSchema);

//POST request and save in the database
.post(async(req, res) => {
let theBoard = req.body.board;
if(!theBoard) {
theBoard = req.params.board;
let newThread = new Thread({
board: theBoard,
text: req.body.text,
delete_password: req.body.delete_password,
created_on: new Date().toUTCString(),
bumped_on: new Date().toUTCString(),
replies: ,
reported: false

For me it is working fine, the request is saved in the database but the test keep failing. Anyone can help me and figure out what is happening?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.