Files
no-copy/referral/src/main/kotlin/ReferralRepo.kt
T

33 lines
1.1 KiB
Kotlin
Raw Normal View History

2026-02-05 15:43:33 +07:00
package ru.soune
interface ReferralRepo {
2026-02-06 01:01:34 +07:00
fun getUserReferralLink(userId: Long): String
2026-02-05 15:43:33 +07:00
2026-02-06 19:27:25 +07:00
fun getUserIdByLink(link: String): Long?
2026-02-05 15:43:33 +07:00
2026-02-06 01:01:34 +07:00
fun getInviterIdForUser(userId: Long): Long?
2026-02-05 15:43:33 +07:00
2026-02-06 01:01:34 +07:00
fun getReferralLevelForUser(userId: Long): String
2026-02-05 15:43:33 +07:00
2026-02-06 01:01:34 +07:00
fun getReferralByUserId(userId: Long): Referral
2026-02-05 15:43:33 +07:00
2026-02-06 01:01:34 +07:00
fun getReferralInvitees(userId: Long, pageSize: Int, pageNumber: Int): List<ReferralInvitee>
2026-02-05 15:43:33 +07:00
// создаем новую запись в БД
fun createReferralEntity(entity: Referral)
// прибавить к totalIncome и availableIncome значение transferAmount
2026-02-06 01:01:34 +07:00
fun increaseIncome(userId: Long, transferAmount: Int)
2026-02-05 15:43:33 +07:00
// установить active в true
2026-02-06 01:01:34 +07:00
fun activateUser(userId: Long): Boolean
2026-02-05 15:43:33 +07:00
// посчитать записи, у которых inviter == userId и active == true
2026-02-06 01:01:34 +07:00
fun getActiveInviteeForUser(userId: Long): Int
2026-02-05 15:43:33 +07:00
// посчитать записи, у которых inviter == userId
2026-02-06 01:01:34 +07:00
fun getTotalInviteeForUser(userId: Long): Int
2026-02-05 15:43:33 +07:00
2026-02-06 01:01:34 +07:00
fun upgradeReferralLevelForUser(userId: Long, newLevelId: String)
2026-02-05 15:43:33 +07:00
}