backend/source/repositories/sql/calendar_overview.sql

16 lines
598 B
MySQL
Raw Normal View History

2024-09-21 10:56:00 +02:00
SELECT
x.id AS id,
2025-10-23 11:34:00 +02:00
MAX(x.name) AS name,
MAX(x.hue) AS hue,
MAX(x.access_public) AS access_public,
MAX(x.access_level_default) AS access_level_default,
GROUP_CONCAT(y1.level, ',') AS access_level_attributed_group,
GROUP_CONCAT(y2.level, ',') AS access_level_attributed_user
2024-09-21 10:56:00 +02:00
FROM
calendars AS x
2025-10-23 11:34:00 +02:00
LEFT OUTER JOIN calendar_access_attributed_group AS y1 ON ((x.id = y1.calendar_id) AND (y1.group_id IN (SELECT group_id FROM user_groups WHERE (user_id = $user_id))))
LEFT OUTER JOIN calendar_access_attributed_user AS y2 ON ((x.id = y2.calendar_id) AND (y2.user_id = $user_id))
GROUP BY
x.id
2024-09-21 10:56:00 +02:00
;