SEO blogpost

This commit is contained in:
2026-08-05 19:39:22 +02:00
parent d7432fa65c
commit cf05e60251
53 changed files with 10592 additions and 125 deletions

View File

@@ -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));