🧹 feat: Automatic File Cleanup for Mistral OCR Uploads (#8827)

* chore: Handle optional token_endpoint in OAuth metadata discovery

* chore: Simplify permission typing logic in checkAccess function

* feat: Implement `deleteMistralFile` function and integrate file cleanup in `uploadMistralOCR`
This commit is contained in:
Danny Avila 2025-08-03 17:11:14 -04:00 committed by GitHub
parent 7ef2c626e2
commit 33834cd484
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 438 additions and 12 deletions

View file

@ -63,13 +63,10 @@ export const checkAccess = async ({
}
const role = await getRoleByName(user.role);
if (role && role.permissions && role.permissions[permissionType]) {
const permissionValue = role?.permissions?.[permissionType as keyof typeof role.permissions];
if (role && role.permissions && permissionValue) {
const hasAnyPermission = permissions.every((permission) => {
if (
role.permissions?.[permissionType as keyof typeof role.permissions]?.[
permission as keyof (typeof role.permissions)[typeof permissionType]
]
) {
if (permissionValue[permission as keyof typeof permissionValue]) {
return true;
}