storage module
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import os
|
||||
import asyncio
|
||||
from pathlib import Path
|
||||
from .storage import store_transaction, prisma_client
|
||||
from .storage import Storage
|
||||
from .SolanaAPI import SolanaAPI
|
||||
|
||||
LOG_DIRECTORY = "./logs"
|
||||
@ -28,7 +28,7 @@ async def process_log_file(file_path):
|
||||
transaction_data = await solana_api.process_wh(data)
|
||||
|
||||
# Check if the transaction already exists
|
||||
existing_transaction = await prisma_client.transaction.find_first(
|
||||
existing_transaction = await Storage.get_prisma().transaction.find_first(
|
||||
where={'solana_signature': solana_signature}
|
||||
)
|
||||
|
||||
@ -46,7 +46,8 @@ async def process_log_file(file_path):
|
||||
'solana_signature': solana_signature,
|
||||
'details': details
|
||||
}
|
||||
await store_transaction(transaction_data)
|
||||
storage = Storage()
|
||||
await storage.store_transaction(transaction_data)
|
||||
|
||||
# Rename the file to append '_saved'
|
||||
new_file_path = file_path.with_name(file_path.stem + "_saved" + file_path.suffix)
|
||||
|
Reference in New Issue
Block a user