Auto archive items older than 90 days #193

Closed
michellejli77 wants to merge 7 commits from mli6/auto-archive-2 into main
michellejli77 commented 2023-01-28 20:58:19 +00:00 (Migrated from github.com)

Description

Motivation/Context: In order to decrease the number of items stored in our database, we want to automatically archive items that have been on the page for more than 90 days.

  • Create a helper async function to find all active items older than 90 days (added to DB over 90 days ago) and archive them
  • Create a cron job that runs this function once a week

Closes #177

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Check that the cron job automatically runs by logging calls on console
  • Confirm that cron scheduler is calling the auto archive function
  • Check that all active items older than 90 days are moved to archive
  • Check that all active items younger than 90 days are not impacted
  • Check that the "Archiver" dropdown says "Automatically Archived on ..."

Test Configuration:

  • Node.js version: 14.18.0
  • Desktop/Mobile: Desktop
  • Browser: Chrome

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
# Description Motivation/Context: In order to decrease the number of items stored in our database, we want to automatically archive items that have been on the page for more than 90 days. - Create a helper async function to find all active items older than 90 days (added to DB over 90 days ago) and archive them - Create a cron job that runs this function once a week Closes #177 ## Type of change - [x] New feature (non-breaking change which adds functionality) # How Has This Been Tested? - [x] Check that the cron job automatically runs by logging calls on console - [x] Confirm that cron scheduler is calling the auto archive function - [x] Check that all active items older than 90 days are moved to archive - [x] Check that all active items younger than 90 days are not impacted - [x] Check that the "Archiver" dropdown says "Automatically Archived on ..." **Test Configuration**: - Node.js version: 14.18.0 - Desktop/Mobile: Desktop - Browser: Chrome # Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes
Adrastopoulos (Migrated from github.com) reviewed 2023-01-28 20:58:19 +00:00
hdavidethan (Migrated from github.com) requested changes 2023-01-30 02:55:14 +00:00
@ -193,0 +221,4 @@
}
// Once a week, automatically archives all items older than 90 days
schedule("0 0 * * *", archiveOldItems);
hdavidethan (Migrated from github.com) commented 2023-01-30 02:55:06 +00:00

Maybe just set this to string "automatic" if archiver is string or null if archiver is an Object ID

Maybe just set this to string "automatic" if archiver is string or null if archiver is an Object ID
hdavidethan (Migrated from github.com) commented 2023-01-30 02:53:55 +00:00

I think this does every day at 12 am.

Do you mean 0 0 * * 0 to mean at 12 am on every Sunday?

I think this does every day at 12 am. Do you mean `0 0 * * 0` to mean at 12 am on every Sunday?

Pull request closed

Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ScottyLabs/lost-and-found!193
No description provided.