Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: updated docs in TimerSessionRepository #170

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,55 @@ interface TimerSessionRepository : TimersStateMachine, Repository {
*
* @param timerId The id of the timer.
* @param userId The id of the user that joins.
* @param joinTime The Unix time at which the user joined the timer session.
*/
suspend fun addUser(timerId: TimerId, userId: UserId, joinTime: UnixTime)

/**
* Removes user from session in given timer with [timerId].
*
* @param timerId from which user will be removed
* @param userId which user will be removed
* @param onEmpty invokes if in session no user left
* @param timerId From which user will be removed.
* @param userId Which user will be removed.
*/
suspend fun removeUser(timerId: TimerId, userId: UserId)

/**
* Get a id of the timer of current session.
*
* @param userId The id of the user that joins.
* @param lastActiveTime The Unix time at which the user joined the timer session.
*
* @return [TimerId] of a session where's the user joined or `null`.
*/
suspend fun getTimerIdOfCurrentSession(userId: UserId, lastActiveTime: UnixTime): TimerId?

/**
* Gets members of a session.
*
* @param timerId The id of the timer.
* @param pageToken A page token that identifies a specific page.
* @param lastActiveTime The Unix time at which the user joined the timer session.
*/
suspend fun getMembers(
timerId: TimerId,
pageToken: PageToken?,
lastActiveTime: UnixTime,
): Page<UserId>

/**
* Get count of members in a session.
*
* @param timerId The id of the timer.
* @param activeAfterTime The Unix time at which the user joined the timer session.
*/
suspend fun getMembersCount(timerId: TimerId, activeAfterTime: UnixTime): Count

/**
* Sets confirmation requirement of a timer to users that are currently active. We
* do not apply it to all users as users that joined after should be automatically marked as
* confirmed.
*
* @param timerId The id of the timer.
*/
suspend fun setActiveUsersConfirmationRequirement(timerId: TimerId)

Expand All @@ -59,27 +76,33 @@ interface TimerSessionRepository : TimersStateMachine, Repository {
*
* @param timerId The id of the timer.
* @param userId The id of the user that confirms his attendance.
* @param confirmationTime The Unix time of moment when user ben confirmed.
*
* @return [Boolean] whether there's any other user left to confirm his attendance.
*/
suspend fun markConfirmed(timerId: TimerId, userId: UserId, confirmationTime: UnixTime): Boolean

/**
* Removes all users that didn't have activity after given [afterTime].
* @param afterTime last active time after which all users will be removed.
*
* @param afterTime The Unix time of last active time after which all users will be removed.
*/
suspend fun removeInactiveUsers(afterTime: UnixTime)

/**
* Removes all users that haven't confirmed his attendance.
*
* @param timerId timer from which we're going to remove users that didn't confirmed
* @param timerId The timer from which we're going to remove users that didn't confirmed
* their attendance.
*/
suspend fun removeNotConfirmedUsers(timerId: TimerId)

/**
* Updates last user activity time in session. It should be done every 5-10 minutes by the client.
*
* @param timerId The id of the timer.
* @param userId The id of the user that confirms his attendance.
* @param time The Unix time of last user activity.
*/
suspend fun updateLastActivityTime(timerId: TimerId, userId: UserId, time: UnixTime)
}
Expand Down