models

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims struct {
	jwt.StandardClaims
	UserID   int    `json:"id"`
	Nickname string `json:"nck"`
	Private  bool   `json:"prv"`
}

Claims represents custom claims for jwt authentication.

type Config

type Config struct {
	Debug         bool
	Host          string
	Port          string
	DatabasePath  string
	JWTSecret     string
	UpdateSecret  string
	AppName       string
	RefreshTime   time.Duration
	SingleAddrTTL time.Duration
}

Config represents configuration that is being used by server.

func (Config) Address

func (c Config) Address() string

Address returns address string that is compatible with http.ListenAndServe function.

type Device

type Device struct {
	DevicePublicData

	// OwnerID is id of user that owns this device.
	OwnerID int
	// MAC contains hashed MAC address of the device.
	MAC []byte
}

type DevicePublicData

type DevicePublicData struct {
	ID    int    `json:"id"`
	Tag   string `json:"tag"`
	Owner string `json:"owner"`
}

type User

type User struct {
	UserPublicData

	// Password of User hashed with bcrypt algorithm.
	Password []byte

	// Private is flag for enabling private-mode that hides
	// user activity from others.
	Private bool
}

User represents single user data stored in storage.

type UserPublicData

type UserPublicData struct {
	// ID unique to every user.
	ID int `json:"id"`
	// Nickname represents name that will be exposed to public,
	// to inform people who is in the hackerspace.
	Nickname string `json:"nickname"`
	// Online indicates if player is currently in the hackerspace.
	Online bool `json:"online"`
}

UserPublicData is subset of User containing only data that can be shown publicly to everybody that will interact with API or website.

Jump to

Keyboard shortcuts

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