Added APIs for team and members

This commit is contained in:
2024-07-20 11:15:33 +09:00
parent f0114ef33c
commit 1c7a6a1f5c
7 changed files with 395 additions and 30 deletions

View File

@ -0,0 +1,16 @@
from django.core.management.base import BaseCommand
from django.utils import timezone
from rog.models import TempUser # アプリ名 'rog' を適切に変更してください
class Command(BaseCommand):
help = 'Deletes expired temporary user records'
def handle(self, *args, **options):
expired_users = TempUser.objects.filter(expires_at__lt=timezone.now())
count = expired_users.count()
expired_users.delete()
self.stdout.write(self.style.SUCCESS(f'Successfully deleted {count} expired temporary user records'))
# cron job の設定
# 0 3 * * * /path/to/your/python /path/to/your/manage.py cleanup_temp_users