在关系中按 DESC 顺序排列顺序不起作用

sequelize orderBy DESC within realations doesn't work

我正在使用 node.js 和 sequelize 。我想将 createdAt 排序为 DESC。但它不起作用。我该如何解决这个问题? 这是我的代码:

 return AllowedOrganization.findOne({
        where,
        attributes:[
          "fileReviewTimeStamp"
        ],
        include: [
          { 
            model: User,
            attributes: [
              "firstName",
              "lastName",
              "npiNumber",
              "attestDate"
            ],
            include:[
              {
                model: PersonalInfo,
                attributes: [
                  "approvalDate"
                ]
              },
              {
                model:ProviderNotes,
                as: "notes",
               order:[['createdAt' , 'DESC']],
                attributes: [
                  "createdAt"
                ]
              }
            ]
          }
        ]

你可以排序

allowedOrganization.User.notes.sort((a,b) => {
    const date1 = new Date(a.createdAt)
    const date2 = new Date(b.createdAt)
    return date2 - date1
   
})