这是添加待办事项功能的代码
const addtodo = (req, res) => {
const { item } = req.body;
const email = req.session.user.email;
lists
.create({ item, email })
.then((result) => {
console.log(result + " added");
return res.redirect("/");
})
.catch((err) => {
console.log(err);
});
};
在上面的代码中,“列表”是数据库中的一个表,其中包含将在todo应用程序中添加的项目列表。我正在为此使用SQLite。
我在这里做错什么了吗?我查看了各个站点,但没有得到解决方案
以下是我在控制台中收到的错误消息
errors: [
ValidationErrorItem {
message: 'lists.edit cannot be null',
type: 'notNull Violation',
path: 'edit',
value: null,
origin: 'CORE',
instance: [lists],
validatorKey: 'is_null',
validatorName: null,
validatorArgs: []
},
ValidationErrorItem {
message: 'lists.done cannot be null',
type: 'notNull Violation',
path: 'done',
value: null,
origin: 'CORE',
instance: [lists],
validatorKey: 'is_null',
validatorName: null,
validatorArgs: []
}
]
}