import diaryDateTagService from "../services/diaryDateTagService.js"

import { devLog } from '../utils/logger.js';
export const getDiaryDateMemberTags = async (req, res) => {
    devLog("getDiaryDateMemberTags");
    try {
        const { authcode: userToken } = req.headers;
        const { clubId, memberId } = req.params;
        const tags = await diaryDateTagService.getDiaryDateMemberTags(userToken, clubId, memberId);
        res.status(200).json(tags);
    } catch (err) {
        console.error(err);
        res.status(500).json({ error: "Error retrieving diary date tags" });
    }
}

export const addDiaryDateTag = async (req, res) => {
    devLog("addDiaryDateTag");
    try {
        const { authcode: userToken } = req.headers;
        const { clubId } = req.params;
        const { dateId, memberId, tag } = req.body;
        const tags = await diaryDateTagService.addDiaryDateTag(userToken, clubId, dateId, memberId, tag);
        res.status(201).json(tags);
    } catch (err) {
        console.error(err);
        res.status(500).json({ error: "Error adding diary date tag" });
    }
}

