misc

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminWebcam

type AdminWebcam struct {
	Webcam
	Enabled    bool   `db:"enabled" json:"enabled"`
	Permission string `db:"permission_id" json:"permissionID"`
}

AdminWebcam represents extra options to configure the webcam

type List added in v0.7.0

type List struct {
	ListID       int          `db:"list_id" json:"listID"`
	Name         string       `db:"name" json:"name"`
	Description  string       `db:"description" json:"description"`
	Alias        string       `db:"alias" json:"alias"`
	PermissionID *int         `db:"permission_id" json:"permissionID"`
	IsSubscribed bool         `db:"is_subscribed" json:"isSubscribed"`
	Subscribers  []Subscriber `json:"subscribers,omitempty"`
}

List is a mailing list which people can subscribe to

type ListRepo added in v0.7.0

type ListRepo interface {
	GetLists(ctx context.Context) ([]List, error)
	GetListsByUserID(ctx context.Context, userID int) ([]List, error)
	GetList(ctx context.Context, listID int) (List, error)
	GetSubscribers(ctx context.Context, listID int) ([]Subscriber, error)
	Subscribe(ctx context.Context, userID, listID int) error
	UnsubscribeByID(ctx context.Context, userID, listID int) error
	UnsubscribeByUUID(ctx context.Context, uuid string) error
}

ListRepo represents all mailing list interactions

Send emails to roles and other groups

type Quote

type Quote struct {
	QuoteID     int    `db:"quote_id" json:"id"`
	Quote       string `db:"quote" json:"quote"`
	Description string `db:"description" json:"description"`
	CreatedBy   int    `db:"created_by" json:"createdBy"`
}

Quote is an individual quote

type QuotePage

type QuotePage struct {
	Quotes        []Quote
	LastPageIndex int
}

QuotePage is a group of quotes including the last page index

type QuoteRepo

type QuoteRepo interface {
	ListQuotes(ctx context.Context, amount, page int) (QuotePage, error)
	NewQuote(ctx context.Context, q Quote) error
	UpdateQuote(ctx context.Context, q Quote) error
	DeleteQuote(ctx context.Context, quoteID int) error
}

QuoteRepo defines all quote interactions

type Repos added in v0.9.6

type Repos interface {
	QuoteRepo
	WebcamRepo
	ListRepo
}

func NewStore

func NewStore(db *sqlx.DB) Repos

NewStore creates a new store

type Store

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

Store contains our dependency

func (*Store) DeleteQuote

func (m *Store) DeleteQuote(ctx context.Context, quoteID int) error

DeleteQuote deletes a quote

func (*Store) GetList added in v0.7.0

func (m *Store) GetList(ctx context.Context, listID int) (List, error)

GetList returns a list including all subscribers

func (*Store) GetLists added in v0.7.0

func (m *Store) GetLists(ctx context.Context) ([]List, error)

GetLists returns all available mailing lists Doesn't include individual subscribers

func (*Store) GetListsByUserID added in v0.7.0

func (m *Store) GetListsByUserID(ctx context.Context, userID int) ([]List, error)

GetListsByUserID returns all available and currently subscribed to mailing lists for a user don't include individual subscribers

func (*Store) GetSubscribers added in v0.7.0

func (m *Store) GetSubscribers(ctx context.Context, listID int) ([]Subscriber, error)

GetSubscribers returns all subscribers of a list

func (*Store) GetWebcam

func (m *Store) GetWebcam(ctx context.Context, cameraID int, permissions []string) (Webcam, error)

GetWebcam returns a single webcam

func (*Store) ListQuotes

func (m *Store) ListQuotes(ctx context.Context, amount, page int) (QuotePage, error)

ListQuotes returns a section of quotes

func (*Store) ListWebcams

func (m *Store) ListWebcams(ctx context.Context, permissions []string) ([]Webcam, error)

ListWebcams returns all webcams a user can access

func (*Store) NewQuote

func (m *Store) NewQuote(ctx context.Context, q Quote) error

NewQuote creates a new quote

func (*Store) Subscribe added in v0.7.0

func (m *Store) Subscribe(ctx context.Context, userID, listID int) error

Subscribe adds a user to a mailing list

func (*Store) UnsubscribeByID added in v0.7.0

func (m *Store) UnsubscribeByID(ctx context.Context, userID, listID int) error

UnsubscribeByID removes a user from a mailing list by userID and listID

func (*Store) UnsubscribeByUUID added in v0.7.0

func (m *Store) UnsubscribeByUUID(ctx context.Context, uuid string) error

UnsubscribeByUUID removes a user from a mailing list by the subscriber UUID

func (*Store) UpdateQuote

func (m *Store) UpdateQuote(ctx context.Context, q Quote) error

UpdateQuote updates a quote

type Subscriber added in v0.7.0

type Subscriber struct {
	SubscribeID string `db:"subscribe_id" json:"subscribeID"`
	people.User `json:"user"`
}

Subscriber is an individual user on a mailing list

type Webcam

type Webcam struct {
	CameraID int    `db:"camera_id" json:"id"`
	Name     string `db:"name" json:"name"`
	URL      string `db:"url" json:"-"`
	File     string `db:"file" json:"file"`
	MIMEType string `db:"mime_type" json:"mimeType"`
}

Webcam represents a watchable webcam

type WebcamRepo

type WebcamRepo interface {
	ListWebcams(ctx context.Context, permissions []string) ([]Webcam, error)
	GetWebcam(ctx context.Context, cameraID int, permissions []string) (Webcam, error)
}

WebcamRepo represents all webcam interactions

Jump to

Keyboard shortcuts

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