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

docs: Design section for the managing Firestore data. #1150

Closed
wants to merge 3 commits into from

Conversation

solid-dimakoniaiev
Copy link
Contributor

@solid-dimakoniaiev solid-dimakoniaiev commented Mar 2, 2021

Fixes #1131

Checklist

  • Documented

@solid-dimakoniaiev solid-dimakoniaiev self-assigned this Mar 2, 2021
@bootstraponline bootstraponline force-pushed the design_doc_firestore_data branch from a13d15b to 0821900 Compare March 2, 2021 13:37
@bootstraponline bootstraponline force-pushed the design_doc_firestore_data branch 2 times, most recently from e471ba2 to e0515d9 Compare March 3, 2021 13:23
@bootstraponline bootstraponline force-pushed the design_doc_firestore_data branch from e0515d9 to 9bbe10d Compare March 3, 2021 13:27
Copy link
Contributor

@solid-vovabeloded solid-vovabeloded left a comment

Choose a reason for hiding this comment

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

Good job, @solid-dimakoniaiev & @solid-yuriiuvarov! I've added a couple of initial suggestions here - please take a look.

and [allowed domains](https://github.com/platform-platform/monorepo/blob/master/docs/19_security_audit_document.md#the-allowed_email_domains-collection) collections data.
To implement these methods, the repository using the [dartbase_admin package](https://pub.dev/packages/dartbase_admin) as described in the [decision](#decision).

### FirebaseService
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe it would be great to create a separate Service for Firestore to make it more SRP. The FirebaseService will be responsible for configuring the Firebase project, and the FirestoreService will be responsible for managing the Firestore Database data. What do you think?

### GcloudService

The `GcloudService` is an existing service interface, in which we should add the following methods required for this integration:
- `downloadServiceKey` - downloads a service account's key;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- `downloadServiceKey` - downloads a service account's key;
- `createServiceKey` - downloads a service account's key;

Does it make sense since it seems like this method will create the key firstly and then download it?

### FirebaseService

The `FirebaseService` is an existing service interface, in which we should add the following methods required for this integration:
- `seedFirestoreData` - seeds Firestore database with required data;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be better to name this method something like setInitialData or addIntialData?


### GcloudService

The `GcloudService` is an existing service interface, in which we should add the following methods required for this integration:
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be great to add more context here about why do we need these methods. The same for other sections, I believe it would be great to have a bit more context.

class FirestoreConfigRepository {
- _firestore : Firestore
+ addAllowedDomain(String domain) : Future<void>
+ setFeatureConfig(bool isPasswordSignInOptionEnabled, bool isDebugMenuEnabled): Future<void>
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this class have a method used to init the FirebaseAdmin SDK?


The `FirebaseService` is an existing service interface, in which we should add the following methods required for this integration:
- `seedFirestoreData` - seeds Firestore database with required data;
- `initAdminFirestore` - initializes Firestore database with Admin privileges.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the FirebaseService shouldn't know anything about implementation details, so it should not know anything about Firestore Admin i believe.

}
}

Deployer --> FirebaseServiceAdapter : uses
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Deployer --> FirebaseServiceAdapter : uses
Deployer --> FirebaseService : uses

?

### FirebaseServiceAdapter

The `FirebaseServiceAdapter` is an adapter for the [`FirebaseService`](#FirebaseService), which implements new added methods using the [`FirestoreConfigRepository`](#FirestoreConfigRepository) and the [dartbase_admin package](https://pub.dev/packages/dartbase_admin).

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we mention somewhere here that we should move the FeatureConfig and FeatureConfigData to the core package?


The `GcloudService` is an existing service interface, in which we should add the following methods required for this integration:
- `downloadServiceKey` - downloads a service account's key;
- `deactivateServiceKey` - deactivates a service account's key.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add any methods to the GcloudCli class to implement these methods in the GcloudCliServiceAdapter?

@github-actions github-actions bot locked and limited conversation to collaborators Mar 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Metrics CLI] Create a design doc for the managing Firestore data.
3 participants