r/Parse • u/nykod3mus • Sep 23 '19
Get Subclass Object by Pointer in _User
First of all: I am totally new to Parse and Kotlin.
I'm searching for a method to get an Object by the Pointer saved in the Column "myClassFK" in the Object of the Class _User. The guides and api provided by Parse and stackoverflow aren't really helpful.
My Database so far:
_User:
objectId: String
username: String
...
myClassFK: Pointer
MyClass:
objectId: String
testValue: String
lastLogin: Date
I am trying to build a method like following:
fun updateLastLogin() {
val myClass: MyClass = (ParseUser.getCurrentUser().get("myClassFK") as MyClass).fetch()
myClass.lastLogin = Date(System.currentTimeMillis())
myClass.saveInBackground()
}Is there anyone who can give me some advice on what Im trying to achieve? Or is this not the right way to do such operations?
1
Upvotes