Hamdy005 commited on
Commit
d3e7277
·
1 Parent(s): 6594ddb

feat: move auth constants to dedicated module and add unit tests for avatar upload functionality

Browse files
Files changed (2) hide show
  1. auth/constants.py +15 -0
  2. auth/routes.py +6 -14
auth/constants.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ALLOWED_MIME_TYPES = {
2
+ "image/jpeg",
3
+ "image/jpg",
4
+ "image/png",
5
+ "image/webp",
6
+ "image/gif",
7
+ "image/avif",
8
+ "image/svg+xml",
9
+ }
10
+
11
+ MAX_FILE_SIZE_BYTES = 6 * 1024 * 1024 # 6 MB
12
+
13
+ AVATAR_BUCKET = "avatars"
14
+
15
+ PLACEHOLDER_DOMAINS = ["@placeholder.ai", "@studymate.ai"]
auth/routes.py CHANGED
@@ -7,20 +7,12 @@ from src.database import get_auth_supabase, get_supabase
7
  from src.store import create_user, get_user_by_email, delete_user_data, update_user_profile, get_user_by_id
8
  from src.dependencies import get_current_user_id, get_current_user
9
  from .schemas import ProfileUpdateRequest
10
-
11
- ALLOWED_MIME_TYPES = {
12
- "image/jpeg",
13
- "image/jpg",
14
- "image/png",
15
- "image/webp",
16
- "image/gif",
17
- "image/avif",
18
- "image/svg+xml",
19
- }
20
- MAX_FILE_SIZE_BYTES = 6 * 1024 * 1024 # 6 MB
21
- AVATAR_BUCKET = "avatars"
22
-
23
- PLACEHOLDER_DOMAINS = ["@placeholder.ai", "@studymate.ai"]
24
 
25
  router = APIRouter(prefix="/api/auth", tags=["Auth"])
26
 
 
7
  from src.store import create_user, get_user_by_email, delete_user_data, update_user_profile, get_user_by_id
8
  from src.dependencies import get_current_user_id, get_current_user
9
  from .schemas import ProfileUpdateRequest
10
+ from .constants import (
11
+ ALLOWED_MIME_TYPES,
12
+ MAX_FILE_SIZE_BYTES,
13
+ AVATAR_BUCKET,
14
+ PLACEHOLDER_DOMAINS,
15
+ )
 
 
 
 
 
 
 
 
16
 
17
  router = APIRouter(prefix="/api/auth", tags=["Auth"])
18