Add UserIdUtils for generic no primary key situation handling

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-07-23 16:02:56 +02:00
parent 1cec9045ee
commit c4c183ac39
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B

View File

@ -0,0 +1,15 @@
package com.nextcloud.talk.utils
import com.nextcloud.talk.data.user.model.User
object UserIdUtils {
private const val NO_ID: Long = -1
fun getIdForUser(user: User?): Long {
return if (user?.id != null) {
user.id!!
} else {
NO_ID
}
}
}