From e762a7c8406a9724d9b874c9cb65d47cac7087f3 Mon Sep 17 00:00:00 2001 From: "borja (aider)" Date: Sun, 30 Mar 2025 16:45:29 +0200 Subject: [PATCH] docs: document EvolutionGroup type with API response format --- src/services/group-sync.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/services/group-sync.ts b/src/services/group-sync.ts index 067b58d..69a8edf 100644 --- a/src/services/group-sync.ts +++ b/src/services/group-sync.ts @@ -5,11 +5,31 @@ const env = process.env; // In-memory cache for active groups const activeGroupsCache = new Map(); // groupId -> groupName +/** + * Represents a group from the Evolution API response + * + * API returns an array of groups in this format: + * [ + * { + * id: string, // Group ID in @g.us format (primary key) + * subject: string, // Group name (displayed to users) + * linkedParent?: string, // Parent community ID if group belongs to one + * size?: number, // Current member count (unused in our system) + * creation?: number, // Unix timestamp of group creation (unused) + * desc?: string, // Group description text (unused) + * // ...other fields exist but are ignored by our implementation + * } + * ] + * + * Required fields for our implementation: + * - id (used as database primary key) + * - subject (used as group display name) + * - linkedParent (used for community filtering) + */ type EvolutionGroup = { id: string; subject: string; linkedParent?: string; - // Other fields from API response }; export class GroupSyncService {