EnsembleUI / ensemble

Build native apps 20x faster than Flutter, RN or any other tech
https://ensembleui.com/
BSD 3-Clause "New" or "Revised" License
118 stars 15 forks source link

firestore: support for aggregate functions like sum() and average() #1507

Open TheNoumanDev opened 1 month ago

TheNoumanDev commented 1 month ago

Flutter has added support for aggregate functions in firestore so ensemble should also provide support for it as its the basic function that every developer use.

kmahmood74 commented 1 month ago

@TheNoumanDev post the sample EDL here. Make sure that is always part of the ticket.

TheNoumanDev commented 1 month ago

Sample EDL @kmahmood74

View:
    header:
      title: Firestore Operations
      styles:
         surfaceTintColor: transparent

    onLoad:
      invokeAPI:
        name: getProjectsFileSum

    body:
      Column:
        styles:
          mainAxis: center
          crossAxis: center
        children:
          - Text:
              text: ${getProjectsFileSum.body['sum']}
              styles:
                textStyle:
                  fontWeight: bold
                alignment: center

API:
  getProjectsFileSum:
    inputs:
      - userId
    type: firestore
    path: users/${userId}/Projects
    aggregate:
      type: sum # that could be average/count
      field: filesCount # field is required for sum/average