app

package
v0.0.0-...-456cfac Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(storeLayer store.StoreLayer) *appLayer

Types

type AppLayer

type AppLayer interface {
	AuthenticateUser(username string, password string) (*UserInternal, error)
	CheckRole(userRole string, requiredRole string) bool
	CreateSubmission(slug string, ipAddress string, userAgent string, values map[string]string) (*SubmissionInternal, error)
	DeleteSubmission(id uint) error
	DuplicateForm(slug string) (*FormInternal, error)
	GetForm(slug string) (*FormInternal, error)
	GetFormsForUser(userId uint) (*[]FormInternal, error)
	GetSubmissionsForForm(slug string, userId uint) (*[]SubmissionsInternal, error)
	GetUser(userId uint) (*UserInternal, error)
	ValidatePassword(user *UserInternal, password string) error
	ValidateUser(userId uint) error
	ValidateRecaptchaToken(token string, clientIp string) error
	ValidateSubmissionWithForm(submission map[string]string, form *FormInternal) []error
	UpdatePassword(user *UserInternal, password string) error
}

type EmailSubmissionData

type EmailSubmissionData struct {
	Form   *store.Form
	Fields *[]store.FormField
	Values *map[string]string
}

type FormFieldInternal

type FormFieldInternal struct {
	Name       string
	Slug       string
	Type       string
	Metadata   *interface{}
	Required   bool
	Validation string
	Order      uint
}

func (*FormFieldInternal) Internalize

func (f *FormFieldInternal) Internalize(field *store.FormField)

type FormInternal

type FormInternal struct {
	Slug             string
	Name             string
	Template         string
	OpensOn          *time.Time
	ClosesOn         *time.Time
	Submissions      uint
	MaxSubmissions   uint
	Fields           map[string]*FormFieldInternal
	RecaptchaSiteKey string
	NotOpenMessage   string
	ClosedMessage    string
	SuccessMessage   string
}

func (*FormInternal) Internalize

func (f *FormInternal) Internalize(form *store.Form, fields *[]store.FormField, submissions int64)

func (*FormInternal) IsAfterFormClose

func (f *FormInternal) IsAfterFormClose() bool

func (*FormInternal) IsBeforeFormOpen

func (f *FormInternal) IsBeforeFormOpen() bool

func (*FormInternal) IsFormFilled

func (f *FormInternal) IsFormFilled() bool

type SiteVerifyResponse

type SiteVerifyResponse 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"`
}

type SubmissionInternal

type SubmissionInternal struct {
	SubmittedOn time.Time
}

func (*SubmissionInternal) Internalize

func (s *SubmissionInternal) Internalize(field *store.Submission)

type SubmissionsInternal

type SubmissionsInternal map[string]string

type UserInternal

type UserInternal struct {
	ID                   uint
	CreatedAt            time.Time
	UpdatedAt            time.Time
	DeletedAt            *time.Time
	Username             string
	Password             string
	Role                 string
	Name                 string
	Email                string
	Disabled             bool
	RequirePasswordReset bool
}

func (*UserInternal) Internalize

func (u *UserInternal) Internalize(user *store.User)

Jump to

Keyboard shortcuts

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