models

package
v0.0.0-...-85ecf22 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2019 License: MIT Imports: 2 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Settings = MySettings{
	IsDevEnvironment: true,
	PortToListen:     9791,
	DatabaseURL:      "https://vsm-links-db.firebaseio.com",
	DatabaseKey:      "./keys/vsm-links-db-firebase-adminsdk-gubgg-98be377e48.json",
}

Settings specific project settings in DEV or PROD

Functions

This section is empty.

Types

type Link struct {
	LinkID         string    `json:"link_id"`
	UserID         string    `json:"user_id"`
	TypeID         int       `json:"type_id"`
	LinkCategoryID string    `json:"link_category_id"`
	Title          string    `json:"title"`
	Description    string    `json:"description"`
	URL            string    `json:"url"`
	Rate           int       `json:"rate"`
	CreatedAt      time.Time `json:"created_at"`
}

Link is model for create/transfer links

type LinkCategory

type LinkCategory struct {
	LinkCategoryID string         `json:"link_category_id"`
	StatusID       TypeOfResource `json:"status_id"`
	UserID         string         `json:"user_id"`
	Name           string         `json:"name"`
	CreatedAt      time.Time      `json:"created_at"`
}

LinkCategory to store information about categories

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
	ClientID string `json:"client_id"`
}

LoginRequest model to authenticate user

type LoginResponse

type LoginResponse struct {
	Status bool   `json:"status"`
	Jwt    string `json:"jwt"`
}

LoginResponse model for successful or not login

type MySettings

type MySettings struct {
	IsDevEnvironment bool
	PortToListen     int
	DatabaseURL      string
	DatabaseKey      string
}

MySettings provides settings for whole project

func (*MySettings) GetEnvironment

func (ms *MySettings) GetEnvironment() string

GetEnvironment returns name of environment - DEV or PROD

type Response

type Response struct {
	Status  bool   `json:"status"`
	Message string `json:"message"`
}

Response is base JSON response

type TypeOfResource

type TypeOfResource int

TypeOfResource use to set status and type of resources, like LinkCategory

const (
	// ActivePublic active and available to all users
	ActivePublic TypeOfResource = iota + 1
	// ActivePrivate active, but only for owner
	ActivePrivate
	// DeletedPublic deleted
	DeletedPublic
	// DeletedPrivate deleted
	DeletedPrivate
)

type User

type User struct {
	UserID   string         `json:"user_id"`
	StatusID TypeOfResource `json:"status_id"`
	Name     string         `json:"name"`
	Email    string         `json:"email"`
	Password string         `json:"password"`
}

User represents user who is able to use VsLinks system

var UserData *User

UserData stores information about logged in user

type UserClaims

type UserClaims struct {
	UserID string `json:"user_id"`
	Name   string `json:"name"`
	Email  string `json:"email"`
	jwt.StandardClaims
}

UserClaims stores user attributes

Jump to

Keyboard shortcuts

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