Initial Functional Implementation of S3 MicroService

This commit is contained in:
2023-08-09 00:32:36 -03:00
commit 0b320a3222
23 changed files with 1161 additions and 0 deletions

View File

View File

@@ -0,0 +1,9 @@
from enum import Enum
class FileType(Enum):
PNG = "png"
JPEG = "jpeg"
CONTENT_TYPE = {FileType.PNG: "image/png", FileType.JPEG: "image/jpeg"}

View File

@@ -0,0 +1,9 @@
import base64
from hashlib import md5
def file_name_hash(username: str, file_postfix: str) -> str:
hashed_username = md5(username.encode("utf-8")).digest()
hashed_username = base64.b64encode(hashed_username).decode()
return f"{hashed_username}_{file_postfix}"