service

package
v0.0.0-...-1a64ad2 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth interface {
	SignUp(ctx context.Context, input domain.SignUpInput) (*domain.Tokens, error)
	SignIn(ctx context.Context, input domain.SignInInput) (*domain.Tokens, error)
	SignOut(ctx context.Context, input domain.RefreshTokenInput) error
	RefreshToken(ctx context.Context, input domain.RefreshTokenInput) (string, error)
}

User auth interface.

type AuthService

type AuthService struct {
	// contains filtered or unexported fields
}

User auth service structure.

func NewAuthService

func NewAuthService(client v1.UserAuthServiceClient) *AuthService

Creating a new auth service.

func (*AuthService) RefreshToken

func (s *AuthService) RefreshToken(ctx context.Context, input domain.RefreshTokenInput) (string, error)

Refresh user auth tokens by refresh token.

func (*AuthService) SignIn

func (s *AuthService) SignIn(ctx context.Context, input domain.SignInInput) (*domain.Tokens, error)

User Sign In.

func (*AuthService) SignOut

func (s *AuthService) SignOut(ctx context.Context, input domain.RefreshTokenInput) error

User Sign Out.

func (*AuthService) SignUp

func (s *AuthService) SignUp(ctx context.Context, input domain.SignUpInput) (*domain.Tokens, error)

User Sign Up.

type Post

type Post interface {
	// Creating a new post.
	Create(ctx context.Context, input domain.CreatePostInput) (ksuid.KSUID, error)
	// Deleting a post.
	Delete(ctx context.Context, id, authorId ksuid.KSUID) error
	// Updating a post.
	Update(ctx context.Context, input domain.UpdatePostInput) error
	// Getting a post.
	Get(ctx context.Context, id ksuid.KSUID) (*domain.Post, error)
	// Getting author posts.
	GetPosts(ctx context.Context, authorId ksuid.KSUID, sort domain.SortOptions) ([]*domain.Post, error)
}

Post service interface.

type PostService

type PostService struct {
	// contains filtered or unexported fields
}

Post service structure.

func NewPostService

func NewPostService(client v1.PostServiceClient) *PostService

Creating a new post service.

func (*PostService) Create

func (s *PostService) Create(ctx context.Context, input domain.CreatePostInput) (ksuid.KSUID, error)

Creating a new post.

func (*PostService) Delete

func (s *PostService) Delete(ctx context.Context, id, authorId ksuid.KSUID) error

Deleting a post.

func (*PostService) Get

func (s *PostService) Get(ctx context.Context, id ksuid.KSUID) (*domain.Post, error)

Getting a post.

func (*PostService) GetPosts

func (s *PostService) GetPosts(ctx context.Context, authorId ksuid.KSUID, sort domain.SortOptions) ([]*domain.Post, error)

Getting author posts.

func (*PostService) Update

func (s *PostService) Update(ctx context.Context, input domain.UpdatePostInput) error

Updating a post.

type Service

type Service struct {
	Auth
	User
	Post
}

Service structure.

func NewService

func NewService(client *grpc.Client) *Service

Creating a new service.

type User

type User interface {
	GetById(ctx context.Context, id ksuid.KSUID) (*domain.User, error)
	ForgotPassword(ctx context.Context, input domain.ForgotPasswordInput) error
	CreateVerifyEmailCode(ctx context.Context, email string) error
	VerifyEmailCode(ctx context.Context, email string, code uint64) (bool, error)
}

User interface.

type UserService

type UserService struct {
	// contains filtered or unexported fields
}

User service structure.

func NewUserService

func NewUserService(user v1.UserServiceClient, code v1.UserCodeServiceClient) *UserService

Creating a new user service.

func (*UserService) CreateVerifyEmailCode

func (s *UserService) CreateVerifyEmailCode(ctx context.Context, email string) error

Creating a new verify user email code.

func (*UserService) ForgotPassword

func (s *UserService) ForgotPassword(ctx context.Context, input domain.ForgotPasswordInput) error

Forgot user password.

func (*UserService) GetById

func (s *UserService) GetById(ctx context.Context, id ksuid.KSUID) (*domain.User, error)

Getting user by id.

func (*UserService) VerifyEmailCode

func (s *UserService) VerifyEmailCode(ctx context.Context, email string, code uint64) (bool, error)

Verifying user email code.

Jump to

Keyboard shortcuts

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