Remove unused SurrealDB service
All checks were successful
Build Docker Image / build (push) Successful in 4m33s
All checks were successful
Build Docker Image / build (push) Successful in 4m33s
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
const SURREALDB_URL = process.env.SURREALDB_URL || ''
|
||||
const SURREALDB_NS = process.env.SURREALDB_NS || 'optovia'
|
||||
const SURREALDB_DB = process.env.SURREALDB_DB || 'events'
|
||||
const SURREALDB_USER = process.env.SURREALDB_USER || ''
|
||||
const SURREALDB_PASS = process.env.SURREALDB_PASS || ''
|
||||
|
||||
export async function logKycEvent(
|
||||
kycId: string,
|
||||
userId: string,
|
||||
event: string,
|
||||
description: string,
|
||||
): Promise<boolean> {
|
||||
if (!SURREALDB_URL) return false
|
||||
|
||||
const payload = {
|
||||
kyc_id: kycId,
|
||||
user_id: userId,
|
||||
event,
|
||||
description,
|
||||
created_at: new Date().toISOString(),
|
||||
}
|
||||
|
||||
const query = `CREATE kyc_event CONTENT ${JSON.stringify(payload)};`
|
||||
const headers: Record<string, string> = {
|
||||
'Content-Type': 'text/plain',
|
||||
Accept: 'application/json',
|
||||
NS: SURREALDB_NS,
|
||||
DB: SURREALDB_DB,
|
||||
}
|
||||
|
||||
if (SURREALDB_USER && SURREALDB_PASS) {
|
||||
headers.Authorization = `Basic ${Buffer.from(`${SURREALDB_USER}:${SURREALDB_PASS}`).toString('base64')}`
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await fetch(`${SURREALDB_URL.replace(/\/$/, '')}/sql`, {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body: query,
|
||||
signal: AbortSignal.timeout(10000),
|
||||
})
|
||||
return res.ok
|
||||
} catch (e) {
|
||||
console.error('Failed to log KYC event:', e)
|
||||
return false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user