sequelize / cli

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

Dynamic sorting #1522

Open AnburajanR opened 1 month ago

AnburajanR commented 1 month 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 1 month ago

I need help from everyone to fix the issue