diff --git a/backend/src/services/UserServices/ListUserParamiterService.ts b/backend/src/services/UserServices/ListUserParamiterService.ts index 076674a..52bbfca 100644 --- a/backend/src/services/UserServices/ListUserParamiterService.ts +++ b/backend/src/services/UserServices/ListUserParamiterService.ts @@ -37,32 +37,34 @@ const ListUser = async ({ profile, userId, raw}: Request): Promise => { } - const users = await User.findAll({ + const queryOptions:any = { where: where_clause, raw, - attributes: ['id', 'name', 'email'], - - include: [ + attributes: ["id", "name", "email"], + order: [["id", "ASC"]] + }; + + if (!raw) { + queryOptions.include = [ { model: Queue, as: "queues", attributes: ["id", "name", "color"] } - ], + ]; + } - // include: [ - // { - // model: UserQueue, - // separate: true, - - // attributes: ['id',], - - // order: [ - // ['createdAt', 'ASC'] - // ] - // }, - // ], + const users = await User.findAll(queryOptions); - order: [["id", "ASC"]], - }) + // const users = await User.findAll({ + // where: where_clause, + // raw, + // attributes: ['id', 'name', 'email'], + + // include: [ + // { model: Queue, as: "queues", attributes: ["id", "name", "color"] } + // ], + + // order: [["id", "ASC"]], + // }) return users;