chore: rename server to api (#7342)
This commit is contained in:
parent
6bee97eb26
commit
fdbe4c2ca6
554 changed files with 39 additions and 43 deletions
25
apps/api/plane/bgtasks/file_asset_task.py
Normal file
25
apps/api/plane/bgtasks/file_asset_task.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Python imports
|
||||
import os
|
||||
from datetime import timedelta
|
||||
|
||||
# Django imports
|
||||
from django.utils import timezone
|
||||
from django.db.models import Q
|
||||
|
||||
# Third party imports
|
||||
from celery import shared_task
|
||||
|
||||
# Module imports
|
||||
from plane.db.models import FileAsset
|
||||
|
||||
|
||||
@shared_task
|
||||
def delete_unuploaded_file_asset():
|
||||
"""This task deletes unuploaded file assets older than a certain number of days."""
|
||||
FileAsset.objects.filter(
|
||||
Q(
|
||||
created_at__lt=timezone.now()
|
||||
- timedelta(days=int(os.environ.get("UNUPLOADED_ASSET_DELETE_DAYS", "7")))
|
||||
)
|
||||
& Q(is_uploaded=False)
|
||||
).delete()
|
||||
Loading…
Add table
Add a link
Reference in a new issue