diff --git a/backend/models/app.py b/backend/models/app.py index 187ab80c2..4de453769 100644 --- a/backend/models/app.py +++ b/backend/models/app.py @@ -65,6 +65,7 @@ class App(BaseModel): trigger_workflow_memories: bool = True # default true installs: int = 0 proactive_notification: Optional[ProactiveNotification] = None + created_at: Optional[datetime] = None def get_rating_avg(self) -> Optional[str]: return f'{self.rating_avg:.1f}' if self.rating_avg is not None else None diff --git a/backend/models/plugin.py b/backend/models/plugin.py index b4d3642dc..7de15c503 100644 --- a/backend/models/plugin.py +++ b/backend/models/plugin.py @@ -56,6 +56,7 @@ class Plugin(BaseModel): trigger_workflow_memories: bool = True # default true installs: int = 0 proactive_notification: Optional[ProactiveNotification] = None + created_at: Optional[datetime] = None def get_rating_avg(self) -> Optional[str]: return f'{self.rating_avg:.1f}' if self.rating_avg is not None else None diff --git a/backend/routers/apps.py b/backend/routers/apps.py index 3a044fd52..896a44ef4 100644 --- a/backend/routers/apps.py +++ b/backend/routers/apps.py @@ -1,6 +1,7 @@ import json import os import random +from datetime import datetime, timezone from typing import List import requests from fastapi import APIRouter, Depends, Form, UploadFile, File, HTTPException, Header @@ -66,6 +67,7 @@ def submit_app(app_data: str = Form(...), file: UploadFile = File(...), uid=Depe f.write(file.file.read()) imgUrl = upload_plugin_logo(file_path, data['id']) data['image'] = imgUrl + data['created_at'] = datetime.now(timezone.utc) if data.get('private', True): print("Adding private app") add_private_app(data, data['uid']) diff --git a/backend/routers/plugins.py b/backend/routers/plugins.py index 72375db58..89d91ca60 100644 --- a/backend/routers/plugins.py +++ b/backend/routers/plugins.py @@ -1,6 +1,7 @@ import json import os import random +from datetime import datetime, timezone from collections import defaultdict from typing import List @@ -55,12 +56,12 @@ def get_plugins(uid: str): @router.get('/v1/plugins', tags=['v1']) -def get_plugins(uid: str): +def get_plugins_v1(uid: str): return get_plugins_data(uid, include_reviews=True) @router.get('/v2/plugins', tags=['v1'], response_model=List[Plugin]) -def get_plugins(uid: str = Depends(auth.get_current_user_uid)): +def get_plugins_v2(uid: str = Depends(auth.get_current_user_uid)): return get_plugins_data(uid, include_reviews=True) @@ -151,6 +152,7 @@ def add_plugin(plugin_data: str = Form(...), file: UploadFile = File(...), uid=D f.write(file.file.read()) imgUrl = upload_plugin_logo(file_path, data['id']) data['image'] = imgUrl + data['created_at'] = datetime.now(timezone.utc) if data.get('private', True): print("Adding private plugin") add_private_plugin(data, data['uid'])