Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: delete old google drive export files cron job- AI-561 #257

Merged
merged 11 commits into from
Nov 6, 2024

Conversation

JBR90
Copy link
Contributor

@JBR90 JBR90 commented Oct 23, 2024

Description

  • Creates an expired exports route for a vercel cron job
    The route will fetch google drive ids that are expired (over two weeks) and update the expiredAt field in lesson_exports where the gdriveFileIds match. It then deletes the files from drive.
  • This cron job can be scheduled to run overnight (settings in vercel.json) - Not sure how regularly we want to do this currently set every day at 3am
"schedule": "0 3 * * *" 
minute hour day month day-of-week 

How to test

Create a lesson and export resources.
Change the query so that it fetches all files not just older than 14 days

    // const query = `modifiedTime < '${oneMonthAgo}' and '${folderId}' in parents`;
    const query = `'${folderId}' in parents`;

Run app locally and run the cron job by going to http://localhost:2525/api/cron-jobs/expired-exports

Check that files are deleted from Google Drive playground output folder and expired_at has been set to current time in local database.

Checklist

  • Manually tested across browsers / devices
  • Considered impact on accessibility
  • Does this PR update a package with a breaking change

Copy link

vercel bot commented Oct 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
oak-ai-lesson-assistant ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2024 1:28pm

Copy link

github-actions bot commented Oct 23, 2024

Playwright test results

passed  14 passed
skipped  1 skipped

Details

report  Open report ↗︎
stats  15 tests across 14 suites
duration  2 minutes, 6 seconds
commit  89e1c3e

Skipped tests

No persona › tests/auth.test.ts › authenticate through Clerk UI

@JBR90 JBR90 changed the title chore: add delete old files script to export chore: add delete old files script to export - AI-561 Oct 23, 2024
@JBR90 JBR90 requested a review from mantagen November 5, 2024 16:14
@JBR90 JBR90 marked this pull request as ready for review November 5, 2024 16:14
Copy link
Collaborator

@mantagen mantagen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! A v minor comment

Copy link

sonarqubecloud bot commented Nov 6, 2024

@JBR90 JBR90 changed the title chore: add delete old files script to export - AI-561 chore: delete old google drive export files cron job- AI-561 Nov 6, 2024
@JBR90 JBR90 merged commit e07cffb into main Nov 6, 2024
14 checks passed
@JBR90 JBR90 deleted the feat/delete-old-drive-file-script branch November 6, 2024 13:52
@oak-machine-user
Copy link
Collaborator

🎉 This PR is included in version 1.14.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants