services

package
v0.0.0-...-90537fb Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CryptoService

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

func NewCryptoService

func NewCryptoService(cfg config.CryptoConfig) *CryptoService

func (*CryptoService) Base64Encode

func (c *CryptoService) Base64Encode(data []byte) string

convert a byte slice to a base64 encoded string

type FormService

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

func NewFormService

func NewFormService(cfg config.Config, db *database.Database, logger *slog.Logger) *FormService

func (*FormService) CheckCodeAvailability

func (f *FormService) CheckCodeAvailability(code string) bool

check if the form code is available

func (*FormService) Create

func (f *FormService) Create(formRequest *models.FormRequest, user *models.User) (*models.Form, error)

create a new form using the form request for the user

func (*FormService) GetByCode

func (f *FormService) GetByCode(code string, user *models.User) (*models.Form, error)

get a form by its code

func (*FormService) GetForUser

func (f *FormService) GetForUser(user *models.User) ([]models.Form, error)

get all forms for the user

func (*FormService) GetWithResponses

func (f *FormService) GetWithResponses(formID string, user *models.User) (*models.Form, error)

get user owned form with its responses

type ResponseService

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

func NewResponseService

func NewResponseService(cfg config.Config, db *database.Database, logger *slog.Logger) *ResponseService

func (*ResponseService) Create

func (r *ResponseService) Create(responseRequest models.ResponseRequest, formID uuid.UUID, user *models.User) (models.Response, error)

func (*ResponseService) GetByFormID

func (r *ResponseService) GetByFormID(formID string, user *models.User) (*models.Form, error)

type UserService

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

func NewUserService

func NewUserService(cfg config.Config, db *database.Database) *UserService

func (*UserService) Create

func (s *UserService) Create(userReq models.UserRequest) (*models.User, error)

create a new user using the user request

func (*UserService) GetByPubKey

func (s *UserService) GetByPubKey(pubKey string) (*models.User, error)

get a user by their public key

func (*UserService) Update

func (s *UserService) Update(user *models.User) error

update a user using user strcut

type Validator

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

func NewValidator

func NewValidator() *Validator

func (*Validator) Validate

func (v *Validator) Validate(i interface{}) error

Validate a struct using the validator

Jump to

Keyboard shortcuts

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