domain

package
v0.0.0-...-59258b7 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Enabled  = "ENABLED"  // the user is enabled.
	Disabled = "DISABLED" // the user is disabled
	Pending  = "PENDING"  // The user is pending when the user use the registration usercase that need tha a user administrator approve the registration
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IDToken

type IDToken struct {
	SS string `json:"idToken"`
}

IDToken stores token properties that are accessed in multiple application layers

type RefreshToken

type RefreshToken struct {
	ID  uuid.UUID `json:"-"`
	UID uuid.UUID `json:"-"`
	SS  string    `json:"refreshToken"`
}

RefreshToken stores token properties that are accessed in multiple application layers

type TokenPair

type TokenPair struct {
	IDToken
	RefreshToken
}

TokenPair used for returning pairs of id and refresh tokens

type TokenRepository

type TokenRepository interface {
	SetRefreshToken(ctx context.Context, userID string, tokenID string, expiresIn time.Duration) error
	DeleteRefreshToken(ctx context.Context, userID string, prevTokenID string) error
	DeleteUserRefreshTokens(ctx context.Context, userID string) error
}

type TokenUseCase

type TokenUseCase interface {
	NewPairFromUser(ctx context.Context, u *User, prevTokenID string) (*TokenPair, error)
}

type User

type User struct {
	ID       uuid.UUID `db:"uid" json:"uid"`
	Name     string    `db:"name" json:"name"`
	Email    string    `db:"email" json:"email"`
	Password string    `db:"password" json:"-"`
}

type UserRepository

type UserRepository interface {
	FindByID(ctx context.Context, uid uuid.UUID) (*User, error)
	FindByEmail(ctx context.Context, email string) (*User, error)
}

type UserUseCase

type UserUseCase interface {
	Get(ctx context.Context, uid uuid.UUID) (*User, error)
	Login(ctx context.Context, user *User) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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