33 lines
1.1 KiB
Kotlin
33 lines
1.1 KiB
Kotlin
package ru.soune
|
|
|
|
interface ReferralRepo {
|
|
|
|
fun getUserReferralLink(userId: Long): String
|
|
|
|
fun getUserIdByLink(link: String): Long?
|
|
|
|
fun getInviterIdForUser(userId: Long): Long?
|
|
|
|
fun getReferralLevelForUser(userId: Long): String
|
|
|
|
fun getReferralByUserId(userId: Long): Referral
|
|
|
|
fun getReferralInvitees(userId: Long, pageSize: Int, pageNumber: Int): List<ReferralInvitee>
|
|
|
|
// создаем новую запись в БД
|
|
fun createReferralEntity(entity: Referral)
|
|
|
|
// прибавить к totalIncome и availableIncome значение transferAmount
|
|
fun increaseIncome(userId: Long, transferAmount: Int)
|
|
|
|
// установить active в true
|
|
fun activateUser(userId: Long): Boolean
|
|
|
|
// посчитать записи, у которых inviter == userId и active == true
|
|
fun getActiveInviteeForUser(userId: Long): Int
|
|
|
|
// посчитать записи, у которых inviter == userId
|
|
fun getTotalInviteeForUser(userId: Long): Int
|
|
|
|
fun upgradeReferralLevelForUser(userId: Long, newLevelId: String)
|
|
} |