Firestore Setup and Creating Collections
Step 1: Initialize Firestore in Firebase
- Access the Firebase Console.
- Select your project (e.g., DobuleFoodDelivery).
- Navigate to Firestore Database in the left menu.
- Click "Create database" and choose the start mode (production mode or test mode).
Step 2: Define Collections and Fields
It is crucial for the customer to correctly create the collection names and field names in Firestore. This ensures that the application functions as intended and that data is properly organized and accessible.
Here’s how to create the necessary collections and their corresponding fields:
collection name: users
- email: String (user's email address)
- photo_url: Image Path (user's avatar or image url address)
- uid: String (user's unique ID number)
- created_time: DateTime (user's registration date & time)
- phone_number: String (user's phone number)
- Password: String
- lastname: String (user's Last name)
- display_name: String (user's name)
- account_users: List (String)
- watching_plan_ref: String
- subscription_date_start: DateTime
- subscription_date_end: DateTime
- account_user_amount: Integer
- watching_plan_name: String
- status: String
- country: String
- city: String
- state: String
- address: String
- zipCode: String
- acc_user: Boolean
- watch_amount: Integer
collection name: account_user
- photo: Image Path (account user's avatar or image url address)
- created_time: DateTime (account user's registration date & time)
- movieshow_ref_mylist: List (String)
- username: String (account user's username)
- allmovie_ref_mylist: List (String)
- like_for_movie_ref: List (String)
- notification_movie_ref: List (String)
collection name: genres
- name: String (Name of restaurant)
collection name: categories
- name: String (Name of restaurant)
collection name: watching_plan
- name: String
- price: Double
- amount: Integer
- person: Integer
- description: String
collection name: mylist
- name: String
- thumbnail: Image Path
- movie_url: Video Path
- movie: Boolean
- tv_show: Boolean
- description: String
- cast: String
- creator: String
- produced: integer
- country_from: String
- dolbi_vision: Boolean
- hd: Boolean
- ultra_hd: Boolean
- age13plus: Boolean
- age16plus: Boolean
- age18plus: Boolean
- category: List (String)
- genre: List (String)
- account_user_ref: Doc Reference (account_user)
- trailer_image_1: Image Path
- trailer_movie_1: Video Path
- trailer_image_2: Image Path
- trailer_movie_2: Video Path
- trailer_image_3: Image Path
- trailer_movie_3: Video Path
- number_of_episodes: integer
- trailer_url: Video Path
- allmovie_ref: Doc Reference (AllMovies)
- season: integer
- likes: integer
collection name: notifications
- name: String
- coming: DateTime
- trailer_image_url: Image Path
- trailer_video_url: Video Path
- account_user: Doc Reference (account_user)
- all_movie_ref: Doc Reference (AllMovies)
collection name: orders
- product_ref: String
- name: String
- watch_amount: Integer
- price: Double
- date: DateTime
- buyer: Doc Reference (users)
- account_amount: Integer
- activated: Boolean
- transaction_output: String
- payment_method: String
- product_description: String
collection name: payment_methods
- type: String
- key: String
collection name: tvshow_seasons
- season: Integer)
- total_episodes: Integer
- episode_number: Integer
- show_duration_min: Integer
- episode_name: String
- episode_thimbnail: Image Path
- episode_url: Video Path
- episode_description: String
- season_produced: Integer
- allmovie_ref: Doc Reference (AllMovies)
collection name: descriptions
- mylist: String
- genres: String
- category: String
- tvshow: String
- movies: String
collection name: AllMovies
- movie: Boolean
- tvshow: Boolean
- thumbnail: Image Path
- bigthumbnail: Image Path
- name: String
- description: String
- movie_url: Video Path
- genre: List (String)
- category: List (String)
- cast: String
- creator: String
- produced: integer
- country_from: String
- dolbi_vision: Boolean
- hd: Boolean
- ultra_hd: Boolean
- quality4K: Boolean
- quality8K: Boolean
- age13plus: Boolean
- age16plus: Boolean
- age18plus: Boolean
- season: integer
- number_of_episodes: integer
- trailer_image_1: Image Path
- trailer_movie_1: Video Path
- trailer_image_2: Image Path
- trailer_movie_2: Video Path
- trailer_image_3: Image Path
- trailer_movie_3: Video Path
- feature: Boolean
- coming_date: DateTime
- coming_soon: DateTime
- published: Boolean
- draft: Boolean
- likes: Integer
collection name: company
- name: String
- email: String
- phone: String
- country: String
- city: String
- state: String
- zip: String
- address: String
- logo_1: Image Path
- logo_2: Image Path
- logo_3: Image Path
- facebook: String
- twitter: String
- dribbble: String
- behance: String
- google: String
- privacy: String
- terms: String
Step 3: Adding Data to Collections
- Manually add data: In the Firestore section of the Firebase Console, select the appropriate collection and click "Add document". Enter the fields and values for each document.
- Programmatic data entry: Use the Firebase SDK in your application code to add, modify, or delete documents based on user interactions or administrative inputs.
Step 4: Set Security Rules
Configure security rules to ensure that only authorized users can access or modify data. This can be done in the "Rules" tab of Firestore in the Firebase Console.
Conclusion
After setting up your Firestore database and creating the necessary collections, integrate this data structure into your app and ensure all functionalities related to data handling are properly tested and configured.
For further assistance, refer to the video tutorials provided below.