(data)
| 36 | |
| 37 | // Function to save user and group data to JSON file |
| 38 | function saveUserGroupData(data) { |
| 39 | try { |
| 40 | const dataPath = path.join(__dirname, '../data/userGroupData.json'); |
| 41 | // Ensure the directory exists |
| 42 | const dir = path.dirname(dataPath); |
| 43 | if (!fs.existsSync(dir)) { |
| 44 | fs.mkdirSync(dir, { recursive: true }); |
| 45 | } |
| 46 | fs.writeFileSync(dataPath, JSON.stringify(data, null, 2)); |
| 47 | return true; |
| 48 | } catch (error) { |
| 49 | console.error('Error saving user group data:', error); |
| 50 | return false; |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | // Add these functions to your SQL helper file |
| 55 | async function setAntilink(groupId, type, action) { |
no outgoing calls
no test coverage detected