subscription

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler handles subscription-related HTTP requests.

func NewHandler

func NewHandler(usersRepo usersRepository, notesRepo notesRepository, freeNoteLimit int) *Handler

NewHandler constructs a subscription Handler.

func (*Handler) GetSubscription

func (h *Handler) GetSubscription(c *echo.Context) error

GetSubscription handles GET /api/v1/subscription. It returns the authenticated user's plan, live note count, and note limit. For pro users note_limit is null (unlimited).

type SubscriptionResponse

type SubscriptionResponse struct {
	Plan      string `json:"plan"`
	NoteCount int64  `json:"note_count"`
	NoteLimit *int   `json:"note_limit"`
}

SubscriptionResponse is the response body for GET /api/v1/subscription. NoteLimit is nil when the user is on the pro plan (unlimited notes).

type UserRecord

type UserRecord struct {
	Plan string
}

UserRecord holds the user fields needed by the subscription handler. It is exported so that adapters in other packages can satisfy the usersRepository interface without importing the users package into subscription.

Jump to

Keyboard shortcuts

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