FlutterFlow query collection HELP

  • ステータス: Closed
  • 賞金: €200
  • 受け取ったエントリー: 6
  • 優勝者: zeeshan5121472

コンテスト概要

Project Overview :

Hello, I am working on a FlutterFlow app that functions like Tinder, but for objects (articles). I am facing a technical issue with how data is queried and displayed, and I need assistance to resolve it.

--------------------------------------------------------
Database Architecture

Here is the current structure of the database:

Users Collection

• Document ID: User ID
• Fields:
• name: String
• email: String
• likedItems: Array of Article IDs
• lastDocId: Reference to the last retrieved document (for pagination purposes)

Articles Collection

• Document ID: Article ID
• Fields:
• type: String
• name: String
• description: String
• price: Number
• power: Number
• (other fields as required)

userCards Collection

• Document ID: userCard ID
• Fields:
• article: Article ID (reference to the article in the Articles collection)
• Any modified fields (e.g., if the price was changed, it’s saved here)

----------------------------------
App Workflow

1. Swiping and Liking Articles:
• Users can swipe through articles.
• When a user likes an article (swipes right), the article’s ID is saved in the likedItems array in the Users Collection.
2. Viewing Liked Articles:
• On a dedicated page, all articles the user has swiped (liked) are displayed.
• This includes articles from the Articles Collection and, if the user has modified any fields (e.g., price), those changes are fetched from the userCards Collection.
3. Editing Liked Articles:
• Users can modify specific fields (e.g., price) for the articles they liked.
• These modifications are saved as new documents in the userCards Collection, which store only the modified fields and the reference to the original article in the Articles Collection.
-----------------------------------
The Problem

I need to display all liked articles on the “Liked Articles” page. This includes:
• Unmodified articles: Fetched directly from the Articles Collection.
• Modified articles: Fetched from the userCards Collection, but merged with the original data from the Articles Collection (since userCards contains only the modified fields).

Challenges

• The data is split across two collections (Articles and userCards), and I need a real-time update whenever there’s a change.
• Currently, I’m using a Cloud Function, but:
• It’s slow and requires re-triggering the page to update.
• It doesn’t work well with FlutterFlow’s real-time capabilities.
• A naive solution is to copy all article data into userCards whenever a user likes an article. However, this creates unnecessary duplication and is not efficient.
---------------------------------
What I Need

1. A real-time solution that:
• Fetches and merges data from the Articles and userCards collections.
• Displays the merged data seamlessly on the “Liked Articles” page.
2. Alternatives to Cloud Functions:
• I want to avoid Cloud Functions if possible, as they are not clean or smooth for this use case.
• The solution should leverage FlutterFlow’s capabilities, such as queries or custom actions, to achieve real-time updates.
3. Flexibility:
• I’m open to completely restructuring the database if it helps solve the problem efficiently.
---------------------------
Optional Thoughts

• Copying Article Data: While it’s possible to copy all article data into the userCards collection when a user likes an article, this feels like an inefficient solution. I’d prefer to avoid this unless it’s the only viable option.
• Custom Function/Action: Can a custom action fetch, merge, and display the data in real time? My understanding is that this might still require manual triggering (e.g., onLoad), which defeats the purpose of real-time updates.
-------------------------
Final Notes

Please propose a solution that ensures clean, efficient, and real-time data handling. If the database structure needs to be reworked, that’s fine. The goal is to display all liked articles (modified and unmodified) efficiently and in real time.
-----------------------

推奨スキル

採用者フィードバック

“Thanks ! found the solution for my issue in FlutterFlow And nice support after the solution found ! thanks again”

プロフィール画像 hugobay, France.

このコンテストのトップエントリー

エントリーをもっと表示

公開説明ボード

メッセージはありません。

コンテストの開始方法

  • あなたのコンテストを投稿

    あなたのコンテストを投稿 速くて簡単

  • たくさんのエントリーを集めましょう

    たくさんのエントリーを集めましょう 世界中から

  • ベストエントリーをアワード

    ベストエントリーをアワード ファイルをダウンロード - 簡単!

コンテストを今すぐ投稿 または本日参加!