From 3abab28a3ea92c35a3018ad79a57f41cd8a67b0c Mon Sep 17 00:00:00 2001 From: TANAKA Koichi Date: Sat, 23 Apr 2016 23:36:34 +0900 Subject: [PATCH] sequelize: fix FindOptions (#9073) Fix FindOptions.attributes. Now allows a object having include and/or exclude properties. http://sequelize.readthedocs.org/en/latest/api/model/#findalloptions-promisearrayinstance --- sequelize/sequelize-tests.ts | 2 ++ sequelize/sequelize.d.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sequelize/sequelize-tests.ts b/sequelize/sequelize-tests.ts index 86be60d223..6e62606e19 100644 --- a/sequelize/sequelize-tests.ts +++ b/sequelize/sequelize-tests.ts @@ -882,6 +882,8 @@ User.findAll( { order : [['id', ';DELETE YOLO INJECTIONS']] } ); User.findAll( { include : [User], order : [[User, 'id', ';DELETE YOLO INJECTIONS']] } ); User.findAll( { include : [User], order : [['id', 'ASC NULLS LAST'], [User, 'id', 'DESC NULLS FIRST']] } ); User.findAll( { include : [{ model : User, where : { title : 'DoDat' }, include : [{ model : User }] }] } ); +User.findAll( { attributes: ['username', 'data']}); +User.findAll( { attributes: {include: ['username', 'data']} }); User.findById( 'a string' ); diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 9af29c0e97..81c7f4a165 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -3121,7 +3121,7 @@ declare module "sequelize" { * `Sequelize.literal`, `Sequelize.fn` and so on), and the second is the name you want the attribute to * have in the returned instance */ - attributes? : Array; + attributes? : Array | { include?: Array, exclude?: Array }; /** * If true, only non-deleted records will be returned. If false, both deleted and non-deleted records will