Coverage Summary for Class: WorkspaceInvite (com.georgeci.moneysurfer.domain.model)
| Class |
Class, %
|
Method, %
|
Branch, %
|
Line, %
|
Instruction, %
|
| WorkspaceInvite |
100%
(1/1)
|
100%
(1/1)
|
|
100%
(12/12)
|
100%
(77/77)
|
package com.georgeci.moneysurfer.domain.model
import com.georgeci.moneysurfer.domain.primitives.UserId
import com.georgeci.moneysurfer.domain.primitives.WorkspaceId
import com.georgeci.moneysurfer.domain.primitives.WorkspaceInviteId
import kotlin.time.Instant
/**
* Email-based invitation to a [Workspace].
*
* Lives at `workspaces/{workspaceId}/invites/{id}` in Firestore. The invitee discovers
* pending invites in-app via [email] match (no email delivery — see md/members.md decision 4).
*
* - [targetUserId] is populated lazily (null when first invited unknown email; resolved on
* accept). Faster lookup for return users.
* - Expiration is checked client-side: status PENDING + `now > expiresAt` ⇒ display as EXPIRED.
* Persisted EXPIRED only on explicit transition.
*/
data class WorkspaceInvite(
val id: WorkspaceInviteId,
val workspaceId: WorkspaceId,
val email: String,
val targetUserId: UserId?,
val role: WorkspaceRole,
val status: InviteStatus,
val invitedByUserId: UserId,
val createdAt: Instant,
val updatedAt: Instant,
val expiresAt: Instant,
val respondedAt: Instant? = null,
)