Skip to content

Conversation

@michaelprichardson
Copy link
Collaborator

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.

@michaelprichardson
Copy link
Collaborator Author

Will update the readme for new features

src/common.ts Outdated
Comment on lines 21 to 26
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;
}
Copy link
Member

@nbransby nbransby Jul 17, 2020

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?

Copy link
Collaborator Author

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

@nbransby nbransby merged commit b9d9b05 into master Jul 20, 2020
@nbransby nbransby deleted the flag-to-delete-subcollection branch July 20, 2020 12:08
@michaelprichardson michaelprichardson linked an issue Jul 22, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flag to delete subcollection

3 participants