无法获取 /mentor/mypage/pre-ordered_Lectures/1

Cannot GET /mentor/mypage/pre-ordered_Lectures/1

我不太擅长英语和编码初学者。我使用 javascript 而我的 OS 是 Mac。 无论如何,我在 MysqlWorkbench 中编写了行查询,现在,我想在 VScode 中编写它以进行续集。

select reservation_datetime
from LectureReservation
Inner Join Lecture
On LectureReservation.lecture_id = Lecture.id
Where Lecture.mentor_id = 1

这是我的查询并且

module.exports = {
    get: (req, res) => {
        if (req.params.id) {
            LectureReservation
            .findOne({
                include: [
                    {
                        model: Lecture,
                        where: {
                            Lecture_id: Lecture.id,
                        },
                    },
                ],
                attributes: ['reservation_datetime'],
                where: {
                    mentor_id: req.params.id,
                },
            })
            .then((result) => {
                if (result) {
                    res.status(200).json({ message: 'OK!' });
                } else {
                    res.status(409).json({ message: 'Wrong Access' });
                }
            })
            .catch((err) => {
                res.status(500).send(err);
            });
        }
    },
};

这是我的续集代码。和

这是我在 postman 中的错误代码..

结果:如何编辑我的 sequelize 代码来修复我的 postman 错误..?

这似乎不是与续集相关的错误。错误码是404,表示路由不可用。请检查您的路线。

此外,如果您的续集模型关联正确,则无需指定包含条件。你可以只写

include: [
    {
        model: Lecture
    },
],