rafaelklaessen / keep-clone

An effort to make a clone of Google Keep in play-scala with Firebase.
Other
16 stars 6 forks source link

Objectify Firebase stuff #17

Closed rafaelklaessen closed 7 years ago

rafaelklaessen commented 7 years ago

Instead of returning like Array[Map[String, Array[String]]]

rafaelklaessen commented 7 years ago

Apparently Firebase can't read the Scala class fields. I was only able to make them a little more object oriented.

Titogelo commented 7 years ago

I don't have a lot of time today. But let's say if I can help you here.

There is a problem of concept with your approach. As far I read and I understood from the documentation there is no need to keep a parallel data structure in your local.

Firebase works with a database reference that stores your data. Any function from the CRUD ( create, read, update, delete) is applied to this database reference.

Read this documentation:

I hope I am not wrong it is also my first time with this, and I also hope that it helps.

Titogelo commented 7 years ago

I didn't take a look at your code but I am replying just from your comments.

rafaelklaessen commented 7 years ago

What I mean is that I tried to use the User class for saving users to the database (rather than using .setValue for all the child fields), but that Firebase can't read its fields even though they're public.

rafaelklaessen commented 7 years ago

Okay, I fixed it! If we use getters instead of just public fields, it does work. Guess it's some Scala->Java thingy.

rafaelklaessen commented 7 years ago

I've made the user registering OO with getters. However, the notes work a bit different so I don't know about that yet.