-
Notifications
You must be signed in to change notification settings - Fork 0
Flag to delete subcollection #6
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
Conversation
|
Will update the readme for new features |
src/common.ts
Outdated
| export function isSubCollection(collection: string): boolean { | ||
| const filteredCollections = collection.split('/').filter(c => c.length > 0); | ||
| const numCollections = filteredCollections.length; | ||
| // Return false is equal to 1 or an even number | ||
| return numCollections !== 1 && numCollections % 2 === 1; | ||
| } |
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.
Do we need to restrict it to subcollections now? As we have an explicit flag we could allow it to work on any collection?
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 really. The explicit flag should be enough
Issue #5, added flag to delete all sub-collections. This made the foreign key optional. Added error checking so that either the flag has to be true or a foreign key provided. Only sub-collections can be deleted. Top collections cannot be.