This commit is contained in:
Timothy Jaeryang Baek
2026-04-02 02:06:21 -05:00
parent 9d3e0637c8
commit 4632f200a9
4 changed files with 59 additions and 0 deletions
+17
View File
@@ -196,6 +196,14 @@ async def create_new_model(
)
else:
form_data.access_grants = filter_allowed_access_grants(
request.app.state.config.USER_PERMISSIONS,
user.id,
user.role,
form_data.access_grants,
'sharing.public_models',
)
model = Models.insert_new_model(form_data, user.id, db=db)
if model:
return model
@@ -460,6 +468,7 @@ async def toggle_model_by_id(id: str, user=Depends(get_verified_user), db: Sessi
@router.post('/model/update', response_model=Optional[ModelModel])
async def update_model_by_id(
request: Request,
form_data: ModelForm,
user=Depends(get_verified_user),
db: Session = Depends(get_session),
@@ -487,6 +496,14 @@ async def update_model_by_id(
detail=ERROR_MESSAGES.ACCESS_PROHIBITED,
)
form_data.access_grants = filter_allowed_access_grants(
request.app.state.config.USER_PERMISSIONS,
user.id,
user.role,
form_data.access_grants,
'sharing.public_models',
)
model = Models.update_model_by_id(form_data.id, ModelForm(**form_data.model_dump()), db=db)
return model