models

package
v0.0.0-...-fb0b0ba Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2016 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 AccessToken

type AccessToken struct {
	Id           bson.ObjectId `bson:"_id"`
	UserId       bson.ObjectId `bson:"user_id"`
	TrustedAppId bson.ObjectId `bson:"trusted_app_id"`
	Token        string        `bson:"token"`
	ExpireAt     time.Time     `bson:"expire_at"`
}

type Article

type Article struct {
	Id        bson.ObjectId `json:"id" bson:"_id"`
	Title     string        `valid:"required" json:"title" bson:"title"`
	Content   string        `valid:"required" json:"content" bson:"content"`
	UserId    bson.ObjectId `json:"user_id" bson:"user_id"`
	CreatedAt time.Time     `json:"created_at" bson:"created_at"`
	UpdatedAt time.Time     `json:"updated_at" bson:"updated_at"`
}

type AuthenticationResponse

type AuthenticationResponse struct {
	TokenType    string  `json:"token_type"`
	AccessToken  string  `json:"access_token"`
	ExpiresInMin float64 `json:"expire_in_min"`
	RefreshToken string  `json:"refresh_token"`
}

it's used only for JSON response in authentication and refresh token requests

type ChangePasswordRequestModel

type ChangePasswordRequestModel struct {
	OldPassword string `valid:"length(6|64),required" json:"old_password"`
	Password    string `valid:"length(6|64),required" json:"password"`
}

type Client

type Client struct {
	AppId        bson.ObjectId `json:"app_id" bson:"_id"`
	AppKey       string        `json:"app_key" bson:"key"`
	Name         string        `valid:"required" json:"name" bson:"name"`
	Description  string        `json:"description,omitempty" bson:"description,omitempty"`
	IsEnable     bool          `default:"true" json:"is_enable" bson:"enable_status"`
	PlatformType string        `default:"web" json:"platform_type" bson:"platform_type"`
	CreatedAt    time.Time     `json:"created_at" bson:"created_at"`
	UpdatedAt    time.Time     `json:"updated_at" bson:"updated_at"`
}

func (*Client) HashedAppKey

func (cli *Client) HashedAppKey() string

type RefreshTokenRequest

type RefreshTokenRequest struct {
	AppId        string `valid:"required" json:"app_id"`
	AppKey       string `json:"app_key"`
	RefreshToken string `valid:"required" json:"refresh_token"`
}

it's used only for JSON request

type SignInRequest

type SignInRequest struct {
	AppId       string `valid:"required" json:"app_id"`
	AppKey      string `json:"app_key"`
	DeviceModel string `json:"device_model"`
	Email       string `valid:"email,required" json:"email"`
	Password    string `valid:"length(6|64),required" json:"password"`
}

it's used only for JSON request

type SignUpRequest

type SignUpRequest struct {
	AppId       string `valid:"required" json:"app_id"`
	AppKey      string `json:"app_key"`
	DeviceModel string `json:"device_model"`
	FirstName   string `valid:"required" json:"first_name" bson:"first_name"`
	LastName    string `valid:"required" json:"last_name" bson:"last_name"`
	DisplayName string `valid:"required" json:"display_name" bson:"display_name"`
	Email       string `valid:"email,required" json:"email"`
	Password    string `valid:"length(6|64),required" json:"password"`
}

it's used only for JSON request

type TrustedApp

type TrustedApp struct {
	Id               bson.ObjectId `bson:"_id"`
	ClientId         bson.ObjectId `bson:"_client"`
	RefreshToken     string        `bson:"refresh_token"`
	DeviceModel      string        `bson:"device_model,omitempty"`
	OSVersion        string        `bson:"os_version,omitempty"`
	AppVersion       string        `bson:"app_version,omitempty"`
	MessageTokenType string        `bson:"message_token_type,omitempty"`
	MessageToken     string        `bson:"message_token,omitempty"`
	GrantedAt        time.Time     `bson:"granted_at"`
}

only for database models

type User

type User struct {
	Id             bson.ObjectId `json:"id" bson:"_id"`
	FirstName      string        `valid:"required" json:"first_name" bson:"first_name"`
	LastName       string        `valid:"required" json:"last_name" bson:"last_name"`
	DisplayName    string        `valid:"required" json:"display_name" bson:"display_name"`
	Email          string        `valid:"email,required" json:"email" bson:"email"`
	HashedPassword string        `json:"password,omitempty" bson:"hashed_password"`
	ImageFileName  string        `default:"default_image_profile.jpeg" json:"image_profile_url" bson:"image_profile_file_name"`
	IsEnable       bool          `default:"true" json:"is_enable" bson:"enable_status"`
	TrustedApps    []TrustedApp  `json:"-" bson:"trusted_apps,omitempty"`
	Roles          []string      `json:"roles" bson:"roles"`
	JoinedAt       time.Time     `json:"joined_at" bson:"joined_at"`
	UpdatedAt      time.Time     `json:"updated_at" bson:"updated_at"`
}

used for database and JSON

Jump to

Keyboard shortcuts

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