steadyequipment / node-firestore-backup

Google Firebase Firestore backup tool
190 stars 51 forks source link

Added functionality to store datatype with values #18

Closed s-shiva1995 closed 6 years ago

s-shiva1995 commented 6 years ago

This can handle basic datatypes supported by firestore and reference now returns the path of references document from root collection with typeof as reference.

yoiang commented 6 years ago

Hey @s-shiva1995 , thanks so much for the contribution, it looks great!

I was wondering if there was a good alternative to using typeof on the same level as actual members inside of an object. It mixes metaphors, which is confusing, and also will conflict in the potential situation where an object contains an actual member named typeof. Potentially objects could use value similar to basic types where value would contain all of its members.

Also, this is more my personal taste, but I feel typeof more Javascript than Firestore, how do you feel about just calling the member type?

Finally I was wondering why you store members of an array as object rather than in an array?

yoiang commented 6 years ago

I've created a new branch starting with your PR: s-shiva1995-patch-18

It includes organization inspired by the functionality you added as well as Flow coverage of the new code. If you don't mind I'd like to use this as the continuation point!

s-shiva1995 commented 6 years ago

Sure, well typeof or type both describe one and the same thing, but type keyword suits better.

About storing array also as object, I did this to simplify restoring code. So that I can check which type of data is available in object and simply run the function to restore it accordingly.

yoiang commented 6 years ago

Gotcha! Ah you've already done work on the restore functionality, that's awesome 👍

I sent you a PR with these changes, if it looks good updated your PR here and I'll merge it in!

yoiang commented 6 years ago

Ah thanks for catching those places I missed. I'd be good to have Flow coverage of that portion at some point. I'm going to spend a little trying to improve the CODEBEAT score and then merge it!

yoiang commented 6 years ago

I'm going to merge this with the additional changes I pushed back at you unless there's anything else you'd like to get in!