frontend

package
v0.0.0-...-a52efcf Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorService           = "internal service error"
	ErrorUnauthorized      = "unauthorized"
	ErrorUserPassRequired  = "both user and pass are required"
	ErrorUserPassUnknown   = "unknown user/pass combination"
	ErrorRequireEventID    = "missing required event id"
	ErrorRequireDeviceID   = "missing required device id"
	ErrorRequireUnlockCode = "missing required unlock code"
	ErrorEventNotFound     = "event not found"
	ErrorEventExists       = "event already exists"
	ErrorUnlockNotFound    = "device / unlock code combination not found"
	ErrorInvalidQRParams   = "QR Code can't be generated using provided parameters"
	ErrorQRGenerate        = "QR Code generator failed"
)

Frontend Service Error descriptions

View Source
const ServiceName = "frontend"

ServiceName of this service.

Variables

View Source
var (
	ErrService           = errors.New(ErrorService)
	ErrUnauthorized      = errors.New(ErrorUnauthorized)
	ErrUserPassRequired  = errors.New(ErrorUserPassRequired)
	ErrUserPassUnknown   = errors.New(ErrorUserPassUnknown)
	ErrRequireEventID    = errors.New(ErrorRequireEventID)
	ErrRequireDeviceID   = errors.New(ErrorRequireDeviceID)
	ErrRequireUnlockCode = errors.New(ErrorRequireUnlockCode)
	ErrEventNotFound     = errors.New(ErrorEventNotFound)
	ErrEventExists       = errors.New(ErrorEventExists)
	ErrUnlockNotFound    = errors.New(ErrorUnlockNotFound)

	ErrInvalidQRParams = errors.New(ErrorInvalidQRParams)
	ErrQRGenerate      = errors.New(ErrorQRGenerate)
)

Frontend Service Errors

Functions

This section is empty.

Types

type Event

type Event struct {
	ID   uuid.UUID `json:"id"`
	Name string    `json:"name"`
}

Event holds event details

type Login

type Login struct {
	ID         uuid.UUID
	Name       string
	TenantID   uuid.UUID
	TenantName string
}

Login holds login details

type Service

type Service interface {
	Login(ctx context.Context, user, pass string) (*Login, error)

	EventCreate(ctx context.Context, tenantID uuid.UUID, event Event) (*uuid.UUID, error)
	EventGet(ctx context.Context, tenantID, eventID uuid.UUID) (*Event, error)
	EventUpdate(ctx context.Context, tenantID uuid.UUID, event Event) error
	EventDelete(ctx context.Context, tenantID, eventID uuid.UUID) error
	EventList(ctx context.Context, tenantID uuid.UUID) ([]*Event, error)

	UnlockDevice(ctx context.Context, eventID, deviceID uuid.UUID, unlockCode string) (*Session, error)

	GenerateQR(ctx context.Context, eventID, deviceID uuid.UUID, unlockCode string) ([]byte, error)
}

Service describes our Frontend service.

type Session

type Session struct {
	EventID       uuid.UUID `json:"event_id,omitempty"`
	EventCaption  string    `json:"event_caption,omitempty"`
	DeviceID      uuid.UUID `json:"device_id,omitempty"`
	DeviceCaption string    `json:"device_caption,omitempty"`
	Token         string    `json:"token,omitempty"`
}

Session holds session details

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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