accounts

package
v0.0.0-...-3812866 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(cfg *common.Config) *iris.Application

func RegisterRoute

func RegisterRoute(app *iris.Application, cors context.Handler, cfg *common.Config)

Types

type AccountRepository

type AccountRepository interface {
	Register(*RegisterModel) (interface{}, error)
	GetProfileById(sid uint64) (*Profile, error)
	GetUserById(username string) (*UserModel, error)

	CreateEmailPool(*EmailProfileModel) (bool, error)
	CreateMobilePool(*MobileProfileModel) (bool, error)
	UpdateProfile(*Profile) (bool, error)
	UpdateAvatar(*Profile) (bool, error)
	UpdateCover(*Profile) (bool, error)
}

func NewAccountReportsitory

func NewAccountReportsitory(db *mgo.Session, cfg *common.Config) AccountRepository

type AccountRoute

type AccountRoute struct {
	common.Context
	Service AccountService
}

func (*AccountRoute) BeforeActivation

func (r *AccountRoute) BeforeActivation(b mvc.BeforeActivation)

func (*AccountRoute) GetProfile

func (r *AccountRoute) GetProfile(sid uint64)

func (*AccountRoute) PostRegister

func (r *AccountRoute) PostRegister()

func (*AccountRoute) PostUpdateAvatar

func (r *AccountRoute) PostUpdateAvatar(sid uint64)

func (*AccountRoute) PostUpdateCover

func (r *AccountRoute) PostUpdateCover(sid uint64)

func (*AccountRoute) PostUpdateEmail

func (r *AccountRoute) PostUpdateEmail(sid string)

func (*AccountRoute) PostUpdateMobile

func (r *AccountRoute) PostUpdateMobile(sid string)

func (*AccountRoute) PostUpdateProfile

func (r *AccountRoute) PostUpdateProfile(sid uint64)

type AccountService

type AccountService interface {
	Register(*RegisterModel) (interface{}, error)
	Update(profile string) (interface{}, error)
	Profile(id uint64, token string) (interface{}, error)
	UpdateEmail(prof *AuthUpdate) (bool, error)
	UpdateMobile(prof *AuthUpdate) (bool, error)
	UpdateProfile(prof *Profile, sid uint64) (bool, error)
	UpdateAvatar(prof *Profile, sid uint64) (bool, error)
	UpdateCover(prof *Profile, sid uint64) (bool, error)
}

AccountService ...interface ...

func NewAccountService

func NewAccountService(repo AccountRepository, conf *common.Config) AccountService

NewAccountService ...

type AuthUpdate

type AuthUpdate struct {
	SID      uint64 `json:"smart_id"`
	Username string `json:"username"`
	Email    string `json:"email"`
	Mobile   string `json:"mobile"`
}

type EmailProfileModel

type EmailProfileModel struct {
	ID       string `json:"id" bson:"_id,omitempty"`
	SID      uint64 `json:"sid" bson:"sid"`
	Code     string `json:"code" bson:"code"`
	FullName string `json:"full_name" bson:"full_name"`
	Username string `json:"username" bson:"username"`
	Email    string `json:"email" bson:"email"`
	Used     bool   `json:"used" bson:"used"`
}

type MobileProfileModel

type MobileProfileModel struct {
	ID       string `json:"id" bson:"_id,omitempty"`
	SID      uint64 `json:"sid" bson:"sid"`
	Code     string `json:"code" bson:"code"`
	FullName string `json:"full_name" bson:"full_name"`
	Username string `json:"username" bson:"username"`
	Mobile   string `json:"email" bson:"email"`
	Used     bool   `json:"used" bson:"used"`
}

type Profile

type Profile struct {
	ID        uint64 `json:"id"  bson:"_id,omitempty" `
	FirstName string `json:"first_name" bson:"first_name"`
	LastName  string `json:"last_name" bson:"last_name"`
	FullName  string `json:"full_name" bson:"full_name"`
	Gender    int    `json:"gender" bson:"gender"`
	BirthDate int64  `json:"birth_date" bson:"birth_date"`
	Address   string `json:"address" bson:"address"`
	Avatar    string `json:"avatar" bson:"avatar"`
	Mobile    string `json:"mobile" bson:"mobile"`
	Email     string `json:"email" bson:"email"`
	Cover     string `json:"cover" bson:"cover"`
}

type RegisterModel

type RegisterModel struct {
	ID             string  `json:"ID"  bson:"_id,omitempty" `
	Username       string  `json:"username" bson:"username"`
	Password       string  `json:"password" bson:"password"`
	Profile        Profile `json:"profile" bson:"profile"`
	RegisteredDate int64   `json:"registered_date" bson:"registered_date"`
	VerifyCode     string  `json:"verify_code" bson:"verify_code"`
	VerifiedDate   int     `json:"verified_date" bson:"verified_date"`
}

type TokenClaims

type TokenClaims struct {
	jwt.MapClaims
	Usr string        `json:"usr"`
	Iss string        `json:"iss"`
	Act string        `json:"act"`
	Sid uint64        `json:"sid"`
	Jit string        `json:"jit"`
	Iat time.Duration `json:"iat"`
	Exp time.Duration `json:"exp"`
	Sys string        `json:"sys"`
}

type UserModel

type UserModel struct {
	ID            string `json:"id"  bson:"_id,omitempty" `
	Username      string `json:"username"  bson:"username"`
	Password      string `json:"password" bson:"password"`
	ProfileID     uint64 `json:"profile_id" bson:"profile_id"`
	ActivatedDate int64  `json:"activated_date" bson:"activated_date"`
	Status        int    `json:"status" bson:"status"`
}

Jump to

Keyboard shortcuts

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