models

package
v0.0.0-...-8474782 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthResponse

type AuthResponse struct {
	AuthToken *AuthToken `json:"authToken"`
	User      *User      `json:"user"`
}

type AuthToken

type AuthToken struct {
	AccessToken string    `json:"accessToken"`
	ExpiredAt   time.Time `json:"expiredAt"`
}

type Device

type Device struct {
	ID           string    `json:"id" bson:"_id,omitempty"`
	RoomID       string    `json:"roomID" bson:"room_id,omitempty"`
	Name         string    `json:"name" bson:"name,omitempty"`
	Model        string    `json:"model" bson:"model,omitempty"`
	MacAddress   string    `json:"macAddress" bson:"mac_address,omitempty"`
	Memo         string    `json:"memo" bson:"memo,omitempty"`
	SerialNumber string    `json:"serialNumber" bson:"serial_number,omitempty"`
	Status       int       `json:"status" bson:"status,omitempty"`
	Type         int       `json:"type" bson:"type,omitempty"`
	CreatedDate  time.Time `json:"createdDate" bson:"created_date,omitempty"`
	LastModified time.Time `json:"lastModified" bson:"last_modified,omitempty"`
}

Device struct for one device

func (*Device) Update

func (d *Device) Update(input DeviceUpdate)

Update convert DeviceUpdate to struct

type DeviceInput

type DeviceInput struct {
	RoomID       string `json:"roomID"`
	Name         string `json:"name"`
	Model        string `json:"model"`
	MacAddress   string `json:"macAddress"`
	Memo         string `json:"memo"`
	SerialNumber string `json:"serialNumber"`
	Status       int    `json:"status"`
	Type         int    `json:"type"`
}

type DeviceUpdate

type DeviceUpdate struct {
	Name         *string `json:"name"`
	Model        *string `json:"model"`
	MacAddress   *string `json:"macAddress"`
	Memo         *string `json:"memo"`
	SerialNumber *string `json:"serialNumber"`
	Status       *int    `json:"status"`
	Type         *int    `json:"type"`
}

type Email

type Email struct {
	ID          string    `json:"id" bson:"_id,omitempty"`
	From        string    `json:"from" bson:"from,omitempty"`
	To          string    `json:"to" bson:"to,omitempty"`
	Data        string    `json:"data" bson:"data,omitempty"`
	CreatedDate time.Time `json:"createdDate" bson:"created_date,omitempty"`
}

Email struct for email

type EmailInput

type EmailInput struct {
	From string `json:"from"`
	To   string `json:"to"`
	Data string `json:"data"`
}

type LoginInput

type LoginInput struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type Room

type Room struct {
	ID          string    `json:"id" bson:"_id,omitempty"`
	RoomNumber  string    `json:"roomNumber" bson:"room_number,omitempty"`
	Memo        string    `json:"memo" bson:"memo,omitempty"`
	Username    string    `json:"username" bson:"username,omitempty"`
	Password    string    `json:"password" bson:"password,omitempty"`
	CreatedDate time.Time `json:"createdDate" bson:"created_date,omitempty"`
}

Room struct for one room

func (*Room) Update

func (d *Room) Update(input RoomUpdate)

Update convert RoomUpdate to struct

type RoomFilter

type RoomFilter struct {
	Name *string `json:"name"`
}

type RoomInput

type RoomInput struct {
	RoomNumber string         `json:"roomNumber"`
	Memo       string         `json:"memo"`
	Devices    []*DeviceInput `json:"devices"`
	Username   string         `json:"username"`
	Password   string         `json:"password"`
}

type RoomUpdate

type RoomUpdate struct {
	RoomNumber *string `json:"roomNumber"`
	Memo       *string `json:"memo"`
	Username   *string `json:"username"`
	Password   *string `json:"password"`
}

type User

type User struct {
	ID       string `json:"id" bson:"_id,omitempty"`
	Name     string `json:"name" bson:"name,omitempty"`
	Username string `json:"username" bson:"username,omitempty"`
	Password string `json:"password" bson:"password,omitempty"`
	Location string `json:"location" bson:"location,omitempty"`
	Abbr     string `json:"abbr" bson:"abbr,omitempty"`
	Email    string `json:"email" bson:"email,omitempty"`
	Openhab  string `json:"openhab" bson:"openhab,omitempty"`
}

User struct for one user

func (*User) ComparePassword

func (u *User) ComparePassword(password string) error

ComparePassword compares password using bcrypt

func (*User) GenToken

func (u *User) GenToken() (*AuthToken, error)

GenToken generate JWT token

func (*User) HashPassword

func (u *User) HashPassword(password string) error

HashPassword using bcrypt

func (*User) Update

func (u *User) Update(input UserUpdate)

Update convert UserUpdate to struct

type UserInput

type UserInput struct {
	Name     string `json:"name"`
	Username string `json:"username"`
	Password string `json:"password"`
	Location string `json:"location"`
	Abbr     string `json:"abbr"`
	Email    string `json:"email"`
	Openhab  string `json:"openhab"`
}

type UserUpdate

type UserUpdate struct {
	Name     *string `json:"name"`
	Username *string `json:"username"`
	Password *string `json:"password"`
	Location *string `json:"location"`
	Abbr     *string `json:"abbr"`
	Email    *string `json:"email"`
	Openhab  *string `json:"openhab"`
}

Jump to

Keyboard shortcuts

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