diff --git a/controllers/contactPersonController.js b/controllers/contactPersonController.js index 4502d08..7d86ae9 100644 --- a/controllers/contactPersonController.js +++ b/controllers/contactPersonController.js @@ -77,25 +77,25 @@ const filterContactPersons = async (req, res) => { 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) { where.id = config.selection.id; } else { - const filters = []; - if (config.selection.types && config.selection.types.length > 0) { - filters.push({ '$positions.id$': { [Op.in]: config.selection.types } }); + having.push({ '$positions.id$': { [Op.in]: config.selection.types } }); } if (config.selection.places && config.selection.places.length > 0) { - filters.push({ '$events.eventPlaceId$': { [Op.in]: config.selection.places } }); + having.push({ '$events.eventPlaceId$': { [Op.in]: config.selection.places } }); } - if (filters.length > 0) { - where[Op.and] = filters; + if (config.selection.positions && config.selection.positions.length > 0) { + having.push({ '$positions.id$': { [Op.in]: config.selection.positions } }); } } @@ -106,13 +106,16 @@ const filterContactPersons = async (req, res) => { model: Position, as: 'positions', through: { attributes: [] }, + required: true, // Ensure only contact persons with matching positions are included }, { model: Event, as: 'events', through: { attributes: [] }, + required: false, }, ], + having: having.length > 0 ? { [Op.and]: having } : undefined, }); res.json(contactPersons); diff --git a/public/images/uploads/3cb841cb-6764-4c27-b745-62efb91adb06.jpg b/public/images/uploads/3cb841cb-6764-4c27-b745-62efb91adb06.jpg new file mode 100644 index 0000000..af35d62 Binary files /dev/null and b/public/images/uploads/3cb841cb-6764-4c27-b745-62efb91adb06.jpg differ diff --git a/public/images/uploads/59b29477-6997-4d3c-9010-54ba7c0a7ba3.jpg b/public/images/uploads/59b29477-6997-4d3c-9010-54ba7c0a7ba3.jpg new file mode 100644 index 0000000..b342401 Binary files /dev/null and b/public/images/uploads/59b29477-6997-4d3c-9010-54ba7c0a7ba3.jpg differ diff --git a/src/components/AddContactDialog.vue b/src/components/AddContactDialog.vue index 1d672be..eca7d68 100644 --- a/src/components/AddContactDialog.vue +++ b/src/components/AddContactDialog.vue @@ -19,8 +19,8 @@ label="caption" track-by="id" />
{{ contact.name }}
Telefon: {{ contact.phone }}
Straße: {{ contact.street }}
Postleitzahl: {{ contact.zipcode }}
@@ -62,5 +62,7 @@ export default { \ No newline at end of file diff --git a/src/content/AddressesContent.vue b/src/content/AddressesContent.vue new file mode 100644 index 0000000..a6ddb6c --- /dev/null +++ b/src/content/AddressesContent.vue @@ -0,0 +1,23 @@ + +