remove time from db

This commit is contained in:
Mylloon 2022-10-28 23:03:33 +02:00
parent 5aaf60d9d5
commit adedef2463
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 5 additions and 7 deletions

View file

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

View file

@ -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"""