db updates and fixes
All checks were successful
Build And Push Image / docker (push) Successful in 3m59s

This commit is contained in:
2025-08-13 13:51:27 +02:00
parent a0153a76a4
commit d215dfedc7
5 changed files with 249 additions and 21 deletions

View File

@@ -92,6 +92,7 @@ export const normalizeEventFieldsFromNocoDB = (data: any): Event => {
'Title': 'title',
'Description': 'description',
'Event Type': 'event_type',
'Event ID': 'event_id',
'Start Date': 'start_datetime',
'End Date': 'end_datetime',
'Location': 'location',
@@ -106,6 +107,7 @@ export const normalizeEventFieldsFromNocoDB = (data: any): Event => {
'title': 'title',
'description': 'description',
'event_type': 'event_type',
'event_id': 'event_id',
'start_datetime': 'start_datetime',
'end_datetime': 'end_datetime',
'location': 'location',
@@ -257,7 +259,7 @@ export function createNocoDBEventsClient() {
// Only include allowed event fields
const allowedFields = [
"title", "description", "event_type", "start_datetime", "end_datetime",
"title", "description", "event_type", "event_id", "start_datetime", "end_datetime",
"location", "is_recurring", "recurrence_pattern", "max_attendees",
"is_paid", "cost_members", "cost_non_members", "member_pricing_enabled",
"visibility", "status", "creator", "current_attendees"
@@ -269,6 +271,14 @@ export function createNocoDBEventsClient() {
}
}
// Generate unique event_id if not provided
if (!cleanData.event_id) {
const timestamp = Date.now();
const randomString = Math.random().toString(36).substring(2, 8);
cleanData.event_id = `evt_${timestamp}_${randomString}`;
console.log('[nocodb-events] Generated event_id:', cleanData.event_id);
}
// Set defaults
cleanData.status = cleanData.status || 'active';
cleanData.visibility = cleanData.visibility || 'public';
@@ -411,8 +421,13 @@ export function transformEventForCalendar(event: Event): any {
const colors = eventTypeColors[event.event_type as keyof typeof eventTypeColors] ||
{ bg: '#757575', border: '#424242' };
// Use event_id as the primary identifier for FullCalendar
const calendarId = event.event_id || event.id || `temp_${(event as any).Id}_${Date.now()}`;
console.log('[transformEventForCalendar] Event:', event.title, 'ID:', calendarId, 'event_id:', event.event_id, 'system id:', event.id);
return {
id: event.id,
id: calendarId,
title: event.title,
start: event.start_datetime,
end: event.end_datetime,
@@ -431,7 +446,9 @@ export function transformEventForCalendar(event: Event): any {
user_rsvp: event.user_rsvp,
visibility: event.visibility,
creator: event.creator,
status: event.status
status: event.status,
event_id: event.event_id,
database_id: event.id || (event as any).Id
}
};
}