controller

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 7, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnauthorized = fmt.Errorf("unauthorized")
)

Functions

This section is empty.

Types

type Controller

type Controller struct {
	DB     *gorm.DB
	JWT    *session.JWT
	App    *firebase.App
	Client *messaging.Client
}

func New

func New(db *gorm.DB, j *session.JWT, app *firebase.App) *Controller

func NewMem

func NewMem() *Controller

func (*Controller) Authenticate

func (c *Controller) Authenticate(s *session.Session) (*models.User, error)

func (*Controller) Close

func (c *Controller) Close() error

func (*Controller) DownloadPicture added in v0.0.5

func (c *Controller) DownloadPicture(uuid string) ([]byte, error)

func (*Controller) ListUsers

func (c *Controller) ListUsers(s *session.Session, filter *Filter[models.User]) ([]models.User, error)

func (*Controller) Login

func (c *Controller) Login(req *Login) (*models.User, string, error)

func (*Controller) Logout

func (c *Controller) Logout(s *session.Session) error

func (*Controller) Register

func (c *Controller) Register(u *models.User) error

func (*Controller) SendMessage

func (c *Controller) SendMessage(s *session.Session, msg *models.Message) error

func (*Controller) SendNotificationWithFirebase

func (c *Controller) SendNotificationWithFirebase(recipients []string, msg *models.Message) error

type Filter

type Filter[T any] struct {
	Page     int `json:"page"`
	PageSize int `json:"pageSize"`
	Target   T   `json:"target"`
}

type Login

type Login struct {
	Email         string `json:"email"`
	Password      string `json:"password"`
	FirebaseToken string `json:"firebaseToken"`
}

Jump to

Keyboard shortcuts

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