From 8c79d2cc76ff9eee633feb09afb08030bce05073 Mon Sep 17 00:00:00 2001 From: MohammadHMazarei Date: Tue, 22 Apr 2025 13:48:55 +0330 Subject: [PATCH] ADD: CreatedAt to the transactions typesense schema --- components/transaction/transactionService.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/transaction/transactionService.js b/components/transaction/transactionService.js index 88cbc4b..49d4f5f 100644 --- a/components/transaction/transactionService.js +++ b/components/transaction/transactionService.js @@ -197,6 +197,7 @@ const indexAllTransactions = async () => { source: transaction.source, value: transaction.value, description: transaction.description, + createdAt: Math.floor(new Date(transaction.createdAt).getTime() / 1000), // Store as timestamp in seconds } documents.push(data) @@ -219,6 +220,7 @@ const getTypeSenseSchema = () => { { name: 'source', type: 'string', facet: false }, { name: 'value', type: 'int64', facet: false }, { name: 'description', type: 'string', facet: false, infix: true }, + { name: 'createdAt', type: 'int64', facet: false }, ], default_sorting_field: 'createdAt', }