users

package
v0.0.0-...-2c15619 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UserRole_Admin = &UserRole{Name: "Admin"}
	UserRole_Guest = &UserRole{Name: "Guest"}
)
View Source
var ErrAlreadyExistRole = errors.New("ErrAlreadyExistRole")

Functions

This section is empty.

Types

type Address

type Address struct {
	Town string
	City string
}

type IUserRepository

type IUserRepository interface {
	FindOneById(ctx context.Context, id primitive.ObjectID) (*User, error)
	FindOneByUsername(ctx context.Context, username string) (*User, error)
	Add(ctx context.Context, user *User) error
	Update(ctx context.Context, user *User) error
}

func NewUserRepositoryResolve

func NewUserRepositoryResolve(rabbitMQConfig rabbitmqv2.Config, mongoConfig mongo.Config) IUserRepository

type User

type User struct {
	Id                primitive.ObjectID            `json:"id" bson:"_id"`
	FirstName         string                        `json:"first_name"`
	LastName          string                        `json:"last_name"`
	UserName          string                        `json:"user_name"`
	EncryptedPassword *aggregates.EncryptedPassword `json:"encrypted_password"`
	Roles             []*UserRole                   `json:"roles"`
	// contains filtered or unexported fields
}

func NewAdminUser

func NewAdminUser(firstName, lastName, username, password string) *User

func NewGuestUser

func NewGuestUser() *User

func NewUser

func NewUser(firstName, lastName, username, password string) *User

func (*User) AddUserRole

func (u *User) AddUserRole(role *UserRole)

func (*User) ChangePassword

func (u *User) ChangePassword(oldPassword, newPassword string)

func (*User) ClearDomainEvents

func (u *User) ClearDomainEvents()

func (*User) GetDomainEvents

func (u *User) GetDomainEvents() []ddd.IBaseEvent

func (*User) RaiseEvent

func (u *User) RaiseEvent(event ddd.IBaseEvent)

type UserRole

type UserRole struct {
	Name string `json:"name"`
}

type UserService

type UserService interface {
	AddNewUser(ctx context.Context, firstName string, lastName string, userName string, password string) (*User, error)
	AddNewAdminUser(ctx context.Context, firstName string, lastName string, userName string, password string) (*User, error)
	AddNewGuestUser(ctx context.Context) (*User, error)
	GetUserById(ctx context.Context, id string) (*User, error)
	AuthUser(ctx context.Context, username, password string) (bool, error)
}

func NewUserService

func NewUserService(repository IUserRepository) UserService

func NewUserServiceResolve

func NewUserServiceResolve(rabbitMQConfig rabbitmqv2.Config, mongoConfig mongo.Config) UserService

Jump to

Keyboard shortcuts

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