Join two firebase tables or be able to represent the results in an ionic model object

0

We have a big problem when it comes to browsing the database and taking the data from firebase to ionic. We have a database structure in the following way:

  "dato" : {
    "dat01" : {
      "descripcion" : "Desc",
      "tem01" : true,
      "tema" : "tem01",
      "titulo" : "Titulo",
      "urlAudio" : {
        "aud1" : "Url1",
        "aud2" : "Url2"
        }
    },
    "dat02" : {
      "descripcion" : "Desc",
      "tem01" : true,
      "tema" : "tem01",
      "titulo" : "Titulo",
      "urlAudio" : {
        "aud1" : "Url1",
        "aud2" : "Url2"
        }
    },
    "dat03" : {
      "descripcion" : "Desc",
      "tem01" : true,
      "tema" : "tem01",
      "titulo" : "Titulo",
      "urlAudio" : {
        "aud1" : "Url1",
        "aud2" : "Url2"
        }
    }
  },
  "tema" : {
    "tem01" : {
      "descripcionT" : "Descripcion",
      "icono" : "https://url",
      "dato" : {
        "dat01" : true,
        "dat02" : true
      },
      "tituloT" : "Titulo"
    }
  }

And in the code we access the data in the following way (in the constructor)

  constructor(public navCtrl: NavController,public actionSheetCtrl: ActionSheetController , public alertCtrl: AlertController, public afDatabase: AngularFireDatabase) {
    this.temaRef = this.afDatabase.list('/tema');
    this.temas= this.temaRef.snapshotChanges().map(changes => {
      return changes.map(c => ({key: c.payload.key, ...c.payload.val() }));
    });
  }

I do not know how to deal with topics, for example, to save it in a Model Object to be able to work with it or traverse the data filtering by data contained in the topic. To be able to extract the data of a subject.

Any advice or help on the subject would be appreciated .. I do not find many examples with this type of structures

Thanks

    
asked by jcastanos 29.05.2018 в 22:26
source

0 answers