core

package
v0.0.0-...-71bd35d Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidName                   = errors.New("was sent a invalid name")
	ErrUserAlreadyExist              = errors.New("user already exist")
	ErrUserDoesNotExist              = errors.New("user does not exist")
	ErrUserWrongPassword             = errors.New("was sent a wrong password")
	ErrUserSessionDoesNotExist       = errors.New("user session does not exist")
	ErrUserSessionDeleted            = errors.New("user session deleted")
	ErrUserIsNotAdmin                = errors.New("user is not admin")
	ErrUserIsProtected               = errors.New("user is protected")
	ErrQueueAlreadyExist             = errors.New("queue already exist")
	ErrQueueDoesNotExist             = errors.New("queue does not exist")
	ErrBodyValidate                  = errors.New("unable to parse body")
	ErrTemplateNameAlreadyExist      = errors.New("template name already exist")
	ErrMaxSizeTemplate               = errors.New("template has a max size of 1MB")
	ErrMissingFieldTemplates         = errors.New("missing fields from template")
	ErrTemplateDoesNotExist          = errors.New("template does not exist")
	ErrAttachmentDoesNotExist        = errors.New("attachment does not exist")
	ErrAttachmentDoesNotExistOnMinio = errors.New("attachment does not exist on minio")
	ErrMaxSizeAttachment             = errors.New("attachment has a max size")
	ErrUploadAlreadyConfirmed        = errors.New("upload already confirmed")
	ErrEmailListAlreadyExist         = errors.New("email list already exist")
	ErrEmailListDoesNotExist         = errors.New("email list does not exist")
)

Functions

This section is empty.

Types

type Attachment

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

func (*Attachment) ConfirmUpload

func (core *Attachment) ConfirmUpload(attachmentID model.ID, userID model.ID) error

func (*Attachment) Create

func (core *Attachment) Create(
	partial model.AttachmentPartial,
	userID model.ID,
) (*model.AttachmentURL, error)

func (*Attachment) Get

func (core *Attachment) Get(
	attachmentID model.ID,
	userID model.ID,
) (*model.AttachmentURL, error)

func (*Attachment) GetAttachments

func (core *Attachment) GetAttachments(userID model.ID) ([]model.Attachment, error)

func (*Attachment) RefreshUploadURL

func (core *Attachment) RefreshUploadURL(
	attachmentID model.ID,
	userID model.ID,
) (*model.AttachmentURL, error)

func (*Attachment) Uploaded

func (core *Attachment) Uploaded(userID model.ID, minioName string) (bool, error)

type Cores

type Cores struct {
	*User
	*Queue
	*EmailList
	*Template
	*Attachment
}

func NewCores

func NewCores(
	databases *data.Databases,
	validate *validator.Validate,
	sessionDuration time.Duration,
	rabbit *rabbit.Rabbit,
	minio *minio.Client,
	bukcetTemplate string,
	bukcetAttachment string,
	maxEntrySize int,
) *Cores

type EmailList

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

func (*EmailList) AddEmails

func (core *EmailList) AddEmails(name string, userID model.ID, emails model.EmailListEmails) error

func (*EmailList) Create

func (core *EmailList) Create(userID model.ID, partial model.EmailListPartial) error

func (*EmailList) Delete

func (core *EmailList) Delete(name string, userID model.ID, deletedBy model.ID) error

func (*EmailList) Get

func (core *EmailList) Get(name string, userID model.ID) (*model.EmailList, error)

func (*EmailList) GetAll

func (core *EmailList) GetAll(userID model.ID) ([]model.EmailList, error)

func (*EmailList) RemoveEmail

func (core *EmailList) RemoveEmail(name string, userID model.ID, email model.ID) error

func (*EmailList) RemoveEmails

func (core *EmailList) RemoveEmails(
	name string,
	userID model.ID,
	emails model.EmailListEmails,
) error

func (*EmailList) UpdateInfo

func (core *EmailList) UpdateInfo(name string, userID model.ID, info model.EmailListInfo) error

type ModelInvalidError

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

func (ModelInvalidError) Error

func (err ModelInvalidError) Error() string

func (ModelInvalidError) Translate

func (err ModelInvalidError) Translate(language ut.Translator) string

type Queue

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

func (*Queue) Create

func (core *Queue) Create(partial model.QueuePartial, userID model.ID) error

func (*Queue) Delete

func (core *Queue) Delete(name string, userID model.ID) error

func (*Queue) Exist

func (core *Queue) Exist(name string) (bool, error)

func (*Queue) Get

func (core *Queue) Get(name string) (*model.Queue, error)

func (*Queue) GetAll

func (core *Queue) GetAll() ([]model.Queue, error)

func (*Queue) SendEmail

func (core *Queue) SendEmail(queue string, partial model.EmailPartial, userID model.ID) error

type Template

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

func (*Template) Create

func (core *Template) Create(partial model.TemplatePartial, userID model.ID) error

func (*Template) Delete

func (core *Template) Delete(name string, userID model.ID) error

func (*Template) Exist

func (core *Template) Exist(name string) (bool, error)

func (*Template) Get

func (core *Template) Get(name string) (*model.Template, error)

func (*Template) GetAll

func (core *Template) GetAll() ([]model.Template, error)

func (*Template) GetByUser

func (core *Template) GetByUser(userID model.ID) ([]model.Template, error)

func (*Template) GetFields

func (core *Template) GetFields(name string) ([]string, error)

func (*Template) Update

func (core *Template) Update(name string, partial model.TemplatePartial) error

type User

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

func (*User) Create

func (core *User) Create(partial model.UserPartial, adminID model.ID) error

func (*User) Delete

func (core *User) Delete(userID model.ID, deleteByID model.ID) error

func (*User) ExistByNameOrEmail

func (core *User) ExistByNameOrEmail(name, email string) (bool, error)

func (*User) GetAll

func (core *User) GetAll() ([]model.User, error)

func (*User) GetByID

func (core *User) GetByID(userID model.ID) (*model.User, error)

func (*User) GetByNameOrEmail

func (core *User) GetByNameOrEmail(name, email string) (*model.User, error)

func (*User) GetSession

func (core *User) GetSession(sessionID model.ID) (*model.UserSession, error)

func (*User) IsAdmin

func (core *User) IsAdmin(userID model.ID) (bool, error)

func (*User) NewAdmin

func (core *User) NewAdmin(userID model.ID) error

func (*User) NewSession

func (core *User) NewSession(partial model.UserSessionPartial) (*model.UserSession, error)

func (*User) Protected

func (core *User) Protected(userID model.ID) error

func (*User) RemoveAdmin

func (core *User) RemoveAdmin(userID model.ID) error

func (*User) ReplaceSession

func (core *User) ReplaceSession(sessionID model.ID) (*model.UserSession, error)

func (*User) Update

func (core *User) Update(userID model.ID, partial model.UserPartial) error

Jump to

Keyboard shortcuts

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