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-one-to-one): replace the ref params with the documents uid #62

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions firestore-one-to-one/extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,6 @@ params:
example: capitals
required: true

- param: COLLECTION_A_REF_FIELD
label: Collection A reference field
description: >-
The name of the field in Collection A that will contain a reference to Collection B.
type: string
example: capitalId
required: true

- param: COLLECTION_B_REF_FIELD
label: Collection B reference field
description: >-
The name of the field in Collection B that will contain a reference to Collection A.
type: string
example: countryId
required: true

- param: COLLECTION_A_DATA_FIELD
label: Collection A data field
description: >-
Expand Down
7 changes: 0 additions & 7 deletions firestore-one-to-one/functions/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ export enum DeletionBehavior {
interface Config {
collectionAPath: string;
collectionBPath: string;
collectionARefField: string;
collectionBRefField: string;
collectionADataField: string;
collectionBDataField: string;
fieldsToCopyFromAToB?: string[];
Expand All @@ -21,8 +19,6 @@ interface Config {
const config: Config = {
collectionAPath: process.env.COLLECTION_A_PATH!,
collectionBPath: process.env.COLLECTION_B_PATH!,
collectionARefField: process.env.COLLECTION_A_REF_FIELD!,
collectionBRefField: process.env.COLLECTION_B_REF_FIELD!,
collectionADataField: process.env.COLLECTION_A_DATA_FIELD!,
collectionBDataField: process.env.COLLECTION_B_DATA_FIELD!,
fieldsToCopyFromAToB: process.env.FIELDS_TO_COPY_FROM_A_TO_B?.split(","),
Expand All @@ -35,23 +31,20 @@ const config: Config = {

export interface CollectionConfig {
collectionPath: string;
refField: string;
dataField: string;
fieldsToCopy?: string[];
deletionBehavior: DeletionBehavior;
}

export const collectionAConfig: CollectionConfig = {
collectionPath: config.collectionAPath,
refField: config.collectionARefField,
dataField: config.collectionADataField,
fieldsToCopy: config.fieldsToCopyFromAToB,
deletionBehavior: config.collectionADeletionBehavior,
};

export const collectionBConfig: CollectionConfig = {
collectionPath: config.collectionBPath,
refField: config.collectionBRefField,
dataField: config.collectionBDataField,
fieldsToCopy: config.fieldsToCopyFromBToA,
deletionBehavior: config.collectionBDeletionBehavior,
Expand Down