import Tag from '#models/tag';
export default class TagsController {
    async index({ request, response }) {
        const populate = request.qs().populate;
        const query = Tag.query();
        if (populate === 'projects') {
            query.preload('projects');
        }
        const tags = await query;
        return response.ok({
            data: tags.map((t) => ({
                name: t.name,
                color: t.color,
                projects: populate === 'projects' ? t.projects : [],
            })),
        });
    }
}
//# sourceMappingURL=tags_controller.js.map