service

package
v0.0.0-...-e1f8fc5 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoPermission = errors.New("no permission")
)

Functions

This section is empty.

Types

type FormService

type FormService interface {
	GetFormsOfUser(userID uuid.UUID) ([]model.FormModel, error)
	GetForm(formID uuid.UUID) (model.FormModel, error)
	GetForms() ([]model.FormModel, error)
	CreateForm(userID uuid.UUID, title string) error
	UpdateForm(userID uuid.UUID, id uuid.UUID, title string) error
	DeleteForm(userID uuid.UUID, id uuid.UUID) error
}

func NewFormService

func NewFormService(db *bun.DB) FormService

type GenericDBService

type GenericDBService[T any] interface {
	GetModelByID(id uuid.UUID) (T, error)
	GetModel(whereQuery string, args ...interface{}) (T, error)
	GetModels(whereQuery string, args ...interface{}) ([]T, error)
	InsertModel(model T, columns ...string) error
	UpdateModel(model T, id uuid.UUID, columns ...string) error
	DeleteModelByID(id uuid.UUID) error
}

func NewGenericDBService

func NewGenericDBService[T any](db *bun.DB) GenericDBService[T]

type SchemaService

type SchemaService interface {
	GetSchemas(formID uuid.UUID) ([]model.FormSchemaModel, error)
	GetSchema(formID uuid.UUID, schemaID uuid.UUID) (model.FormSchemaModel, error)
	CreateSchema(formID uuid.UUID, userID uuid.UUID, formSchema model.FormSchemaModel) error
	UpdateSchema(username uuid.UUID, formID uuid.UUID, schemaID uuid.UUID, schemaData map[string]interface{}) error
	DeleteSchema(userID uuid.UUID, formID uuid.UUID, schemaID uuid.UUID) error
}

func NewSchemaService

func NewSchemaService(db *bun.DB) SchemaService

type SchemaServiceImpl

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

func (*SchemaServiceImpl) CreateSchema

func (s *SchemaServiceImpl) CreateSchema(userID uuid.UUID, formID uuid.UUID, schema model.FormSchemaModel) error

func (*SchemaServiceImpl) DeleteSchema

func (s *SchemaServiceImpl) DeleteSchema(userID uuid.UUID, formID uuid.UUID, schemaID uuid.UUID) error

func (*SchemaServiceImpl) GetSchema

func (s *SchemaServiceImpl) GetSchema(formID uuid.UUID, schemaID uuid.UUID) (model.FormSchemaModel, error)

func (*SchemaServiceImpl) GetSchemas

func (s *SchemaServiceImpl) GetSchemas(formID uuid.UUID) ([]model.FormSchemaModel, error)

func (*SchemaServiceImpl) UpdateSchema

func (s *SchemaServiceImpl) UpdateSchema(username uuid.UUID, formID uuid.UUID, schemaID uuid.UUID, schemaData map[string]interface{}) error

type UserService

type UserService interface {
	RegisterUser(user model.UserModel) error
	LoginUser(user model.UserModel) (string, error)
	GetUserById(id uuid.UUID) (model.UserModel, error)
	UpdateUser(id uuid.UUID, password string) error
	DeleteUser(id uuid.UUID) error
}

func NewUserService

func NewUserService(db *bun.DB, passwordService *auth.PasswordService, jwtService *auth.JWTService) UserService

Jump to

Keyboard shortcuts

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