notificators

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: 19 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 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 IrisSentResponse

type IrisSentResponse struct {
	Code    string `json:"Code"`
	Message string `json:"Message"`
	Data    bool   `json:"Data"`
}

type IrisSignInResponse

type IrisSignInResponse struct {
	AccessToken string        `json:"access_token"`
	TokenType   string        `json:"token_type"`
	Expired     time.Duration `json:"expires_in"`
}

type MailModel

type MailModel struct {
	Mail        string `json:"email"`
	Subject     string `json:"subject"`
	Content     string `json:"content"`
	Type        int    `json:"type"`
	Lang        string `json:"lang"`
	CallBackURL string `json:"callback_url"`
}

type Message

type Message struct {
	SmsId       string `json:"SmsId"`
	PhoneNumber string `json:"PhoneNumber"`
	Content     string `json:"Content"`
	ContentType string `json:"ContentType"`
}

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:"mobile" bson:"mobile"`
	Used     bool   `json:"used" bson:"used"`
}

type NotificatorRepository

type NotificatorRepository interface {
	SaveOTP(key string, value interface{}, ttl time.Duration) (bool, error)
	RemoveOTP(*OtpModel) (bool, error)
	ReadOTP(key string) (string, error)
	ReadMailActivatedCode(email string) (*RegisterModel, error)
	ReadRegisterByUser(username string) (register *RegisterModel, err error)
	ReadIrisToken(brandName string) string
	WriteIrisToken(brandName string, token string, ttl time.Duration) (bool, error)

	ReadMailPool(email string) (*EmailProfileModel, error)
	ReadMobilePool(mobile string) (*MobileProfileModel, error)

	ReadUserProfile(string) (*UserModel, *ProfileModel, error)
	ReadUserAccount(string) (*UserModel, error)
}

NotificatorRepository method

func NewNotificatorRepository

func NewNotificatorRepository(sess *mgo.Session, redis *db.Redis, cfg *common.Config) NotificatorRepository

NewNotificatorRepository method

type NotificatorRoute

type NotificatorRoute struct {
	common.Context
	Service NotificatorService
}

func (*NotificatorRoute) BeforeActivation

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

func (*NotificatorRoute) PostSendMail

func (r *NotificatorRoute) PostSendMail()

func (*NotificatorRoute) PostSendSms

func (r *NotificatorRoute) PostSendSms()

func (*NotificatorRoute) PostSmsForgotPassword

func (r *NotificatorRoute) PostSmsForgotPassword()

type NotificatorService

type NotificatorService interface {
	SendEmail(*MailModel) (bool, error)
	SendSMS(*SmsModel) (interface{}, error)
	SendFirebase(channel string, title string, content string) (interface{}, error)
}

func NewNotificatorService

func NewNotificatorService(repo NotificatorRepository, conf *common.Config) NotificatorService

type OtpModel

type OtpModel struct {
	ID     string        `json:"id"`
	Mobile string        `json:"mobile"`
	TTL    time.Duration `json:"ttl"`
}

OtpModel model

type Profile

type Profile struct {
	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 ProfileModel

type ProfileModel 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 SenderModel

type SenderModel struct {
	Brandname   string    `json:"Brandname"`
	SendingList []Message `json:"SendingList"`
}

type SmsModel

type SmsModel struct {
	Mobile      string        `json:"mobile"`
	Content     string        `json:"content"`
	Type        int           `json:"type"`
	Lang        string        `json:"lang"`
	TTL         time.Duration `json:"ttl"`
	CallBackURL string        `json:"callback_url"`
}

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