Add new "choir" calendar and add cascading functionality for calendars
Jenkins Production Deployment
Jenkins Production Deployment
This commit is contained in:
@@ -14,6 +14,14 @@ export const getAllEvents = async (calendarId: number): Promise<Event[]> => {
|
||||
let conn = await NachklangCalendarDB.getConnection();
|
||||
let eventRows: Event[] = [];
|
||||
try {
|
||||
const calendarQuery = 'SELECT calendar_id, includes_calendars FROM calendars WHERE calendar_id = ?';
|
||||
const calendarRes = await conn.query(calendarQuery, calendarId);
|
||||
let calendarsToFetch: number[] = [calendarId];
|
||||
for(let row of calendarRes) {
|
||||
let includes: number[] = JSON.parse(row.includes_calendars);
|
||||
calendarsToFetch = [...calendarsToFetch, ...includes];
|
||||
}
|
||||
|
||||
const eventsQuery = `
|
||||
SELECT e.calendar_id, e.uuid, e.created_date, e.created_by_id, u.full_name, v.* FROM events e
|
||||
INNER JOIN (
|
||||
@@ -25,9 +33,9 @@ export const getAllEvents = async (calendarId: number): Promise<Event[]> => {
|
||||
INNER JOIN event_versions v
|
||||
ON v.event_id = latest_versions.event_id AND v.event_version_id = latest_versions.latest_version
|
||||
LEFT OUTER JOIN users u ON u.user_id = e.created_by_id
|
||||
WHERE e.calendar_id = ? AND v.status = 'PUBLIC'
|
||||
WHERE e.calendar_id IN (?) AND v.status = 'PUBLIC'
|
||||
ORDER BY e.event_id`;
|
||||
const eventsRes = await conn.query(eventsQuery, calendarId);
|
||||
const eventsRes = await conn.query(eventsQuery, [calendarsToFetch]);
|
||||
|
||||
for (let row of eventsRes) {
|
||||
eventRows.push({
|
||||
@@ -56,6 +64,11 @@ export const getAllEvents = async (calendarId: number): Promise<Event[]> => {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns all events for the given calendar for the admin UI (therefore includes admin relevant information and
|
||||
* ignores the calendar includes
|
||||
* @param calendarId
|
||||
*/
|
||||
export const getAllEventsAdmin = async (calendarId: number): Promise<Event[]> => {
|
||||
let conn = await NachklangCalendarDB.getConnection();
|
||||
let eventRows: Event[] = [];
|
||||
|
||||
Reference in New Issue
Block a user