-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add collection management scripts for MOH TOSP #955
base: main
Are you sure you want to change the base?
Conversation
Datadog ReportBranch report: ✅ 0 Failed, 245 Passed, 36 Skipped, 47.51s Total Time |
83602e1
to
539a9c1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this will only be used once a year:
- (nit) Use Generated Enums: Let's consider using generatedEnums (like ResourceType.Collection) instead of hardcoded strings. This will help keep the file updated with future changes, especially since it lacks tests.
- (nit) Keyword Arguments: Since many functions have multiple parameters, using keyword arguments over positional arguments might enhance clarity and safety.
- Add a README: Could you please add a simple README outlining the expected folder structure and usage steps? This will be helpful since this script is run infrequently.
Thank you!
import { FileLogger } from "../FileLogger" | ||
|
||
// Update the logger path if required | ||
const logger = new FileLogger("./publishCollectionById.log") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit - should be publishDraftCollection.log
for consistency across files
export const createCollectionFromLocal = async ( | ||
contentDir: string, | ||
siteId: number, | ||
indexPageName: string, // should be placed outside the folder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if i understand why this should be placed outside the folder?
Problem
Needed scripts to manage collection resources in the database for content migration.
Closes ISOM-1700
Solution
Breaking Changes
Features:
New scripts:
backupCollectionById.ts
: Backs up a collection and its resources to JSON filescreateCollectionFromLocal.ts
: Creates a new collection from local JSON contentdeleteCollectionById.ts
: Safely deletes a collection and all associated resourcespublishDraftCollection.ts
: Publishes a draft collection and its child resourcesTests
Scripts should be tested with:
Each script includes error handling and transaction support to maintain data integrity.