This commit is contained in:
2026-01-25 17:00:35 +01:00
parent 751e1a6347
commit b626b682b5
3 changed files with 51 additions and 25 deletions

View File

@@ -84,3 +84,17 @@ async def assign_app_to_user(user_id: int, app_id: int, db: Session = Depends(da
db.add(new_assignment)
db.commit()
return {"message": "Assigned successfully"}
@router.delete("/{user_id}/assign/{app_id}")
async def remove_app_assignment(user_id: int, app_id: int, db: Session = Depends(database.get_db)):
assignment = db.query(models.UserApplication).filter(
models.UserApplication.user_id == user_id,
models.UserApplication.application_id == app_id
).first()
if not assignment:
raise HTTPException(status_code=404, detail="Assignment not found")
db.delete(assignment)
db.commit()
return {"message": "Assignment removed"}