http

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(authService service.AuthService) gin.HandlerFunc

AuthMiddleware validates JWT tokens and extracts user information

func CORSMiddleware

func CORSMiddleware() gin.HandlerFunc

CORSMiddleware handles CORS

func GetCurrentUserID

func GetCurrentUserID(c *gin.Context) uint

GetCurrentUserID extracts user ID from context (helper for handlers) Panics if user ID not found (should never happen after auth middleware)

func GetIPAddress

func GetIPAddress(c *gin.Context) string

GetIPAddress extracts client IP from request

func GetIntParam

func GetIntParam(c *gin.Context, paramName string) (int, bool)

GetIntParam extracts an int parameter from the URL

func GetStringParam

func GetStringParam(c *gin.Context, paramName string) (string, bool)

GetStringParam extracts a string parameter from the URL Returns empty string and false if not found

func GetUintParam

func GetUintParam(c *gin.Context, paramName string) (uint, bool)

GetUintParam extracts a uint parameter from the URL Returns the parsed uint and true if successful Automatically responds with 400 Bad Request if invalid

func GetUserAgent

func GetUserAgent(c *gin.Context) string

GetUserAgent extracts user agent from request

func GetUserID

func GetUserID(c *gin.Context) (uint, error)

GetUserID extracts user ID from Gin context (set by AuthMiddleware)

func IconProtectionMiddleware

func IconProtectionMiddleware() gin.HandlerFunc

IconProtectionMiddleware validates that requests come from Passwall clients

func IsDisposableEmail

func IsDisposableEmail(email string) bool

IsDisposableEmail checks if an email domain is from a disposable email service

func OptionalRecaptchaMiddleware

func OptionalRecaptchaMiddleware(secretKey string, threshold float64) gin.HandlerFunc

OptionalRecaptchaMiddleware creates a middleware that validates reCAPTCHA tokens but doesn't block requests

func RateLimitMiddleware

func RateLimitMiddleware(limiter *RateLimiter) gin.HandlerFunc

RateLimitMiddleware creates a rate limiting middleware

func RecaptchaMiddleware

func RecaptchaMiddleware(secretKey string, threshold float64) gin.HandlerFunc

RecaptchaMiddleware creates a middleware that validates reCAPTCHA tokens

func RequireAdminMiddleware

func RequireAdminMiddleware() gin.HandlerFunc

RequireAdminMiddleware ensures only admin users can access the route

func RequireRolesMiddleware

func RequireRolesMiddleware(allowedRoles ...string) gin.HandlerFunc

RequireRolesMiddleware ensures user has one of the specified roles

func SCIMAuthMiddleware

func SCIMAuthMiddleware(scimService service.SCIMService) gin.HandlerFunc

SCIMAuthMiddleware validates SCIM bearer tokens and sets org context

func SecurityMiddleware

func SecurityMiddleware() gin.HandlerFunc

SecurityMiddleware adds security headers NOTE: CSP is NOT included here because backend is an API server (not HTML server) CSP should be set in frontend HTML meta tags or via frontend web server (nginx/cloudflare)

Types

type ActivityHandler

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

func NewActivityHandler

func NewActivityHandler(activityService service.UserActivityService) *ActivityHandler

NewActivityHandler creates a new activity handler

func (*ActivityHandler) GetLastSignIn

func (h *ActivityHandler) GetLastSignIn(c *gin.Context)

GetLastSignIn returns user's last signin activity

func (*ActivityHandler) GetMyActivities

func (h *ActivityHandler) GetMyActivities(c *gin.Context)

GetMyActivities returns current user's activities

func (*ActivityHandler) GetUserActivities

func (h *ActivityHandler) GetUserActivities(c *gin.Context)

GetUserActivities returns activities for a specific user (admin only)

func (*ActivityHandler) ListActivities

func (h *ActivityHandler) ListActivities(c *gin.Context)

ListActivities returns all activities with filters (admin only)

type AdminBulkEmailCreateRequest

type AdminBulkEmailCreateRequest struct {
	Recipients []string `json:"recipients" binding:"required,min=1,max=1500"`
	Subject    string   `json:"subject" binding:"required,min=1,max=200"`
	Message    string   `json:"message" binding:"required,min=1,max=20000"`
	IsHTML     *bool    `json:"is_html"`
}

Legacy request (kept for backward compatibility with /admin/bulk-email)

type AdminLogEntryDTO

type AdminLogEntryDTO struct {
	Raw        string `json:"raw"`
	Level      string `json:"level"`
	Timestamp  string `json:"timestamp,omitempty"` // RFC3339
	Version    string `json:"version,omitempty"`
	Message    string `json:"message"`
	StatusCode int    `json:"status_code,omitempty"`
	File       string `json:"file,omitempty"`
	Line       int    `json:"line,omitempty"`
	Function   string `json:"function,omitempty"`
}

type AdminLogListResponse

type AdminLogListResponse struct {
	Items     []AdminLogEntryDTO `json:"items"`
	Total     int                `json:"total"`
	Filtered  int                `json:"filtered"`
	Truncated bool               `json:"truncated"`
	LogFile   string             `json:"log_file,omitempty"`
}

type AdminLogsHandler

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

func NewAdminLogsHandler

func NewAdminLogsHandler() *AdminLogsHandler

func (*AdminLogsHandler) Download

func (h *AdminLogsHandler) Download(c *gin.Context)

func (*AdminLogsHandler) DownloadBundle

func (h *AdminLogsHandler) DownloadBundle(c *gin.Context)

func (*AdminLogsHandler) List

func (h *AdminLogsHandler) List(c *gin.Context)

type AdminMailCreateRequest

type AdminMailCreateRequest struct {
	// send_to determines recipient source:
	// - "all_users": sends to users in the system (optionally filtered by search)
	// - "user_ids": sends to specific users by their numeric IDs
	SendTo string `json:"send_to"`

	UserIDs []uint `json:"user_ids"`
	Search  string `json:"search"`

	Subject string `json:"subject"`
	Message string `json:"message"`
	IsHTML  *bool  `json:"is_html"`
}

type AdminMailCreateResponse

type AdminMailCreateResponse struct {
	JobID string `json:"job_id"`
	Total int    `json:"total"`
}

type AdminMailHandler

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

func NewAdminMailHandler

func NewAdminMailHandler(emailSender email.Sender, userRepo repository.UserRepository, logger email.Logger) *AdminMailHandler

func (*AdminMailHandler) CreateJob

func (h *AdminMailHandler) CreateJob(c *gin.Context)

func (*AdminMailHandler) GetJob

func (h *AdminMailHandler) GetJob(c *gin.Context)

type AdminSubscriptionsHandler

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

func NewAdminSubscriptionsHandler

func NewAdminSubscriptionsHandler(
	orgRepo repository.OrganizationRepository,
	orgUserRepo repository.OrganizationUserRepository,
	subRepo interface {
		GetByOrganizationID(ctx context.Context, orgID uint) (*domain.Subscription, error)
		Create(ctx context.Context, sub *domain.Subscription) error
		Update(ctx context.Context, sub *domain.Subscription) error
	},
	planRepo interface {
		GetByCode(ctx context.Context, code string) (*domain.Plan, error)
	},
	paymentService service.PaymentService,
	userActivityService service.UserActivityService,
	logger service.Logger,
) *AdminSubscriptionsHandler

func (*AdminSubscriptionsHandler) GrantManual

func (h *AdminSubscriptionsHandler) GrantManual(c *gin.Context)

GrantManual grants a plan to an organization without payment (admin-only). Manual grant subscriptions are marked active and use renew_at as the grant end date. Subscription worker will move them to expired when renew_at passes.

POST /api/admin/organizations/:id/subscription/grant

func (*AdminSubscriptionsHandler) List

List subscriptions across all organizations (admin-only). GET /api/admin/subscriptions?search=&limit=&offset=

func (*AdminSubscriptionsHandler) ListOrganizations

func (h *AdminSubscriptionsHandler) ListOrganizations(c *gin.Context)

List organizations across the system (admin-only). GET /api/admin/organizations?search=&limit=&offset=

func (*AdminSubscriptionsHandler) RevokeManual

func (h *AdminSubscriptionsHandler) RevokeManual(c *gin.Context)

RevokeManual expires a manual grant immediately (admin-only). POST /api/admin/organizations/:id/subscription/revoke

type AuthHandler

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

func NewAuthHandler

func NewAuthHandler(
	authService service.AuthService,
	verificationService service.VerificationService,
	activityService service.UserActivityService,
	emailSender email.Sender,
	emailBuilder *email.EmailBuilder,
) *AuthHandler

NewAuthHandler creates a new auth handler

func (*AuthHandler) ChangeMasterPassword

func (h *AuthHandler) ChangeMasterPassword(c *gin.Context)

ChangeMasterPassword handles master password change

func (*AuthHandler) CheckToken

func (h *AuthHandler) CheckToken(c *gin.Context)

CheckToken validates a token

func (*AuthHandler) PreLogin

func (h *AuthHandler) PreLogin(c *gin.Context)

PreLogin returns user's KDF configuration Required before signin to derive correct Master Key on client

func (*AuthHandler) RefreshToken

func (h *AuthHandler) RefreshToken(c *gin.Context)

RefreshToken handles token refresh

func (*AuthHandler) ResendVerificationCode

func (h *AuthHandler) ResendVerificationCode(c *gin.Context)

ResendVerificationCode resends the verification code

func (*AuthHandler) SignIn

func (h *AuthHandler) SignIn(c *gin.Context)

SignIn handles user authentication (zero-knowledge) Client sends: masterPasswordHash (PBKDF2 of Master Key) Server returns: JWT + protectedUserKey + kdfConfig

func (*AuthHandler) SignOut

func (h *AuthHandler) SignOut(c *gin.Context)

SignOut handles user sign out

func (*AuthHandler) SignUp

func (h *AuthHandler) SignUp(c *gin.Context)

SignUp handles user registration (zero-knowledge) Client sends: masterPasswordHash + protectedUserKey + kdfConfig

func (*AuthHandler) VerifyEmail

func (h *AuthHandler) VerifyEmail(c *gin.Context)

VerifyEmail handles email verification

type CollectionHandler

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

func NewCollectionHandler

func NewCollectionHandler(service service.CollectionService) *CollectionHandler

func (*CollectionHandler) Create

func (h *CollectionHandler) Create(c *gin.Context)

Create godoc @Summary Create collection @Description Create a new collection in an organization @Tags collections @Accept json @Produce json @Param orgId path int true "Organization ID" @Param request body domain.CreateCollectionRequest true "Collection details" @Success 201 {object} domain.CollectionDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /organizations/{orgId}/collections [post]

func (*CollectionHandler) Delete

func (h *CollectionHandler) Delete(c *gin.Context)

Delete godoc @Summary Delete collection @Description Delete a collection @Tags collections @Param id path int true "Collection ID" @Success 204 @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /collections/{id} [delete]

func (*CollectionHandler) GetByID

func (h *CollectionHandler) GetByID(c *gin.Context)

GetByID godoc @Summary Get collection @Description Get collection by ID @Tags collections @Produce json @Param id path int true "Collection ID" @Success 200 {object} domain.CollectionDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Failure 404 {object} map[string]string @Router /collections/{id} [get]

func (*CollectionHandler) GetTeamAccess

func (h *CollectionHandler) GetTeamAccess(c *gin.Context)

GetTeamAccess godoc @Summary Get collection team access @Description Get list of teams with access to collection @Tags collections @Produce json @Param id path int true "Collection ID" @Success 200 {array} domain.CollectionTeamDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /collections/{id}/teams [get]

func (*CollectionHandler) GetUserAccess

func (h *CollectionHandler) GetUserAccess(c *gin.Context)

GetUserAccess godoc @Summary Get collection user access @Description Get list of users with access to collection @Tags collections @Produce json @Param id path int true "Collection ID" @Success 200 {array} domain.CollectionUserDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /collections/{id}/users [get]

func (*CollectionHandler) GrantTeamAccess

func (h *CollectionHandler) GrantTeamAccess(c *gin.Context)

GrantTeamAccess godoc @Summary Grant team access to collection @Description Grant or update team access to a collection @Tags collections @Accept json @Produce json @Param id path int true "Collection ID" @Param teamId path int true "Team ID" @Param request body domain.GrantCollectionAccessRequest true "Access details" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /collections/{id}/teams/{teamId} [put]

func (*CollectionHandler) GrantUserAccess

func (h *CollectionHandler) GrantUserAccess(c *gin.Context)

GrantUserAccess godoc @Summary Grant user access to collection @Description Grant or update user access to a collection @Tags collections @Accept json @Produce json @Param id path int true "Collection ID" @Param orgUserId path int true "Organization User ID" @Param request body domain.GrantCollectionAccessRequest true "Access details" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /collections/{id}/users/{orgUserId} [put]

func (*CollectionHandler) List

func (h *CollectionHandler) List(c *gin.Context)

List godoc @Summary List collections @Description List collections in an organization @Tags collections @Produce json @Param orgId path int true "Organization ID" @Success 200 {array} domain.CollectionDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /organizations/{orgId}/collections [get]

func (*CollectionHandler) RevokeTeamAccess

func (h *CollectionHandler) RevokeTeamAccess(c *gin.Context)

RevokeTeamAccess godoc @Summary Revoke team access @Description Revoke team access to a collection @Tags collections @Param id path int true "Collection ID" @Param teamId path int true "Team ID" @Success 204 @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /collections/{id}/teams/{teamId} [delete]

func (*CollectionHandler) RevokeUserAccess

func (h *CollectionHandler) RevokeUserAccess(c *gin.Context)

RevokeUserAccess godoc @Summary Revoke user access @Description Revoke user access to a collection @Tags collections @Param id path int true "Collection ID" @Param orgUserId path int true "Organization User ID" @Success 204 @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /collections/{id}/users/{orgUserId} [delete]

func (*CollectionHandler) Update

func (h *CollectionHandler) Update(c *gin.Context)

Update godoc @Summary Update collection @Description Update collection details @Tags collections @Accept json @Produce json @Param id path int true "Collection ID" @Param request body domain.UpdateCollectionRequest true "Collection details" @Success 200 {object} domain.CollectionDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /collections/{id} [put]

type CreateCheckoutRequest

type CreateCheckoutRequest struct {
	Plan         string `json:"plan" binding:"required"`          // premium, family, team, business
	BillingCycle string `json:"billing_cycle" binding:"required"` // monthly, yearly
	Seats        int    `json:"seats" binding:"required"`         // user count (quantity). Use 1 for non-per-user plans.
}

Request/Response types

type CreateCheckoutResponse

type CreateCheckoutResponse struct {
	URL string `json:"url"` // Stripe checkout URL
}

type ExcludedDomainHandler

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

func NewExcludedDomainHandler

func NewExcludedDomainHandler(service service.ExcludedDomainService) *ExcludedDomainHandler

func (*ExcludedDomainHandler) Check

func (h *ExcludedDomainHandler) Check(c *gin.Context)

Check if a domain is excluded GET /api/excluded-domains/check/:domain

func (*ExcludedDomainHandler) Create

func (h *ExcludedDomainHandler) Create(c *gin.Context)

Create adds a new excluded domain POST /api/excluded-domains

func (*ExcludedDomainHandler) Delete

func (h *ExcludedDomainHandler) Delete(c *gin.Context)

Delete removes an excluded domain by ID DELETE /api/excluded-domains/:id

func (*ExcludedDomainHandler) DeleteByDomain

func (h *ExcludedDomainHandler) DeleteByDomain(c *gin.Context)

DeleteByDomain removes an excluded domain by domain name DELETE /api/excluded-domains/by-domain/:domain

func (*ExcludedDomainHandler) List

func (h *ExcludedDomainHandler) List(c *gin.Context)

List returns all excluded domains for the authenticated user GET /api/excluded-domains

type IconsHandler

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

IconsHandler serves website icons/favicons

func NewIconsHandler

func NewIconsHandler(logger service.Logger) *IconsHandler

NewIconsHandler creates a new icons handler

func NewIconsHandlerWithStorage

func NewIconsHandlerWithStorage(logger service.Logger, storagePath string) *IconsHandler

NewIconsHandlerWithStorage creates a new icons handler with custom storage path

func (*IconsHandler) DeleteCustomIcon

func (h *IconsHandler) DeleteCustomIcon(c *gin.Context)

DeleteCustomIcon removes a custom icon for a domain DELETE /icons/:domain

func (*IconsHandler) GetIcon

func (h *IconsHandler) GetIcon(c *gin.Context)

GetIcon fetches and serves a website icon GET /icons/:domain

func (*IconsHandler) ListCustomIcons

func (h *IconsHandler) ListCustomIcons(c *gin.Context)

ListCustomIcons returns a list of all custom icons GET /icons/custom/list

func (*IconsHandler) UploadCustomIcon

func (h *IconsHandler) UploadCustomIcon(c *gin.Context)

UploadCustomIcon handles uploading a custom icon for a domain POST /icons/:domain

type InvitationHandler

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

func NewInvitationHandler

func NewInvitationHandler(
	invitationService service.InvitationService,
	userService service.UserService,
	organizationService service.OrganizationService,
) *InvitationHandler

NewInvitationHandler creates a new invitation handler

func (*InvitationHandler) Accept

func (h *InvitationHandler) Accept(c *gin.Context)

Accept godoc @Summary Accept invitation @Description Accept a pending invitation @Tags invitations @Produce json @Param id path int true "Invitation ID" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /invitations/{id}/accept [post]

func (*InvitationHandler) Decline

func (h *InvitationHandler) Decline(c *gin.Context)

Decline godoc @Summary Decline invitation @Description Decline a pending invitation @Tags invitations @Produce json @Param id path int true "Invitation ID" @Success 200 {object} map[string]string @Failure 403 {object} map[string]string @Router /invitations/{id}/decline [post]

func (*InvitationHandler) GetPending

func (h *InvitationHandler) GetPending(c *gin.Context)

GetPending godoc @Summary Get pending invitations @Description Get all pending invitations for current user @Tags invitations @Produce json @Success 200 {array} domain.Invitation @Failure 401 {object} map[string]string @Router /invitations/pending [get]

func (*InvitationHandler) GetSent

func (h *InvitationHandler) GetSent(c *gin.Context)

GetSent godoc @Summary Get sent invitations @Description Get all invitations sent by current user @Tags invitations @Produce json @Success 200 {array} domain.Invitation @Failure 401 {object} map[string]string @Router /invitations/sent [get]

func (*InvitationHandler) Invite

func (h *InvitationHandler) Invite(c *gin.Context)

Invite handles POST /api/invite (any authenticated user) Admins can specify role, regular users can only invite as member

type ItemHandler

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

func NewItemHandler

func NewItemHandler(itemService service.ItemService) *ItemHandler

NewItemHandler creates a new item handler

func (*ItemHandler) Create

func (h *ItemHandler) Create(c *gin.Context)

Create handles POST /api/items

func (*ItemHandler) Delete

func (h *ItemHandler) Delete(c *gin.Context)

Delete handles DELETE /api/items/:id

func (*ItemHandler) GetByID

func (h *ItemHandler) GetByID(c *gin.Context)

GetByID handles GET /api/items/:id

func (*ItemHandler) List

func (h *ItemHandler) List(c *gin.Context)

List handles GET /api/items

func (*ItemHandler) Update

func (h *ItemHandler) Update(c *gin.Context)

Update handles PUT /api/items/:id

type ItemShareHandler

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

func NewItemShareHandler

func NewItemShareHandler(svc service.ItemShareService) *ItemShareHandler

func (*ItemShareHandler) Create

func (h *ItemShareHandler) Create(c *gin.Context)

Create handles POST /api/item-shares

func (*ItemShareHandler) GetByUUID

func (h *ItemShareHandler) GetByUUID(c *gin.Context)

GetByUUID handles GET /api/item-shares/:uuid

func (*ItemShareHandler) ListOwned

func (h *ItemShareHandler) ListOwned(c *gin.Context)

ListOwned handles GET /api/item-shares

func (*ItemShareHandler) ListReceived

func (h *ItemShareHandler) ListReceived(c *gin.Context)

ListReceived handles GET /api/item-shares/received

func (*ItemShareHandler) ReShare

func (h *ItemShareHandler) ReShare(c *gin.Context)

ReShare handles POST /api/item-shares/:uuid/re-share

func (*ItemShareHandler) Revoke

func (h *ItemShareHandler) Revoke(c *gin.Context)

Revoke handles DELETE /api/item-shares/:id

func (*ItemShareHandler) UpdatePermissions

func (h *ItemShareHandler) UpdatePermissions(c *gin.Context)

UpdatePermissions handles PATCH /api/item-shares/:uuid/permissions

func (*ItemShareHandler) UpdateSharedItem

func (h *ItemShareHandler) UpdateSharedItem(c *gin.Context)

UpdateSharedItem handles PUT /api/item-shares/:uuid/item

type OrganizationActivityHandler

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

func NewOrganizationActivityHandler

func NewOrganizationActivityHandler(
	activityService service.UserActivityService,
	orgUserRepo repository.OrganizationUserRepository,
) *OrganizationActivityHandler

func (*OrganizationActivityHandler) ListOrganizationActivities

func (h *OrganizationActivityHandler) ListOrganizationActivities(c *gin.Context)

ListOrganizationActivities returns recent activities related to an organization. Visibility: any organization member can view. Note: Activities are stored per-user; we aggregate members' activities and filter by details.organization_id.

type OrganizationFolderHandler

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

func (*OrganizationFolderHandler) Create

func (h *OrganizationFolderHandler) Create(c *gin.Context)

Create godoc @Summary Create organization folder @Description Create a new folder in organization @Tags organization-folders @Accept json @Produce json @Param id path int true "Organization ID" @Param request body domain.CreateOrganizationFolderRequest true "Folder details" @Success 201 {object} domain.OrganizationFolderDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /organizations/{id}/folders [post]

func (*OrganizationFolderHandler) Delete

func (h *OrganizationFolderHandler) Delete(c *gin.Context)

Delete godoc @Summary Delete organization folder @Description Delete folder @Tags organization-folders @Param id path int true "Organization ID" @Param folderId path int true "Folder ID" @Success 204 @Failure 403 {object} map[string]string @Router /organizations/{id}/folders/{folderId} [delete]

func (*OrganizationFolderHandler) ListByOrganization

func (h *OrganizationFolderHandler) ListByOrganization(c *gin.Context)

ListByOrganization godoc @Summary List organization folders @Description Get all folders for an organization @Tags organization-folders @Produce json @Param id path int true "Organization ID" @Success 200 {array} domain.OrganizationFolderDTO @Failure 403 {object} map[string]string @Router /organizations/{id}/folders [get]

func (*OrganizationFolderHandler) Update

func (h *OrganizationFolderHandler) Update(c *gin.Context)

Update godoc @Summary Update organization folder @Description Update folder name @Tags organization-folders @Accept json @Produce json @Param id path int true "Organization ID" @Param folderId path int true "Folder ID" @Param request body domain.UpdateOrganizationFolderRequest true "Folder details" @Success 200 {object} domain.OrganizationFolderDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /organizations/{id}/folders/{folderId} [put]

type OrganizationHandler

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

func NewOrganizationHandler

func NewOrganizationHandler(
	service service.OrganizationService,
	subRepo interface {
		GetByOrganizationID(ctx context.Context, orgID uint) (*domain.Subscription, error)
	},
) *OrganizationHandler

func (*OrganizationHandler) AcceptInvitation

func (h *OrganizationHandler) AcceptInvitation(c *gin.Context)

AcceptInvitation godoc @Summary Accept organization invitation @Description Accept an invitation to join an organization @Tags organizations @Param id path int true "Organization User ID" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /organizations/invitations/{id}/accept [post]

func (*OrganizationHandler) Create

func (h *OrganizationHandler) Create(c *gin.Context)

Create godoc @Summary Create organization @Description Create a new organization @Tags organizations @Accept json @Produce json @Param request body domain.CreateOrganizationRequest true "Organization details" @Success 201 {object} domain.OrganizationDTO @Failure 400 {object} map[string]string @Failure 500 {object} map[string]string @Router /organizations [post]

func (*OrganizationHandler) Delete

func (h *OrganizationHandler) Delete(c *gin.Context)

Delete godoc @Summary Delete organization @Description Delete organization (owner only) @Tags organizations @Param id path int true "Organization ID" @Success 204 @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Failure 404 {object} map[string]string @Router /organizations/{id} [delete]

func (*OrganizationHandler) GetByID

func (h *OrganizationHandler) GetByID(c *gin.Context)

GetByID godoc @Summary Get organization @Description Get organization by ID @Tags organizations @Produce json @Param id path int true "Organization ID" @Success 200 {object} domain.OrganizationDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Failure 404 {object} map[string]string @Router /organizations/{id} [get]

func (*OrganizationHandler) GetMembers

func (h *OrganizationHandler) GetMembers(c *gin.Context)

GetMembers godoc @Summary Get organization members @Description Get list of organization members @Tags organizations @Produce json @Param id path int true "Organization ID" @Success 200 {array} domain.OrganizationUserDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /organizations/{id}/members [get]

func (*OrganizationHandler) InviteUser

func (h *OrganizationHandler) InviteUser(c *gin.Context)

InviteUser godoc @Summary Invite user to organization @Description Invite a user to join the organization @Tags organizations @Accept json @Produce json @Param id path int true "Organization ID" @Param request body domain.InviteUserToOrgRequest true "Invitation details" @Success 201 {object} domain.OrganizationUserDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /organizations/{id}/members [post]

func (*OrganizationHandler) List

func (h *OrganizationHandler) List(c *gin.Context)

List godoc @Summary List organizations @Description List organizations for current user @Tags organizations @Produce json @Success 200 {array} domain.OrganizationDTO @Failure 500 {object} map[string]string @Router /organizations [get]

func (*OrganizationHandler) RemoveMember

func (h *OrganizationHandler) RemoveMember(c *gin.Context)

RemoveMember godoc @Summary Remove member from organization @Description Remove a member from the organization @Tags organizations @Param id path int true "Organization ID" @Param userId path int true "Organization User ID" @Success 204 @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /organizations/{id}/members/{userId} [delete]

func (*OrganizationHandler) Update

func (h *OrganizationHandler) Update(c *gin.Context)

Update godoc @Summary Update organization @Description Update organization details @Tags organizations @Accept json @Produce json @Param id path int true "Organization ID" @Param request body domain.UpdateOrganizationRequest true "Organization details" @Success 200 {object} domain.OrganizationDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Failure 404 {object} map[string]string @Router /organizations/{id} [put]

func (*OrganizationHandler) UpdateMemberRole

func (h *OrganizationHandler) UpdateMemberRole(c *gin.Context)

UpdateMemberRole godoc @Summary Update member role @Description Update organization member role @Tags organizations @Accept json @Produce json @Param id path int true "Organization ID" @Param userId path int true "Organization User ID" @Param request body domain.UpdateOrgUserRoleRequest true "Role update" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /organizations/{id}/members/{userId} [put]

type OrganizationItemHandler

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

func (*OrganizationItemHandler) Create

func (h *OrganizationItemHandler) Create(c *gin.Context)

Create godoc @Summary Create organization item @Description Create a new item in organization (encrypted with org key) @Tags organization-items @Accept json @Produce json @Param id path int true "Organization ID" @Param request body service.CreateOrgItemRequest true "Item details" @Success 201 {object} domain.OrganizationItemDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /organizations/{id}/items [post]

func (*OrganizationItemHandler) Delete

func (h *OrganizationItemHandler) Delete(c *gin.Context)

Delete godoc @Summary Delete organization item @Description Delete item @Tags organization-items @Param id path int true "Item ID" @Success 204 @Failure 403 {object} map[string]string @Router /org-items/{id} [delete]

func (*OrganizationItemHandler) GetByID

func (h *OrganizationItemHandler) GetByID(c *gin.Context)

GetByID godoc @Summary Get organization item @Description Get item by ID @Tags organization-items @Produce json @Param id path int true "Item ID" @Success 200 {object} domain.OrganizationItemDTO @Failure 403 {object} map[string]string @Failure 404 {object} map[string]string @Router /org-items/{id} [get]

func (*OrganizationItemHandler) ListByCollection

func (h *OrganizationItemHandler) ListByCollection(c *gin.Context)

ListByCollection godoc @Summary List items in collection @Description Get all items in a collection @Tags organization-items @Produce json @Param id path int true "Collection ID" @Success 200 {array} domain.OrganizationItemDTO @Failure 403 {object} map[string]string @Router /collections/{id}/items [get]

func (*OrganizationItemHandler) ListByOrganization

func (h *OrganizationItemHandler) ListByOrganization(c *gin.Context)

ListByOrganization godoc @Summary List items in organization @Description Get all items in an organization (optionally filtered) @Tags organization-items @Produce json @Param id path int true "Organization ID" @Param type query int false "Item type" @Param collection_id query int false "Collection ID" @Param folder_id query int false "Folder ID" @Param search query string false "Search term" @Success 200 {array} domain.OrganizationItemDTO @Failure 403 {object} map[string]string @Router /organizations/{id}/items [get]

func (*OrganizationItemHandler) Update

func (h *OrganizationItemHandler) Update(c *gin.Context)

Update godoc @Summary Update organization item @Description Update item details @Tags organization-items @Accept json @Produce json @Param id path int true "Item ID" @Param request body service.UpdateOrgItemRequest true "Item details" @Success 200 {object} domain.OrganizationItemDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /org-items/{id} [put]

type PaymentHandler

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

func NewPaymentHandler

func NewPaymentHandler(
	service service.PaymentService,
	subscriptionService service.SubscriptionService,
	orgRepo repository.OrganizationRepository,
	orgUserRepo interface {
		GetByOrgAndUser(ctx context.Context, orgID, userID uint) (*domain.OrganizationUser, error)
	},
) *PaymentHandler

func (*PaymentHandler) CancelSubscription

func (h *PaymentHandler) CancelSubscription(c *gin.Context)

CancelSubscription godoc @Summary Cancel subscription @Description Cancel an organization's subscription @Tags payments @Accept json @Produce json @Param id path int true "Organization ID" @Param request body CancelSubscriptionRequest true "Cancel options" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Failure 500 {object} map[string]string @Router /organizations/{id}/subscription/cancel [post]

func (*PaymentHandler) ChangePlan

func (h *PaymentHandler) ChangePlan(c *gin.Context)

ChangePlan godoc @Summary Change subscription plan inline @Description Switches an existing subscription to a different plan with prorated billing. No Stripe redirect needed. @Tags payments @Accept json @Produce json @Param id path int true "Organization ID" @Param request body CreateCheckoutRequest true "Plan change request" @Success 200 {object} domain.PlanChangeResult @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Failure 500 {object} map[string]string @Router /organizations/{id}/subscription/change [post]

func (*PaymentHandler) CreateCheckoutSession

func (h *PaymentHandler) CreateCheckoutSession(c *gin.Context)

CreateCheckoutSession godoc @Summary Create Stripe checkout session @Description Create a Stripe checkout session for upgrading organization @Tags payments @Accept json @Produce json @Param id path int true "Organization ID" @Param request body CreateCheckoutRequest true "Checkout details" @Success 200 {object} CreateCheckoutResponse @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Failure 500 {object} map[string]string @Router /organizations/{id}/checkout [post]

func (*PaymentHandler) GetBillingInfo

func (h *PaymentHandler) GetBillingInfo(c *gin.Context)

GetBillingInfo godoc @Summary Get billing information @Description Get billing and subscription information for an organization @Tags payments @Produce json @Param id path int true "Organization ID" @Success 200 {object} domain.BillingInfo @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Failure 404 {object} map[string]string @Router /organizations/{id}/billing [get]

func (*PaymentHandler) PreviewPlanChange

func (h *PaymentHandler) PreviewPlanChange(c *gin.Context)

PreviewPlanChange godoc @Summary Preview plan change cost @Description Returns the prorated cost impact of switching to a different plan without applying changes @Tags payments @Accept json @Produce json @Param id path int true "Organization ID" @Param request body CreateCheckoutRequest true "Plan change preview" @Success 200 {object} domain.PlanChangePreview @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Failure 500 {object} map[string]string @Router /organizations/{id}/subscription/change/preview [post]

func (*PaymentHandler) PreviewSeatChange

func (h *PaymentHandler) PreviewSeatChange(c *gin.Context)

PreviewSeatChange godoc @Summary Preview user license change cost @Description Returns the prorated cost impact of changing user count without applying changes @Tags payments @Accept json @Produce json @Param id path int true "Organization ID" @Param request body UpdateSubscriptionSeatsRequest true "User count preview" @Success 200 {object} domain.SeatChangePreview @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Failure 500 {object} map[string]string @Router /organizations/{id}/subscription/seats/preview [post]

func (*PaymentHandler) ReactivateSubscription

func (h *PaymentHandler) ReactivateSubscription(c *gin.Context)

ReactivateSubscription godoc @Summary Reactivate subscription @Description Reactivate a subscription that is set to cancel @Tags payments @Produce json @Param id path int true "Organization ID" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Failure 500 {object} map[string]string @Router /organizations/{id}/subscription/reactivate [post]

func (*PaymentHandler) SyncSubscription

func (h *PaymentHandler) SyncSubscription(c *gin.Context)

SyncSubscription godoc @Summary Sync subscription @Description Manually sync subscription data from Stripe @Tags payments @Produce json @Param id path int true "Organization ID" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Failure 500 {object} map[string]string @Router /organizations/{id}/subscription/sync [post]

func (*PaymentHandler) UpdateSubscriptionSeats

func (h *PaymentHandler) UpdateSubscriptionSeats(c *gin.Context)

UpdateSubscriptionSeats godoc @Summary Update subscription user count @Description Increase/decrease user count for an organization's active subscription (Stripe proration applies) @Tags payments @Accept json @Produce json @Param id path int true "Organization ID" @Param request body UpdateSubscriptionSeatsRequest true "User count update" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Failure 500 {object} map[string]string @Router /organizations/{id}/subscription/seats [post]

type PlansHandler

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

PlansHandler exposes subscription plans for authenticated clients. NOTE: This is intentionally in the http handler package (to match router wiring).

func NewPlansHandler

func NewPlansHandler(
	planRepo interface {
		List(ctx context.Context) ([]*domain.Plan, error)
		GetByCode(ctx context.Context, code string) (*domain.Plan, error)
	},
	logger service.Logger,
) *PlansHandler

func (*PlansHandler) GetPlan

func (h *PlansHandler) GetPlan(c *gin.Context)

GetPlan returns a plan by code. GET /api/plans/:code

func (*PlansHandler) ListPlans

func (h *PlansHandler) ListPlans(c *gin.Context)

ListPlans returns all active plans. GET /api/plans

type RateLimiter

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

RateLimiter implements a simple token bucket rate limiter

func NewRateLimiter

func NewRateLimiter(rate time.Duration, burst int) *RateLimiter

NewRateLimiter creates a new rate limiter rate: minimum time between requests (e.g., 1 second) burst: maximum number of requests in a burst

func (*RateLimiter) Allow

func (rl *RateLimiter) Allow(ip string) bool

Allow checks if a request from the given IP is allowed

type RecaptchaResponse

type RecaptchaResponse struct {
	Success     bool      `json:"success"`
	Score       float64   `json:"score"`
	Action      string    `json:"action"`
	ChallengeTS time.Time `json:"challenge_ts"`
	Hostname    string    `json:"hostname"`
	ErrorCodes  []string  `json:"error-codes"`
}

RecaptchaResponse represents Google's reCAPTCHA API response

type RecaptchaVerifier

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

RecaptchaVerifier handles reCAPTCHA verification

func NewRecaptchaVerifier

func NewRecaptchaVerifier(secretKey string, threshold float64) *RecaptchaVerifier

NewRecaptchaVerifier creates a new reCAPTCHA verifier

func (*RecaptchaVerifier) Verify

func (r *RecaptchaVerifier) Verify(token string, remoteIP string) (*RecaptchaResponse, error)

Verify verifies a reCAPTCHA token

type SCIMHandler

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

SCIMHandler handles SCIM 2.0 provisioning endpoints

func NewSCIMHandler

func NewSCIMHandler(
	scimService service.SCIMService,
	orgService interface {
		GetMembership(ctx context.Context, userID uint, orgID uint) (*domain.OrganizationUser, error)
	},
) *SCIMHandler

NewSCIMHandler creates a new SCIM handler

func (*SCIMHandler) CreateGroup

func (h *SCIMHandler) CreateGroup(c *gin.Context)

CreateGroup handles POST /scim/v2/Groups

func (*SCIMHandler) CreateToken

func (h *SCIMHandler) CreateToken(c *gin.Context)

CreateToken generates a new SCIM bearer token

func (*SCIMHandler) CreateUser

func (h *SCIMHandler) CreateUser(c *gin.Context)

CreateUser handles POST /scim/v2/Users

func (*SCIMHandler) DeleteGroup

func (h *SCIMHandler) DeleteGroup(c *gin.Context)

DeleteGroup handles DELETE /scim/v2/Groups/:id

func (*SCIMHandler) DeleteUser

func (h *SCIMHandler) DeleteUser(c *gin.Context)

DeleteUser handles DELETE /scim/v2/Users/:id

func (*SCIMHandler) GetGroup

func (h *SCIMHandler) GetGroup(c *gin.Context)

GetGroup handles GET /scim/v2/Groups/:id

func (*SCIMHandler) GetUser

func (h *SCIMHandler) GetUser(c *gin.Context)

GetUser handles GET /scim/v2/Users/:id

func (*SCIMHandler) ListGroups

func (h *SCIMHandler) ListGroups(c *gin.Context)

ListGroups handles GET /scim/v2/Groups

func (*SCIMHandler) ListTokens

func (h *SCIMHandler) ListTokens(c *gin.Context)

ListTokens lists SCIM tokens for an organization

func (*SCIMHandler) ListUsers

func (h *SCIMHandler) ListUsers(c *gin.Context)

ListUsers handles GET /scim/v2/Users

func (*SCIMHandler) PatchGroup

func (h *SCIMHandler) PatchGroup(c *gin.Context)

PatchGroup handles PATCH /scim/v2/Groups/:id

func (*SCIMHandler) PatchUser

func (h *SCIMHandler) PatchUser(c *gin.Context)

PatchUser handles PATCH /scim/v2/Users/:id

func (*SCIMHandler) ResourceTypes

func (h *SCIMHandler) ResourceTypes(c *gin.Context)

ResourceTypes returns SCIM 2.0 ResourceTypes

func (*SCIMHandler) RevokeToken

func (h *SCIMHandler) RevokeToken(c *gin.Context)

RevokeToken revokes a SCIM token

func (*SCIMHandler) ServiceProviderConfig

func (h *SCIMHandler) ServiceProviderConfig(c *gin.Context)

ServiceProviderConfig returns SCIM 2.0 ServiceProviderConfig (RFC 7643 §5)

func (*SCIMHandler) UpdateGroup

func (h *SCIMHandler) UpdateGroup(c *gin.Context)

UpdateGroup handles PUT /scim/v2/Groups/:id

func (*SCIMHandler) UpdateUser

func (h *SCIMHandler) UpdateUser(c *gin.Context)

UpdateUser handles PUT /scim/v2/Users/:id

type SSOHandler

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

SSOHandler handles SSO connection management and authentication flows

func NewSSOHandler

func NewSSOHandler(
	ssoService service.SSOService,
	orgService interface {
		GetMembership(ctx context.Context, userID uint, orgID uint) (*domain.OrganizationUser, error)
	},
) *SSOHandler

NewSSOHandler creates a new SSO handler

func (*SSOHandler) ActivateConnection

func (h *SSOHandler) ActivateConnection(c *gin.Context)

ActivateConnection activates an SSO connection (validates config first)

func (*SSOHandler) CreateConnection

func (h *SSOHandler) CreateConnection(c *gin.Context)

CreateConnection creates a new SSO connection for an organization

func (*SSOHandler) DeleteConnection

func (h *SSOHandler) DeleteConnection(c *gin.Context)

DeleteConnection deletes an SSO connection

func (*SSOHandler) GetConnection

func (h *SSOHandler) GetConnection(c *gin.Context)

GetConnection gets a specific SSO connection

func (*SSOHandler) GetSPMetadata

func (h *SSOHandler) GetSPMetadata(c *gin.Context)

GetSPMetadata returns SAML SP metadata for a connection

func (*SSOHandler) InitiateLogin

func (h *SSOHandler) InitiateLogin(c *gin.Context)

InitiateLogin starts the SSO authentication flow (public, no auth required)

func (*SSOHandler) ListConnections

func (h *SSOHandler) ListConnections(c *gin.Context)

ListConnections lists SSO connections for an organization

func (*SSOHandler) OIDCCallback

func (h *SSOHandler) OIDCCallback(c *gin.Context)

OIDCCallback handles OIDC/SAML callback from IdP.

func (*SSOHandler) UpdateConnection

func (h *SSOHandler) UpdateConnection(c *gin.Context)

UpdateConnection updates an SSO connection

type SupportHandler

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

func NewSupportHandler

func NewSupportHandler(emailSender email.Sender, logger email.Logger) *SupportHandler

NewSupportHandler creates a new support handler

func (*SupportHandler) SendSupportEmail

func (h *SupportHandler) SendSupportEmail(c *gin.Context)

SendSupportEmail handles support form submissions @Summary Send support request @Description Sends a support request email to support@passwall.io @Tags support @Accept json @Produce json @Param request body SupportRequest true "Support request details" @Success 200 {object} map[string]interface{} "message: support request sent successfully" @Failure 400 {object} map[string]interface{} "error: invalid request" @Failure 500 {object} map[string]interface{} "error: failed to send support request" @Router /api/support [post]

type SupportRequest

type SupportRequest struct {
	Name    string `json:"name" binding:"required,min=2,max=100"`
	Email   string `json:"email" binding:"required,email"`
	Subject string `json:"subject" binding:"required,min=3,max=200"`
	Message string `json:"message" binding:"required,min=10,max=2000"`
}

SupportRequest represents a support/contact form submission

type TeamHandler

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

func NewTeamHandler

func NewTeamHandler(service service.TeamService) *TeamHandler

func (*TeamHandler) AddMember

func (h *TeamHandler) AddMember(c *gin.Context)

AddMember godoc @Summary Add member to team @Description Add a user to the team @Tags teams @Accept json @Produce json @Param id path int true "Team ID" @Param request body domain.AddTeamUserRequest true "Member details" @Success 201 {object} map[string]string @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /teams/{id}/members [post]

func (*TeamHandler) Create

func (h *TeamHandler) Create(c *gin.Context)

Create godoc @Summary Create team @Description Create a new team in an organization @Tags teams @Accept json @Produce json @Param orgId path int true "Organization ID" @Param request body domain.CreateTeamRequest true "Team details" @Success 201 {object} domain.TeamDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /organizations/{orgId}/teams [post]

func (*TeamHandler) Delete

func (h *TeamHandler) Delete(c *gin.Context)

Delete godoc @Summary Delete team @Description Delete a team @Tags teams @Param id path int true "Team ID" @Success 204 @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /teams/{id} [delete]

func (*TeamHandler) GetByID

func (h *TeamHandler) GetByID(c *gin.Context)

GetByID godoc @Summary Get team @Description Get team by ID @Tags teams @Produce json @Param id path int true "Team ID" @Success 200 {object} domain.TeamDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Failure 404 {object} map[string]string @Router /teams/{id} [get]

func (*TeamHandler) GetMembers

func (h *TeamHandler) GetMembers(c *gin.Context)

GetMembers godoc @Summary Get team members @Description Get list of team members @Tags teams @Produce json @Param id path int true "Team ID" @Success 200 {array} domain.TeamUserDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /teams/{id}/members [get]

func (*TeamHandler) List

func (h *TeamHandler) List(c *gin.Context)

List godoc @Summary List teams @Description List teams in an organization @Tags teams @Produce json @Param orgId path int true "Organization ID" @Success 200 {array} domain.TeamDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /organizations/{orgId}/teams [get]

func (*TeamHandler) RemoveMember

func (h *TeamHandler) RemoveMember(c *gin.Context)

RemoveMember godoc @Summary Remove member from team @Description Remove a member from the team @Tags teams @Param id path int true "Team ID" @Param memberId path int true "Team Member ID" @Success 204 @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /teams/{id}/members/{memberId} [delete]

func (*TeamHandler) Update

func (h *TeamHandler) Update(c *gin.Context)

Update godoc @Summary Update team @Description Update team details @Tags teams @Accept json @Produce json @Param id path int true "Team ID" @Param request body domain.UpdateTeamRequest true "Team details" @Success 200 {object} domain.TeamDTO @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /teams/{id} [put]

func (*TeamHandler) UpdateMember

func (h *TeamHandler) UpdateMember(c *gin.Context)

UpdateMember godoc @Summary Update team member @Description Update team member role @Tags teams @Accept json @Produce json @Param id path int true "Team ID" @Param memberId path int true "Team Member ID" @Param request body domain.UpdateTeamUserRequest true "Member details" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Router /teams/{id}/members/{memberId} [put]

type UpdateSubscriptionSeatsRequest

type UpdateSubscriptionSeatsRequest struct {
	Seats int `json:"seats" binding:"required"`
}

type UserAppearancePreferencesHandler

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

func (*UserAppearancePreferencesHandler) Get

Get returns appearance preferences for the authenticated user GET /api/users/me/appearance-preferences

func (*UserAppearancePreferencesHandler) Update

Update updates appearance preferences for the authenticated user PUT /api/users/me/appearance-preferences

type UserHandler

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

func NewUserHandler

func NewUserHandler(userService service.UserService, activityService service.UserActivityService) *UserHandler

func (*UserHandler) ChangeMasterPassword

func (h *UserHandler) ChangeMasterPassword(c *gin.Context)

func (*UserHandler) CheckOwnership

func (h *UserHandler) CheckOwnership(c *gin.Context)

CheckOwnership checks if user is sole owner of any organizations

func (*UserHandler) CheckRSAKeys

func (h *UserHandler) CheckRSAKeys(c *gin.Context)

CheckRSAKeys godoc @Summary Check if user has RSA keys @Description Check if current user has RSA keys generated @Tags users @Produce json @Success 200 {object} map[string]bool @Router /users/me/rsa-keys [get]

func (*UserHandler) Create

func (h *UserHandler) Create(c *gin.Context)

func (*UserHandler) Delete

func (h *UserHandler) Delete(c *gin.Context)

func (*UserHandler) DeleteWithOrganizations

func (h *UserHandler) DeleteWithOrganizations(c *gin.Context)

DeleteWithOrganizations deletes user along with their sole-owner organizations

func (*UserHandler) GetByID

func (h *UserHandler) GetByID(c *gin.Context)

func (*UserHandler) GetPublicKey

func (h *UserHandler) GetPublicKey(c *gin.Context)

GetPublicKey godoc @Summary Get user's RSA public key @Description Get user's RSA public key by email (for organization key wrapping) @Tags users @Produce json @Param email query string true "User email" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Failure 404 {object} map[string]string @Router /users/public-key [get]

func (*UserHandler) GetRSAPrivateKeyEnc

func (h *UserHandler) GetRSAPrivateKeyEnc(c *gin.Context)

GetRSAPrivateKeyEnc returns the encrypted RSA private key for current user @Summary Get RSA private key (encrypted) @Description Returns user's RSA private key encrypted with User Key @Tags users @Produce json @Success 200 {object} map[string]string @Failure 404 {object} map[string]string @Router /users/me/rsa-private-key [get]

func (*UserHandler) List

func (h *UserHandler) List(c *gin.Context)

func (*UserHandler) StoreRSAKeys

func (h *UserHandler) StoreRSAKeys(c *gin.Context)

StoreRSAKeys godoc @Summary Store user's RSA keys @Description Store user's RSA key pair (generated client-side) @Tags users @Accept json @Produce json @Param request body map[string]string true "RSA keys" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Router /users/me/rsa-keys [post]

func (*UserHandler) TransferOwnership

func (h *UserHandler) TransferOwnership(c *gin.Context)

TransferOwnership transfers organization ownership to another user

func (*UserHandler) Update

func (h *UserHandler) Update(c *gin.Context)

func (*UserHandler) UpdateProfile

func (h *UserHandler) UpdateProfile(c *gin.Context)

type UserNotificationPreferencesHandler

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

func (*UserNotificationPreferencesHandler) Get

Get returns notification preferences for the authenticated user GET /api/users/me/notification-preferences

func (*UserNotificationPreferencesHandler) Update

Update updates notification preferences for the authenticated user PUT /api/users/me/notification-preferences

type UserPreferencesHandler

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

func NewUserPreferencesHandler

func NewUserPreferencesHandler(service service.PreferencesService) *UserPreferencesHandler

func (*UserPreferencesHandler) List

func (h *UserPreferencesHandler) List(c *gin.Context)

List returns preferences for the authenticated user. GET /api/users/me/preferences?section=localization

func (*UserPreferencesHandler) Upsert

func (h *UserPreferencesHandler) Upsert(c *gin.Context)

Upsert updates one or more preferences for the authenticated user. PUT /api/users/me/preferences

type Visitor

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

Visitor represents a client with rate limiting state

type WebhookHandler

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

func NewWebhookHandler

func NewWebhookHandler(paymentService service.PaymentService, revenueCatService service.RevenueCatService) *WebhookHandler

func (*WebhookHandler) HandleRevenueCatWebhook

func (h *WebhookHandler) HandleRevenueCatWebhook(c *gin.Context)

HandleRevenueCatWebhook godoc @Summary Handle RevenueCat webhooks @Description Receive and process RevenueCat webhook events for mobile in-app purchases @Tags webhooks @Accept json @Produce json @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Failure 500 {object} map[string]string @Router /webhooks/revenuecat [post]

func (*WebhookHandler) HandleStripeWebhook

func (h *WebhookHandler) HandleStripeWebhook(c *gin.Context)

HandleStripeWebhook godoc @Summary Handle Stripe webhooks @Description Receive and process Stripe webhook events @Tags webhooks @Accept json @Produce json @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Failure 500 {object} map[string]string @Router /webhooks/stripe [post]

Jump to

Keyboard shortcuts

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