Skip to content
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

feat(firestore-sheets-sync): initial commit #52

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

dackers86
Copy link
Member

No description provided.

@@ -0,0 +1,119 @@
name: sync-firestore-sheets
Copy link
Member

@Salakar Salakar Feb 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: sync-firestore-sheets
name: sync-firestore-sheets

Would suggest changing the name to match the convention of the other extensions, e.g. the service name goes first, so firestore-sheets-sync (like the folder name)

- param: FIELDS_TO_SYNC
label: Fields to sync
description: >
A list of comma-separated fields to sync to the Google Sheet. If left blank, no fields will be synced.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it not make more sense to Sync all fields if left empty?

Copy link
Member

@Salakar Salakar Feb 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required since Firestore schemaless, making the user input these fields ensures only those fields are synced, since otherwise multiple records with different fields may not work since we only have a single header row in the sheet for all data rows

At least that's my understanding :D

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As Mike said, this is the reason the field names are required

const set1 = new Set(arr1);
const set2 = new Set(arr2);
return (
arr1.every(item => set2.has(item)) && arr2.every(item => set1.has(item))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could probably be more efficient;

  1. Check the .size is equal to each other
  2. If it is, just compare a with b.

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.

5 participants