import Activity from '../models/Activity.js';

export const addActivity = async (req, res) => {
    try {
        const { diaryDateId, description } = req.body;
        const activity = await Activity.create({ diaryDateId, description });
        res.status(201).json(activity);
    } catch (error) {
        res.status(500).json({ error: 'Fehler beim Hinzufügen der Aktivität' });
    }
};

export const getActivities = async (req, res) => {
    try {
        const { diaryDateId } = req.params;
        const activities = await Activity.findAll({ where: { diaryDateId } });
        res.status(200).json(activities);
    } catch (error) {
        res.status(500).json({ error: 'Fehler beim Abrufen der Aktivitäten' });
    }
};
