38 lines
901 B
Go
38 lines
901 B
Go
|
|
package usecase
|
||
|
|
|
||
|
|
import "context"
|
||
|
|
|
||
|
|
// ValidateInviteRequest checks an invite code without consuming it.
|
||
|
|
type ValidateInviteRequest struct {
|
||
|
|
TenantID string
|
||
|
|
Code string
|
||
|
|
}
|
||
|
|
|
||
|
|
// InviteView is a read-only invite snapshot.
|
||
|
|
type InviteView struct {
|
||
|
|
ID string
|
||
|
|
TenantID string
|
||
|
|
NewUsersOnly bool
|
||
|
|
RemainingUses int64
|
||
|
|
}
|
||
|
|
|
||
|
|
// ConsumeInviteRequest consumes one use of an invite code.
|
||
|
|
type ConsumeInviteRequest struct {
|
||
|
|
TenantID string
|
||
|
|
Code string
|
||
|
|
}
|
||
|
|
|
||
|
|
// ConsumedInvite is returned after a successful consume.
|
||
|
|
type ConsumedInvite struct {
|
||
|
|
ID string
|
||
|
|
TenantID string
|
||
|
|
NewUsersOnly bool
|
||
|
|
UsedCount int64
|
||
|
|
}
|
||
|
|
|
||
|
|
// InviteUseCase validates and consumes registration invite codes.
|
||
|
|
type InviteUseCase interface {
|
||
|
|
Validate(ctx context.Context, req *ValidateInviteRequest) (*InviteView, error)
|
||
|
|
Consume(ctx context.Context, req *ConsumeInviteRequest) (*ConsumedInvite, error)
|
||
|
|
}
|