Added order
This commit is contained in:
@@ -10,7 +10,8 @@ const getAllContactPersons = async (req, res) => {
|
||||
as: 'positions',
|
||||
through: { attributes: [] }
|
||||
}
|
||||
]
|
||||
],
|
||||
order: ['name']
|
||||
});
|
||||
res.json(contactPersons);
|
||||
} catch (error) {
|
||||
@@ -74,13 +75,10 @@ const deleteContactPerson = async (req, res) => {
|
||||
const filterContactPersons = async (req, res) => {
|
||||
try {
|
||||
const { config: configString } = req.body;
|
||||
console.log(configString, typeof configString);
|
||||
const config = JSON.parse(configString);
|
||||
const where = {};
|
||||
const having = [];
|
||||
|
||||
console.log(config, typeof config);
|
||||
console.log(config.selection);
|
||||
if (config.selection.id && config.selection.id === 'all') {
|
||||
// No additional filter needed for "all"
|
||||
} else if (config.selection.id) {
|
||||
@@ -116,6 +114,7 @@ const filterContactPersons = async (req, res) => {
|
||||
},
|
||||
],
|
||||
having: having.length > 0 ? { [Op.and]: having } : undefined,
|
||||
order: ['name']
|
||||
});
|
||||
|
||||
res.json(contactPersons);
|
||||
|
||||
Reference in New Issue
Block a user