MCPcopy Index your code
hub / github.com/codebymitch/TitanBot / insertVerificationAudit

Function insertVerificationAudit

src/utils/database.js:200–230  ·  view source on GitHub ↗
(record)

Source from the content-addressed store, hash-verified

198}
199
200export async function insertVerificationAudit(record) {
201 try {
202 if (!db.initialized) {
203 await db.initialize();
204 }
205
206 if (db.isAvailable() && typeof pgDb.insertVerificationAudit === 'function') {
207 return await pgDb.insertVerificationAudit(record);
208 }
209
210 const key = `verification:audit:${record.guildId}`;
211 const existing = await getFromDb(key, []);
212 const auditEntries = Array.isArray(existing) ? existing : [];
213 const maxInMemoryAuditEntries = BotConfig?.verification?.maxInMemoryAuditEntries ?? 1000;
214
215 auditEntries.push({
216 ...record,
217 createdAt: record.createdAt || new Date().toISOString()
218 });
219
220 if (auditEntries.length > maxInMemoryAuditEntries) {
221 auditEntries.splice(0, auditEntries.length - maxInMemoryAuditEntries);
222 }
223
224 await setInDb(key, auditEntries);
225 return true;
226 } catch (error) {
227 logger.error('Error storing verification audit:', error);
228 return false;
229 }
230}
231
232export function unwrapReplitData(data) {
233 if (

Callers 1

logVerificationActionFunction · 0.90

Calls 5

getFromDbFunction · 0.85
setInDbFunction · 0.85
initializeMethod · 0.80
isAvailableMethod · 0.45

Tested by

no test coverage detected