SEO blogpost
This commit is contained in:
@@ -37,6 +37,7 @@ const {
|
||||
issueToken,
|
||||
verifyJwt,
|
||||
} = require('./lib/auth');
|
||||
const { ensureScanEventSchema, recordScanEvent } = require('./lib/scanEvents');
|
||||
const {
|
||||
PlantImportValidationError,
|
||||
ensurePlantSchema,
|
||||
@@ -959,6 +960,12 @@ app.post('/v1/scan', guestScanLimiter, async (request, response) => {
|
||||
};
|
||||
|
||||
await storeEndpointResponse(db, endpointId, payload);
|
||||
await recordScanEvent(db, {
|
||||
scanType: 'identify',
|
||||
species: result?.botanicalName || result?.name || null,
|
||||
confidence: result?.confidence,
|
||||
locale: language,
|
||||
});
|
||||
response.status(200).json(payload);
|
||||
} catch (error) {
|
||||
console.error(`Scan error for user ${userId}:`, error);
|
||||
@@ -1139,6 +1146,13 @@ app.post('/v1/health-check', async (request, response) => {
|
||||
};
|
||||
|
||||
await storeEndpointResponse(db, endpointId, payload);
|
||||
await recordScanEvent(db, {
|
||||
scanType: 'health',
|
||||
diagnosis: analysis?.likelyIssues?.[0]?.title || null,
|
||||
confidence: analysis?.likelyIssues?.[0]?.confidence,
|
||||
healthStatus: analysis?.status || null,
|
||||
locale: language,
|
||||
});
|
||||
response.status(200).json(payload);
|
||||
} catch (error) {
|
||||
const payload = toApiErrorPayload(error);
|
||||
@@ -1946,6 +1960,7 @@ const start = async () => {
|
||||
await ensurePlantSchema(db);
|
||||
await ensureBillingSchema(db);
|
||||
await ensureAuthSchema(db);
|
||||
await ensureScanEventSchema(db);
|
||||
await seedBootstrapCatalogIfNeeded();
|
||||
if (isStorageConfigured()) {
|
||||
await ensureStorageBucketWithRetry().catch((err) => console.warn('MinIO bucket setup failed:', err.message));
|
||||
|
||||
Reference in New Issue
Block a user