Yeniden düzenleyin Sonuçları yeniden boyutlandır
const versions = yield Version.findAndCountAll({
order: [['createdAt', 'DESC']],
attributes: ['description', 'createdAt', 'id'],
include: [{
model: Section,
attributes: ['slug'],
where: { slug: section },
include: [{
model: Type,
attributes: ['slug'],
where: { slug: type },
include: [{
model: Group,
attributes: ['slug'],
where: { slug: group }
}]
}]
}]
});
sonuçlar daha sonra bu gibi çıkmıştı:
{
"description": "Wow. Nice one.",
"createdAt": "2016-04-11T23:05:15.736Z",
"body": "hi",
"id": 10,
"Section": {
"slug": "ttyl",
"Type": {
"slug": "Test",
"Group": {
"slug": "python2",
}
}
}
}
için bunların iç içe çalışmak için biraz tatsız bir sonuç yapar derinliği. Mümkünse bundan daha fazlasını isterim, eğer mümkünse,
{
"description": "Wow. Nice one.",
"createdAt": "2016-04-11T23:05:15.736Z",
"body": "hi",
"id": 10,
"Section": "ttyl",
"Type": "Test",
"Group": "python2"
}
Eleştiri için paylaştığınız bağlantının ilgili bölümünü kopyalayabilir misiniz? – Noah
@Noah, düzleştirme hakkındaki yorumlarımı netleştirdi/güncelledi. – scottjustin5000