|  |  |  | @ -33,8 +33,19 @@ export async function fetchGroups(communityId: string): Promise<Set<string>> { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |           // Save the group to the database
 | 
		
	
		
			
				|  |  |  |  |           execute( | 
		
	
		
			
				|  |  |  |  |             'INSERT OR REPLACE INTO groups (id, name, linked_parent) VALUES (?, ?, ?)', | 
		
	
		
			
				|  |  |  |  |             [group.id, group.subject || 'Unnamed Group', group.linkedParent] // Provide a default name if missing
 | 
		
	
		
			
				|  |  |  |  |             `INSERT INTO groups (id, name, participants, linked_parent, last_updated)
 | 
		
	
		
			
				|  |  |  |  |              VALUES (?, ?, ?, ?, ?) | 
		
	
		
			
				|  |  |  |  |              ON CONFLICT(id) DO UPDATE SET | 
		
	
		
			
				|  |  |  |  |                name = excluded.name, | 
		
	
		
			
				|  |  |  |  |                participants = excluded.participants, | 
		
	
		
			
				|  |  |  |  |                last_updated = excluded.last_updated`,
 | 
		
	
		
			
				|  |  |  |  |             [ | 
		
	
		
			
				|  |  |  |  |               group.id, | 
		
	
		
			
				|  |  |  |  |               group.subject || 'Unnamed Group', | 
		
	
		
			
				|  |  |  |  |               group.participants ? JSON.stringify(group.participants) : null, | 
		
	
		
			
				|  |  |  |  |               group.linkedParent, | 
		
	
		
			
				|  |  |  |  |               new Date().toISOString() | 
		
	
		
			
				|  |  |  |  |             ] | 
		
	
		
			
				|  |  |  |  |           ); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
	
		
			
				
					|  |  |  | 
 |