diff --git a/src/routes/api/upload.py b/src/routes/api/upload.py index 107acbc..4b25df0 100644 --- a/src/routes/api/upload.py +++ b/src/routes/api/upload.py @@ -1,5 +1,3 @@ -from time import time - from config import Config from flask import Blueprint, jsonify, redirect, request from utils.misc import hash_data @@ -19,7 +17,7 @@ def upload() -> Response: with open(f"{Config.uploads_dir}/{data_hash}", 'w') as f: f.write(data) - Config.database.add_file(data_hash, filename, int(time())) + Config.database.add_file(data_hash, filename) # Send the hash to the javascript client return jsonify(data_hash) diff --git a/src/utils/sqlite.py b/src/utils/sqlite.py index 256303b..2bceb95 100644 --- a/src/utils/sqlite.py +++ b/src/utils/sqlite.py @@ -59,13 +59,13 @@ class FilesDB(Database): self.request( f"CREATE TABLE IF NOT EXISTS {self.table_name} \ - (hash TEXT, filename TEXT, date INTEGER);") + (hash TEXT, filename TEXT);") - def add_file(self, hash_file: str, filename: str, date: int) -> None: + def add_file(self, hash_file: str, filename: str) -> None: """Add a file""" self.request( - f"INSERT INTO {self.table_name} (hash, filename, date) VALUES (?, ?, ?);", - [hash_file, filename, date]) + f"INSERT INTO {self.table_name} (hash, filename) VALUES (?, ?);", + [hash_file, filename]) def remove_file(self, hash_file: str) -> None: """Remove a file"""