https://kotlinlang.org logo
Title
o

orangy

06/28/2017, 8:57 PM
@vonox7 thanks! but when you get the userId, what do you do next? Do you build up an associated
AuthenticatedUser
instance from database and keep it around for the duration of HttpRequest?
v

vonox7

06/28/2017, 9:28 PM
orangy: We keep the userId for the duration of the HttpRequest. Often we need to just make CRUD operations from the database like
db.from(Post::class).where(userId = userId).findAll()
. But sometimes our User object is also needed (lets say we want to have the firstName of our user). Thats why we defined an lazy instance of it:
val Call.user by lazy<User> = db.from(User::class).where(userId = userId).findFirst()
.
o

orangy

06/28/2017, 9:31 PM
I see, thanks!