contract

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package contract is the waitlist plugin's forge-dashboard contract surface. Six intents wrap the plugin's Store: list, detail, approve, reject, delete, counts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(
	d *dispatcher.Dispatcher,
	reg contract.Registry,
	wreg contract.WardenRegistry,
	deps Deps,
) error

Types

type ApproveInput

type ApproveInput struct {
	ID   string `json:"id"`
	Note string `json:"note,omitempty"`
}

type CountsResponse

type CountsResponse struct {
	Pending  int `json:"pending"`
	Approved int `json:"approved"`
	Rejected int `json:"rejected"`
}

type DeleteInput

type DeleteInput struct {
	ID string `json:"id"`
}

type Deps

type Deps struct {
	Engine *authsome.Engine
	Store  WaitlistStore
}

type EntryList

type EntryList struct {
	Entries    []EntrySummary `json:"entries"`
	Total      int            `json:"total,omitempty"`
	NextCursor string         `json:"nextCursor,omitempty"`
}

EntryList wraps a paginated list response.

type EntryListRows

type EntryListRows struct {
	Entries    []*EntryRow
	Total      int
	NextCursor string
}

type EntryQuery

type EntryQuery struct {
	AppID  id.AppID
	Email  string
	Status string
	Cursor string
	Limit  int
}

type EntryRow

type EntryRow struct {
	ID        id.WaitlistID
	AppID     id.AppID
	Email     string
	Name      string
	Status    string
	UserID    *id.UserID
	IPAddress string
	Note      string
	CreatedAt time.Time
	UpdatedAt time.Time
}

EntryRow + EntryQuery + EntryList are the package-internal wire types the plugin's Store fronts. They mirror waitlist.WaitlistEntry / WaitlistQuery / WaitlistList so the contract subpackage stays decoupled from the parent (cycle avoidance).

type EntrySummary

type EntrySummary struct {
	ID        string `json:"id"`
	Email     string `json:"email"`
	Name      string `json:"name,omitempty"`
	Status    string `json:"status"`
	UserID    string `json:"userId,omitempty"`
	IPAddress string `json:"ipAddress,omitempty"`
	Note      string `json:"note,omitempty"`
	CreatedAt string `json:"createdAt"`
	UpdatedAt string `json:"updatedAt,omitempty"`
}

EntrySummary is the wire shape for waitlist.list rows.

type GetEntryInput

type GetEntryInput struct {
	ID string `json:"id"`
}

type ListEntriesInput

type ListEntriesInput struct {
	Email  string `json:"email,omitempty"`
	Status string `json:"status,omitempty"`
	Cursor string `json:"cursor,omitempty"`
	Limit  int    `json:"limit,omitempty"`
}

type RejectInput

type RejectInput struct {
	ID   string `json:"id"`
	Note string `json:"note,omitempty"`
}

type WaitlistStore

type WaitlistStore interface {
	GetEntry(ctx context.Context, id id.WaitlistID) (*EntryRow, error)
	UpdateEntryStatus(ctx context.Context, id id.WaitlistID, status, note string) error
	ListEntries(ctx context.Context, q *EntryQuery) (*EntryListRows, error)
	CountByStatus(ctx context.Context, appID id.AppID) (pending, approved, rejected int, err error)
	DeleteEntry(ctx context.Context, id id.WaitlistID) error
}

WaitlistStore is the surface this package needs from the waitlist plugin's Store.

Jump to

Keyboard shortcuts

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