Help us shape the future of Go! Take the 2026 Go Developer Survey

invites

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package invites provides the invite utilities for minder

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCode

func GenerateCode() string

GenerateCode generates a random invite code

func GetExpireIn7Days

func GetExpireIn7Days(t time.Time) *timestamppb.Timestamp

GetExpireIn7Days returns the expiration date of the invitation 7 days from t.Now()

func IsExpired

func IsExpired(t time.Time) bool

IsExpired checks if the invitation has expired

Types

type InviteService

type InviteService interface {
	// CreateInvite creates a new user invite
	CreateInvite(ctx context.Context, qtx db.Querier, eventsPub interfaces.Publisher,
		emailConfig serverconfig.EmailConfig, targetProject uuid.UUID, authzRole authz.Role, inviteeEmail string,
	) (*minder.Invitation, error)

	// UpdateInvite updates the invite status
	UpdateInvite(ctx context.Context, qtx db.Querier, eventsPub interfaces.Publisher,
		emailConfig serverconfig.EmailConfig, targetProject uuid.UUID, authzRole authz.Role, inviteeEmail string,
	) (*minder.Invitation, error)

	// RemoveInvite removes the user invite
	RemoveInvite(ctx context.Context, qtx db.Querier, code string,

	) error

	// GetInvitesForSelf gets all invites for the current user (from context)
	GetInvitesForSelf(ctx context.Context, qtx db.Querier, idClient auth.Resolver) ([]*minder.Invitation, error)

	// GetInvite returns an invite by its code, or an error if none is found.
	GetInvite(ctx context.Context, qtx db.Querier, code string) (*minder.Invitation, error)

	// GetInviteForEmail returns an invite for a given email and project.
	GetInvitesForEmail(ctx context.Context, qtx db.Querier, targetProject uuid.UUID,
		inviteeEmail string,
	) ([]*minder.Invitation, error)

	// ListInvitationsForProject lists all invitations for a project (admin view, no codes)
	ListInvitationsForProject(ctx context.Context, qtx db.Querier, targetProject uuid.UUID) ([]*minder.Invitation, error)
}

InviteService encapsulates the methods to manage user invites to a project

func NewInviteService

func NewInviteService() InviteService

NewInviteService creates a new instance of InviteService

Directories

Path Synopsis
Package test provides a fake implementation of InviteService for testing Initially generated by Claude Sonnet 4.5 with the following prompt: > Generate a fake for the `InviteService` in the directory `internal/invites/fake`.
Package test provides a fake implementation of InviteService for testing Initially generated by Claude Sonnet 4.5 with the following prompt: > Generate a fake for the `InviteService` in the directory `internal/invites/fake`.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL