在我的Todo应用程序中,添加todo功能不起作用吗?

时间:2020-07-21 11:26:00

标签: javascript node.js express sequelize.js

这是添加待办事项功能的代码

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: []
    }
  ]
}

0 个答案:

没有答案
相关问题