Füge Ablaufdatum zu Kontaktpersonen hinzu: Implementiere die Möglichkeit, ein Ablaufdatum für Kontaktpersonen zu speichern und anzuzeigen. Aktualisiere die Filterlogik, um nur nicht abgelaufene Kontaktpersonen anzuzeigen, und passe die Benutzeroberfläche an, um das Ablaufdatum darzustellen.

This commit is contained in:
Torsten Schulz (local)
2025-10-07 17:45:45 +02:00
parent ead4dbdd3f
commit d4fab1ceb3
7 changed files with 63 additions and 4 deletions

View File

@@ -3,7 +3,16 @@ const { Op } = require('sequelize');
const getAllContactPersons = async (req, res) => {
try {
const today = new Date();
today.setHours(0, 0, 0, 0);
const contactPersons = await ContactPerson.findAll({
where: {
[Op.or]: [
{ expiryDate: null },
{ expiryDate: { [Op.gte]: today } }
]
},
include: [
{
model: Position,
@@ -79,6 +88,14 @@ const filterContactPersons = async (req, res) => {
const where = {};
const having = [];
// Filter für nicht abgelaufene Kontaktpersonen
const today = new Date();
today.setHours(0, 0, 0, 0);
where[Op.or] = [
{ expiryDate: null },
{ expiryDate: { [Op.gte]: today } }
];
if (config.selection.id && config.selection.id === 'all') {
// No additional filter needed for "all"
} else if (config.selection.id) {