service

package
v0.0.0-...-e331df4 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: MIT Imports: 9 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 {
	// User Sign Up.
	SignUp(ctx context.Context, input domain.SignUpInput) (*domain.Tokens, error)
	// User Sign In.
	SignIn(ctx context.Context, input domain.SignInInput) (*domain.Tokens, error)
	// Refresh user access token token.
	RefreshToken(ctx context.Context, input domain.SessionCredInput) (string, error)
}

Auth service interface.

type AuthService

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

Auth service structure.

func NewAuthService

func NewAuthService(session Session, cfg *config.AuthConfig) *AuthService

Creating a new auth service.

func (*AuthService) RefreshToken

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

Refresh user access token token.

func (*AuthService) SignIn

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

User Sign In.

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 ksuid.KSUID) (bool, error)
	// Updating a post.
	Update(ctx context.Context, input domain.UpdatePostInput) (bool, error)
	// Getting a post.
	Get(ctx context.Context, id ksuid.KSUID) (*domain.Post, error)
	// Getting a posts.
	GetList(ctx context.Context, sort domain.SortOptions) (*domain.PostConnection, error)
}

Post service interface.

type PostService

type PostService struct{}

Post service structure.

func NewPostService

func NewPostService() *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 ksuid.KSUID) (bool, 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) GetList

Getting a posts.

func (*PostService) Update

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

Updating a post.

type Service

type Service struct {
	Auth    Auth
	User    User
	Session Session
	Post    Post
}

Service structure.

func NewService

func NewService(cfg *config.Config) *Service

Creating a new service.

type Session

type Session interface {
	// Creating a new fake user session.
	Create(userId ksuid.KSUID) (*domain.Tokens, error)
	// Deleting a fake user session.
	Delete(ctx context.Context, id ksuid.KSUID) (bool, error)
	// Getting a fake user session.
	Get(ctx context.Context, id ksuid.KSUID) (*domain.Session, error)
	// Getting a fake user sessions.
	GetList(ctx context.Context, sort domain.SortOptions) (*domain.SessionConnection, error)
}

User session service interface.

type SessionService

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

User session service structure.

func NewSessionService

func NewSessionService(cfg *config.AuthConfig) *SessionService

Creating a new user session service.

func (*SessionService) Create

func (s *SessionService) Create(userId ksuid.KSUID) (*domain.Tokens, error)

Creating a new fake user session.

func (*SessionService) Delete

func (s *SessionService) Delete(ctx context.Context, id ksuid.KSUID) (bool, error)

Deleting a user session.

func (*SessionService) Get

Getting a user session.

func (*SessionService) GetList

Getting a user sessions.

type User

type User interface {
	// Creating a new user verification email code.
	CreateVerifyEmailCode(ctx context.Context, email string) (bool, error)
	// Forgot user password.
	ForgotPassword(ctx context.Context, input domain.ForgotPasswordInput) (bool, error)
	// Update user avatar.
	UpdateAvatar(ctx context.Context, file graphql.Upload) (string, error)
	// Getting a user.
	Get(ctx context.Context, id ksuid.KSUID) (*domain.User, error)
}

User service interface.

type UserService

type UserService struct{}

User service structure.

func NewUserService

func NewUserService() *UserService

Creating a new user service.

func (*UserService) CreateVerifyEmailCode

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

Creating a new user verification email code.

func (*UserService) ForgotPassword

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

Forgot user password.

func (*UserService) Get

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

Getting a user.

func (*UserService) UpdateAvatar

func (s *UserService) UpdateAvatar(ctx context.Context, file graphql.Upload) (string, error)

Update user avatar.

Jump to

Keyboard shortcuts

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