sequelize / cli

The Sequelize CLI
MIT License
2.53k stars 527 forks source link

Dynamic sorting #1522

Open AnburajanR opened 2 hours ago

AnburajanR commented 2 hours ago

const res = await this.supplierMapModel.findAndCountAll({ limit: size, offset: page * size, where: supplierMapWhereCondition, order: [[sortBy, sortOrder]], include: [ { model: Supplier, where: supplierWhereCondition, include: [ { model: SupplierContact }, { model: ShadowLocationType }, { model: ShadowCriticality }, { model: ShadowRegion }, { model: ShadowCountry }, { model: ShadowTimeZone }, { model: ShadowInviteDetail}, {model: ShadowSupplierRiskSignal}, {model: ShadowSupplierRiskSummary } ] } ] });

sortBy = {contact_name,location_type_name,region_name,country_name} sortOrder = "ASC" SortBy comes with dynamic one-field sorting Include we need without aliases

AnburajanR commented 2 hours ago

I need help from everyone to fix the issue